When do default parameters get their values set?

Rustom Mody rustompmody at gmail.com
Wed Dec 10 21:50:19 EST 2014


On Thursday, December 11, 2014 8:05:13 AM UTC+5:30, Chris Angelico wrote:
> On Thu, Dec 11, 2014 at 1:18 PM, Rustom Mody  wrote:
> > But I have a different question -- can this be demonstrated without the 'is'?
> > Because to me 'is' -- equivalently id -- is a code-smell and is like
> > explaining funny behavior by showing the dis -- like
> > $ gcc -S ...
> > -- output.
> >
> > It can always explain, but indicates that the semantics is not (sufficiently) abstract in this aspect
> 
> Not so. Object identity is a fundamental part of Python.
> Indistinguishable-but-distinct mutable objects are crucial to Python's
> behaviour.

You are saying much the same as I am.

Most programmers try to write programs without gotos.
Good (C) programmers know that 
1. gotos can be more efficient than 'structured' code
2. And even sometimes more elegant -- think of coding a non-trivial
automaton with State=Label, Transition=goto

Still most (reasonable) C-programmers will at least try to
write goto-less code.

Analogously here: 'is/id' are part of python.
Nevertheless *explaining* something with and without these
are significantly different.

Naturally we may have different feelings about 'is' in python.
However 'agree/disagree' is (in my book) a verb that is
applied to facts not feelings :-)



More information about the Python-list mailing list