code review

R

Rick Johnson

You must be joking.


Well i was slightly serious, but mostly sarcastic.

Whist customizable syntax would be a great benefit to the individual,
it would be a nightmare to the community -- the real solution lies in
assimilation!

I am reminded of a story: A few years back a very nice old woman
offered to give me her typewriter. She said: "i might need to type a
letter one day and it would good to have around". It was a nice
typewriter for 1956, but she had no idea her little "machine" was
reduced to no less than a paper weight thanks to something called the
PC. Her machine had been extinct for decades. Effectually, SHE had
been extinct for decades.

When i hear people like Chris evangelizing about slavish syntax, i am
reminded of the nice old lady. Her intentions where virtuous, however
her logic was flawed. She is still clinging to old technology. Like
the Luddites she refuses to see the importance technological
advancements. And by harboring this nostalgia she is actually
undermining the future evolution of an entire species. Lifespans are
limited for a very important evolutionary reason!
 
C

Chris Angelico

You must be joking.

In C, for example, it is possible to "create your own language" by going

#define IF(cond) if (cond) {
#define ELSE } else {
#define ELIF(cond) } else if (cond) {
#define ENDIF }


and so on. There's a reason nobody does it.

I'll go one further. The "create your own language" is just a plain
text file, is in fact is NO LANGUAGE. If it's that flexible, what's
the use of calling it the same language?

Actually there is a lot of use in having that sort of commonality, but
at a different level: source control. Tools like git are
language-agnostic; I can have a repository with Javascript, PHP (ugh),
Pike (that atones), Python, C++, etc source files, a single makefile
that in the darkness binds them, and so on. But they're still all
different languages.

Oh and Rick? Nice troll there with the ellipsis. You fail grammar
forever, but hey, at least you win at trolling.

ChrisA
 
S

Steven D'Aprano

Oh yes, absolutely consistent. Consistency. It's a CR 1/2 monster found
on page 153 of the 3.5th Edition Monster Manual.

GvR is fond of quoting Ralph Waldo Emerson:

"A foolish consistency is the hobgoblin of little minds."

Perhaps the world would be better off if mathematicians threw out the
existing precedence rules and replaced them with a strict left-to-right
precedence. (Personally, I doubt it.)

But until they do, consistency with mathematics is far more important
than the foolish consistency of left-to-right precedence.
 
C

Chris Angelico

GvR is fond of quoting Ralph Waldo Emerson:

"A foolish consistency is the hobgoblin of little minds."

Yeah, that's what I was referring to. Dungeons and Dragons has specs
for a hobgoblin warrior :)
Perhaps the world would be better off if mathematicians threw out the
existing precedence rules and replaced them with a strict left-to-right
precedence. (Personally, I doubt it.)

But until they do, consistency with mathematics is far more important
than the foolish consistency of left-to-right precedence.

And if they ever do, it'll break consistency with past centuries of
mathematical writing. Imagine (taking this to another realm) that it's
decided that since Wolfram is now called Tungsten, it should have the
chemical symbol 'T' instead of 'W'. This is far more consistent,
right? And Iron should be I, not Fe. We'll move Iodine to Io (and
Europium to Europa and Gallium to Ganymede?), and tritium (the isotope
of hydrogen) can become H3. It'd make today's chemistry notes look as
archaic and unreadable as those using alchemical symbols, only the
actual symbols are the same, making it ambiguous. Nope. Better to
stick with what's standardized.

ChrisA
 
J

John O'Hagan

And if they ever do, it'll break consistency with past centuries of
mathematical writing. Imagine (taking this to another realm) that it's
decided that since Wolfram is now called Tungsten, it should have the
chemical symbol 'T' instead of 'W'. This is far more consistent,
right? And Iron should be I, not Fe. We'll move Iodine to Io (and
Europium to Europa and Gallium to Ganymede?), and tritium (the isotope
of hydrogen) can become H3. It'd make today's chemistry notes look as
archaic and unreadable as those using alchemical symbols, only the
actual symbols are the same, making it ambiguous. Nope. Better to
stick with what's standardized.

