[Python-Dev] Is implicit underscore assignment buggy?
bob at redivi.com
Thu Jun 8 01:19:14 CEST 2006
On Jun 7, 2006, at 3:41 PM, Aahz wrote:
> On Wed, Jun 07, 2006, Raymond Hettinger wrote:
>>> for users, it's actually quite simple to figure out what's in the _
>>> variable: it's the most recently *printed* result. if you cannot
>>> it, it's not in there.
>> Of course, there's a pattern to it. The question is whether it is
>> *right* behavior. Would the underscore assignment be more useful and
>> intuitive if it always contained the immediately preceding result,
>> even if it was None? In some cases (such as the regexp example),
>> is a valid and useful possible result of a computation and you may
>> want to access that result with _.
> My take is that Fredrik is correct about the current behavior being
> generally useful even if it is slightly less consistent, as well as
> undesired in rare circumstances. Consider that your message is the
> one I've seen in more than five years of monitoring python-dev and
I agree. I've definitely made use of the current behavior, e.g. for
printing a different representation of _ before doing something else
More information about the Python-Dev