lambda
Antoon Pardon
apardon at forel.vub.ac.be
Mon Jan 17 04:45:52 EST 2005
Op 2005-01-14, Steve Holden schreef <steve at holdenweb.com>:
> Antoon Pardon wrote:
>
>> Op 2005-01-13, hanz schreef <hanzspam at yahoo.com.au>:
>>
>>>Antoon Pardon wrote:
>>>
>>>>So if I have a call with an expression that takes more than
>>>>one line, I should assign the expression to a variable and
>>>>use the variable in the call?
>>>
>>>Yes, that's sometimes a good practice and can clarify
>>>the call.
>>>
>>>
>>>>But wait if I do that, people will tell me how bad that it
>>>>is, because it will keep a reference to the value which
>>>>will prevent the garbage collector from harvesting this
>>>>memory.
>>>
> Of course, unless that reference is in the global scope of the __main__
> module its lifetime will be transient anyway. If the reference is stored
> in a function's local variable then unless its value is returned from
> the function it will become available for garbage collection when the
> function returns.
>
>>>Nobody will tell you that it's bad.
>>
>>
>> Sorry, someone already did. If I recall correctly it
>> was Alex Martelli.
>>
> "A foolish consistency is the hobgoblin of little minds". Rules are made
> to be broken.
Like only use immutables as dictionary keys.
> Besides which, if you don't understand the language
> environment, rules alone will do you very little good. Try to focus a
> little more on principles and a little less on minutiae.
And what are the difference between those two?
Sometimes I get the impression that everything is a principle until
one personnaly finds the need to break it. After that it is a rule.
--
Antoon Pardon
More information about the Python-list
mailing list