Coding standard: Prefixing variables to indicate datatype

Hans Nowak wurmy at earthlink.net
Sun Jan 19 22:42:29 EST 2003


[me]
>>If the join operation is done by calling a method on the separator, I would 
>>expect the same on the split operation:
>>
>>  " ".split("a b c")
>>  # should yield ["a", "b", "c"]
>>
>>...but for some reason, that didn't make it into the design. ;-)

[Jp Calderone]
>   "A foolish consistency is the hobgoblin of little minds."  -rwe
> 
> [...] So
> why aim for consistency, when we can achieve usefulness instead?

That sounds more like a Perl mantra. ;-)

My point was that nobody in their right mind would implement split like this. 
Not as a method of the (optional!) separator, with the string that's being 
split as an argument.  join works just like that, though.  Yes, I know *why* 
it's done, and I agree that the alternative is even worse.  But it's a kludge 
at best, the lesser evil out of two choices.  I certainly would not call it 
"rational" or "intuitive", no matter how many "illuminati" might try to explain 
its ugliness away.

Cheers,

-- 
Hans (base64.decodestring('d3VybXlAZWFydGhsaW5rLm5ldA=='))
# decode for email address ;-)
The Pythonic Quarter:: http://www.awaretek.com/nowak/
Kaa:: http://www.awaretek.com/nowak/kaa.html





More information about the Python-list mailing list