Re: Re: Please explain this strange Python behaviour

2009-04-30 Thread John Posner
Stephen Hansen wrote: I have a feeling this might start one of those uber-massive "pass by value / reference / name / object / AIEE" threads where everyone goes around in massive circles explaining how Python uses one or another parameter passing paradigm and why everyone else is wrong... but..

Re: Please explain this strange Python behaviour

2009-04-30 Thread Stephen Hansen
> > > * This writeup, and the virtually identical one at effbot.org that Diez > referenced, address the *what* of default arguments, but don't really > address the *why*, beyond the statement that "Default values are created > exactly once, when the function is defined (by executing the *def* < > h

Re: Please explain this strange Python behaviour

2009-04-30 Thread John Posner
Duncan Booth wrote: Tim Chase wrote: There _are_ cases where it's a useful behavior, but they're rare, so I don't advocate getting rid of it. But it is enough of a beginner gotcha that it really should be in the Python FAQ at www.python.org/doc/faq/general/ That's an excellent idea! So

Re: Please explain this strange Python behaviour

2009-04-30 Thread Tim Chase
Duncan Booth wrote: Tim Chase wrote: There _are_ cases where it's a useful behavior, but they're rare, so I don't advocate getting rid of it. But it is enough of a beginner gotcha that it really should be in the Python FAQ at www.python.org/doc/faq/general/ That's an excellent idea! So

Re: Please explain this strange Python behaviour

2009-04-30 Thread Duncan Booth
Tim Chase wrote: > There _are_ cases where it's a useful behavior, but they're rare, > so I don't advocate getting rid of it. But it is enough of a > beginner gotcha that it really should be in the Python FAQ at > www.python.org/doc/faq/general/ > That's an excellent idea! So excellent in

Re: Please explain this strange Python behaviour

2009-04-30 Thread Tim Chase
Train Bwister wrote: Please explain: http://python.pastebin.com/m401cf94d IMHO this behaviour is anything but the usual straight forward and obvious way of Python. Can you please point out the benefits of this behaviour? http://docs.python.org/tutorial/controlflow.html#more-on-defining-functi

Re: Please explain this strange Python behaviour

2009-04-30 Thread Diez B. Roggisch
Train Bwister wrote: > Please explain: http://python.pastebin.com/m401cf94d > > IMHO this behaviour is anything but the usual straight forward and > obvious way of Python. > > Can you please point out the benefits of this behaviour? http://effbot.org/pyfaq/why-are-default-values-shared-between-

Please explain this strange Python behaviour

2009-04-30 Thread Train Bwister
Please explain: http://python.pastebin.com/m401cf94d IMHO this behaviour is anything but the usual straight forward and obvious way of Python. Can you please point out the benefits of this behaviour? All the best, TrainBwister -- http://mail.python.org/mailman/listinfo/python-list