maybe a bug in python: NOW Pythonic Gotchas

Ivan Van Laningham ivanlan at pauahtun.org
Sun Jun 5 13:27:09 EDT 2005


Hi All--
This little gotcha ought to be number one on "The Official List of
Pythonic Gotchas," which should be required reading for everyone.

What?  There isn't one?  Why not?

Send me your tired, your poor, your huddled gotchas yearning to breathe
free.  I'll whup 'em into shape and make a doc page.  The gods of
documentation (as opposed to the gods _in_ documentation) can transfer
it to the Official Documentation Homeland, or not, as they see fit.

Metta,
Ivan

Tiago Stürmer Daitx wrote:
> 
> Just as everyone said, use ('a',) instead of ('a'). As Steve said
> there are lots of documentation about it. Check the Library Reference
> at http://www.python.org/doc/current/lib/typesseq.html#l2h-155 or to
> make things more clear you could read the tuples section in the
> tutorial at
> http://docs.python.org/tut/node7.html#SECTION007300000000000000000
> 
> my 2 cents
> 
> Regards,
> Tiago S Daitx
> 
> On 6/5/05, flyaflya <flyaflya at gmail.com> wrote:
> 
>      >>> a = {1: ("a")}
>      >>> a[1]
>      'a'
>      why not ('a')? when
>      >>> a = {1: ((("a")))}
>      >>> a[1]
>      'a'
>      the result is 'a' too,not ((("a"))).but when use["a"] or
>      ("a","b"),the
>      tuple is longer than 1, it's no problem.
> 
>      --
>      [http://www.flyaflya.com/]
>      --
>      http://mail.python.org/mailman/listinfo/python-list
> 
>     ---------------------------------------------------------------
> --
> http://mail.python.org/mailman/listinfo/python-list

-- 
----------------------------------------------
Ivan Van Laningham
God N Locomotive Works
http://www.pauahtun.org/
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps:  Cu Chi, Class of '70
Author:  Teach Yourself Python in 24 Hours



More information about the Python-list mailing list