allowing braces around suites
Grant Edwards
grante at visi.com
Sat Aug 28 10:56:50 EDT 2004
On 2004-08-28, Reinhold Birkenfeld <reinhold-birkenfeld-nospam at wolke7.net> wrote:
> Isaac To wrote:
>>>>>>> "Kjetil" == Kjetil Torgrim Homme <kjetilho at yksi.ifi.uio.no> writes:
>>
>> Kjetil> that's a hack, and IMHO not worthy of a Python program.
>> Kjetil> not even Perl has anything like that, AFAIK.
>>
>> Hm... hacks are not for Python?! We see every kind of hacks
>> everywhere in Python just like it is in Perl, like (2,) syntax, etc.
>
> Why would you call (2,) syntax a hack?
Because so many people at first think that parens construct
tuples the way square-brackets and curly-brackets construct
lists. When in reality it's commas that construct tuples, but
only in certain contexts because commas are used for about
three other purposes as well.
> If you like, you can call tuple([2]), but I would consider _this_ an
> ugly solution or a "hack".
I would call it the former.
IMO, the only non-ugly, non-hack solution would be to have
another set of delimters that are used as tuple-constructors so
tha the syntax for a literal tuple, a literal list, and a
literal dictionary are consistent.
--
Grant Edwards grante Yow! AIEEEEE! I am having
at an UNDULATING EXPERIENCE!
visi.com
More information about the Python-list
mailing list