I agree to some extent, but as a counter-example, when I was a child there
a subject called "Weights and Measures" which is now redundant because of the
Metric system. I don't miss hogsheads and fathoms at all.

Music is another field which could do with a "metrification": I get tired of
explaining to beginners why there's no B#, except when it's C. Check out
http://musicnotation.org

If legacy systems get too far out of sync with current practice, they become
an unnecessary layer of complexity and a hurdle to understanding, and at some
point you have to take the plunge, old books be damned.
 
S

Steven D'Aprano

I agree to some extent, but as a counter-example, when I was a child
there a subject called "Weights and Measures" which is now redundant
because of the Metric system. I don't miss hogsheads and fathoms at all.

Don't mistake tradition for consistency. There's little consistency in
the legacy weights and measures used before the metric system. The
introduction of the Imperial system in 1824 at least got rid of *some* of
the more wacky measures, and standardised the rest, but there was still
damn little consistency: e.g. a finger was 7/8 of an inch, and an ell was
45 inches, meaning an ell is 39 and 3/8th fingers.

One of my favourites is the league, which in the Middle Ages was actually
defined as the distance that a man, or a horse, could walk in an hour.
 
R

rusi

I agree to some extent, but as a counter-example, when I was a child there
a subject called "Weights and Measures" which is now redundant because ofthe
Metric system. I don't miss hogsheads and fathoms at all.

Music is another field which could do with a "metrification": I get tiredof
explaining to beginners why there's no B#, except when it's C. Check outhttp://musicnotation.org

You assume that equal temperament is the only way to have music.
Apart from the fact that there are non-tempered musics all over the
world, even Bach Mozart and Beethoven did not write for/to equal
temperament. In a pure/untempered C-scale A-flat is almost half a
semitone sharper than G-sharp -- 8/5 vs 25/16.

Similar for standardized languages: Python's indentation is nice --
except when you have to embed it into say, html
 
D

Dennis Lee Bieber

One of my favourites is the league, which in the Middle Ages was actually
defined as the distance that a man, or a horse, could walk in an hour.

From the "Explanatory Supplement to the Astronomical Almanac" [1992
University Science Books], Table 15.15, the speed of light is

1.80261750E12 furlongs/fortnight
 
N

Neil Cerutti

Why "poor", Ralph?

I am poor in the essence of ignorance's bliss, rich only in the
never-ending thirst for knowledge and more languages. In me there meet
a combination of antithetical elements which are at eternal war with
one another... I hope I make myself clear, lady?

His simple eloquence goes to my very heart!
 
R

Roy Smith

Dennis Lee Bieber said:
One of my favourites is the league, which in the Middle Ages was actually
defined as the distance that a man, or a horse, could walk in an hour.

From the "Explanatory Supplement to the Astronomical Almanac" [1992
University Science Books], Table 15.15, the speed of light is

1.80261750E12 furlongs/fortnight

And sure enough, that's what units says:

$ units
500 units, 54 prefixes
You have: c
You want: furlongs/fortnight
* 1.8026175e+12
/ 5.5474886e-13
 
J

John O'Hagan

You assume that equal temperament is the only way to have music.
Apart from the fact that there are non-tempered musics all over the
world, even Bach Mozart and Beethoven did not write for/to equal
temperament. In a pure/untempered C-scale A-flat is almost half a
semitone sharper than G-sharp -- 8/5 vs 25/16.
[...]

I don't assume that at all :) If you didn't already, have look at the
link. I was talking about notation of the normal everyday contemporary
tempered system where there is no pitch difference between Ab and G#. But even
in a just system, any difference between them depends on the system itself,
the key, and whether you choose to call them that. I've never heard anyone claim
that C is sharper than B#, although in the key of E the relationship would be
the same.

