Re: [Tutor] Dictionaries of Tuples of Strings

2007-02-23 Thread Bill Sconce
On Fri, 23 Feb 2007 13:45:54 -0800 (PST) Terry Carroll <[EMAIL PROTECTED]> wrote: > > Any other way to create an empty tuple? > > Answering my own question: > > >>> t=() > >>> type(t) > Giving the lie to my earlier summary (that tuples are indicated by commas only -- arrgh :) __

Re: [Tutor] Dictionaries of Tuples of Strings

2007-02-23 Thread Luke Paireepinart
Terry Carroll wrote: > On Fri, 23 Feb 2007, Luke Paireepinart wrote: > > >> That's because you can't make tuples of single values. >> Think of it like this: >> a TUple needs TWO elements or more. >> > > No, a tuple can also be of one element, or even none. You can create a > single-element

Re: [Tutor] Dictionaries of Tuples of Strings

2007-02-23 Thread Terry Carroll
On Fri, 23 Feb 2007, Terry Carroll wrote: > You can also create an empty tuple, but I think only through the tuple() > method: > >>> t=tuple() > > Any other way to create an empty tuple? Answering my own question: >>> t=() >>> type(t) ___ Tutor m

Re: [Tutor] Dictionaries of Tuples of Strings

2007-02-23 Thread Terry Carroll
On Fri, 23 Feb 2007, Bill Sconce wrote: > It's not true that >parentheses indicate tuples > (They don't. Not unless there are "commas in there".) Except in one case, the empty tuple: t = () ___ Tutor maillist - Tutor@python.org http://mail.pyt

Re: [Tutor] Dictionaries of Tuples of Strings

2007-02-23 Thread Terry Carroll
On Fri, 23 Feb 2007, Luke Paireepinart wrote: > That's because you can't make tuples of single values. > Think of it like this: > a TUple needs TWO elements or more. No, a tuple can also be of one element, or even none. You can create a single-element tuple either directly through the use of a t

Re: [Tutor] Dictionaries of Tuples of Strings

2007-02-23 Thread Luke Paireepinart
Tim Golden wrote: > Luke Paireepinart wrote: > >> That's because you can't make tuples of single values. >> Parenthesis are ways of controlling order of operation. >> They don't create tuples unless there's more than one value. > >> Think of it like this: >> a TUple needs TWO elements or more. >> S

Re: [Tutor] Dictionaries of Tuples of Strings

2007-02-23 Thread Bill Sconce
Don't feel bad. Everyone who works with Python bumps into this. And more than once... The preceding reply is correct. But perhaps this is more specific: > TYPES_PYTHON_TO_XML = { >'int':('xs:hexbinary','xs:integer'), >'str':("xs:string") >} The problem is h

Re: [Tutor] Dictionaries of Tuples of Strings

2007-02-23 Thread Tim Golden
Luke Paireepinart wrote: > That's because you can't make tuples of single values. > Parenthesis are ways of controlling order of operation. > They don't create tuples unless there's more than one value. > Think of it like this: > a TUple needs TWO elements or more. > Solution: > use lists. They

Re: [Tutor] Dictionaries of Tuples of Strings

2007-02-23 Thread Luke Paireepinart
Adam Pridgen wrote: > Hello, > > When I have a tuple with a single string in a dictionary entry and > try to iterate over the tuple and it breaks the string into individual > characters. Is this supposed to be happening? > > This problem is a little tricky to explain so I have included the > outpu

[Tutor] Dictionaries of Tuples of Strings

2007-02-23 Thread Adam Pridgen
Hello, When I have a tuple with a single string in a dictionary entry and try to iterate over the tuple and it breaks the string into individual characters. Is this supposed to be happening? This problem is a little tricky to explain so I have included the output and the corresponding example c