Re: Python as Guido Intended

2005-11-27 Thread Serge Orlov
Antoon Pardon wrote: > No it wasn't. From what I have picked up, the ternary operator > was finaly introduced after one of the developers tripped over > the commonly used idiom to simulate a ternary operator, which > can fail in certain cases. > > Anyway, when I was arguing for a ternary operator

Re: Comparison problem

2005-11-27 Thread Tim Henderson
peter would not the more correct way to do this be short circuit evaluation. somthing along lines of if (len(item) > 0) and (item[0] == '-'): pass seems to be the more correct approach. rather than relying on slicing to return an empty string. For instance suppose you wanted to test to see if th

Newbie question: Tab key giving different output

2005-11-27 Thread getkaizer
Hello, I'm a newbie to python. I run python under Manddrake Linux 10.2 from a terminal. While in the interactive mode, i need to use the tab key to indent my code. However, i get a message "List all 174 possibilities? (Y/N)" instead of an indent. So i use spaces. How do i tell python to give me i

Re: Newbie question: Tab key giving different output

2005-11-27 Thread Tim Henderson
i think it is telling you to use spaces btw i have no idea, it just sounds like a funny thing to happen -- http://mail.python.org/mailman/listinfo/python-list

Re: New docs for set elements/dictionary keys

2005-11-27 Thread Mike Meyer
Christoph Zwerschke <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> Any object for which hash() returns an appropriate value(1) can be >> used as a dictionary key/set element. Lists, sets and dicts are not >> hashable, and can not be used. Tuples can be used if all the things >> they contain are

Re: General question about Python design goals

2005-11-27 Thread Paul Rubin
Jean-Paul Calderone <[EMAIL PROTECTED]> writes: > >I can't think of a single use case for the addition (+) operator > >working where either of the operands happens to be the number > >0x15f1ef02d9f0c2297e37d44236d8e8ddde4a34c96a8200561de00492cb94b82 (a > >random number I just got out of /dev/urando

Re: should python have a sort list-map object in the std-lib?

2005-11-27 Thread Alex Martelli
Tim Henderson <[EMAIL PROTECTED]> wrote: ... > Hi > > The question why are there no sorted dictionaries in python, seems to > pop up with unseeming regularity. That question in itself in > nonsensical sense dictionaries are hash-maps, however should python > have a sorted map type object is a g

Re: should python have a sort list-map object in the std-lib?

2005-11-27 Thread Tim Henderson
ahh, i hadn't thought of using a proirity queue but that is the correct solution most of the time, except i suppose when you have input that causes you to excessively reheap which could be problematic. i may still look into writing a general sorted map though, it could be useful especially if ther

Death to tuples!

2005-11-27 Thread Mike Meyer
It seems that the distinction between tuples and lists has slowly been fading away. What we call "tuple unpacking" works fine with lists on either side of the assignment, and iterators on the values side. IIRC, "apply" used to require that the second argument be a tuple; it now accepts sequences, a

Re: Death to tuples!

2005-11-27 Thread Paul Rubin
Mike Meyer <[EMAIL PROTECTED]> writes: > The new intended use is as an immutable sequence type, not a > "lightweight C struct". The new name to denote this new use - > following in the footsteps of the set type - is "frozenlist". The > changes to the implementation would be adding any non-mutating

Re: Death to tuples!

2005-11-27 Thread Dan Bishop
Mike Meyer wrote: > It seems that the distinction between tuples and lists has slowly been > fading away. What we call "tuple unpacking" works fine with lists on > either side of the assignment, and iterators on the values side. IIRC, > "apply" used to require that the second argument be a tuple; i

<    1   2