AIUI there is any number of whole number ratios which fall between seven and
nine tempered semitones above the fundamental (to take your example), and in
C, any one of them could be called either Ab or G# depending on the key
signature or other context. IMHO, that's the aspect that could benefit from a
simplified representation.

To the OP, I'm deeply sorry!
 
M

Mark Lawrence

On Tue, 3 Jul 2012 11:22:55 +1000

I agree to some extent, but as a counter-example, when I was a child there
a subject called "Weights and Measures" which is now redundant because of the
Metric system. I don't miss hogsheads and fathoms at all.

John

I weigh 13st 8lb - does this make me redundant?
 
C

Chris Angelico

I weigh 13st 8lb - does this make me redundant?

Yes, because somewhere in the world is someone who weighs (... pulls
out calculator...) 86kg. After all, the French had a bloody revolution
to get us a new system without any of the old baggage. We don't want
to disappoint the French now, do we!

ChrisA
lemme just dislodge my tongue from my cheek, it seems to be stuck...
 
M

Mark Lawrence

One of my favourites is the league, which in the Middle Ages was actually
defined as the distance that a man, or a horse, could walk in an hour.

From the "Explanatory Supplement to the Astronomical Almanac" [1992
University Science Books], Table 15.15, the speed of light is

1.80261750E12 furlongs/fortnight

+1 most useless piece of information garnered this week.
 
M

Mark Lawrence

Yes, because somewhere in the world is someone who weighs (... pulls
out calculator...) 86kg. After all, the French had a bloody revolution
to get us a new system without any of the old baggage. We don't want
to disappoint the French now, do we!

ChrisA
lemme just dislodge my tongue from my cheek, it seems to be stuck...

If I go to the moon I will weigh 2st 10lb (if my sums are correct :) but
the equivalent Frenchman will still be 86kg. I hereby put this forward
as proof that the metric system is rubbish and we should revert back to
imperial goodies.
 
K

Kushal Kumaran

I think I may be on firmer grounds with the next few:

isValidPassword can be simplified to

def isValidPassword(password:
count=len(password)
return count>= mud.minpass and count<= mud.maxpass

I haven't actually seen the rest of the code, but I would like to
point out that applications placing maximum length limits on passwords
are extremely annoying.
 
J

John Gordon

In said:
I haven't actually seen the rest of the code, but I would like to
point out that applications placing maximum length limits on passwords
are extremely annoying.

As a practical matter, doesn't there have to be *some* sort of limit?
For example if the (encrypted) password is stored in a database, you can't
exceed the table column width.
 
I

Ian Kelly

I haven't actually seen the rest of the code, but I would like to
point out that applications placing maximum length limits on passwords
are extremely annoying.

They're annoying when the maximum length is unreasonably small, but
you have to have a maximum length to close off one DoS attack vector.
Without a limit, if a "user" presents a 1 GB password, then guess
what? Your system has to hash that GB of data before it can reject
it. And if you're serious about security then it will be a
cryptographic hash, and that means slow.

To prevent that, the system needs to reject outright password attempts
that are longer than some predetermined reasonable length, and if the
system won't authenticate those passwords, then it can't allow the
user to set them either.

Cheers,
Ian
 
D

Dave Angel

If I go to the moon I will weigh 2st 10lb (if my sums are correct :)
but the equivalent Frenchman will still be 86kg. I hereby put this
forward as proof that the metric system is rubbish and we should
revert back to imperial goodies.

86 kg is not a weight, it's a mass. So it doesn't depend on the local
gravity situation.

DaveA
 
D

Dennis Lee Bieber

From the "Explanatory Supplement to the Astronomical Almanac" [1992
University Science Books], Table 15.15, the speed of light is

1.80261750E12 furlongs/fortnight

+1 most useless piece of information garnered this week.

Well, the book IS 20 years old <G>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top