skip to main | skip to sidebar

stupefy developer

blog about software development, *nix and anything that is related to that

Friday, September 12, 2008

python: tuple with one item

When you want to construct a tuple containing only one item you should write

variable = (1,)
You have to add extra coma after the item. If you forget this coma the item will be returned, not the tuple.
Weird =/

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

License

Creative Commons License
This blog is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.

My projects

  • libdodo/c++ web toolkit

Articles

  • ►  2010 (3)
    • ►  September (1)
    • ►  June (1)
    • ►  March (1)
  • ►  2009 (23)
    • ►  September (2)
    • ►  July (1)
    • ►  June (1)
    • ►  May (1)
    • ►  April (3)
    • ►  March (6)
    • ►  February (5)
    • ►  January (4)
  • ▼  2008 (81)
    • ►  December (7)
    • ►  November (10)
    • ►  October (20)
    • ▼  September (4)
      • c++: Koenig lookup
      • linux: emergency reboot remote box
      • python: tuple with one item
      • c++: exception in constructor
    • ►  August (6)
    • ►  July (1)
    • ►  June (5)
    • ►  May (5)
    • ►  April (5)
    • ►  March (5)
    • ►  February (3)
    • ►  January (10)
  • ►  2007 (4)
    • ►  December (4)

About Me

My photo
Ni@m
View my complete profile

Links

Участник планеты Developers.org.ua