[Python-Dev] Is implicit underscore assignment buggy? (original) (raw)
Raymond Hettinger raymond.hettinger at verizon.net
Wed Jun 7 23:49:23 CEST 2006
- Previous message: [Python-Dev] Is implicit underscore assignment buggy?
- Next message: [Python-Dev] Is implicit underscore assignment buggy?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
When the result of an expression is None, the interactive interpreter correctly suppresses the display of the result. However, it also suppresses the underscore assignment. I'm not sure if that is correct or desirable because a subsequent statement has no way of knowing whether the underscore assignment is current or whether it represents an earlier non-None result.
Here's an example from a co-worker's regular expression experiments:
import re, string re.search('lmnop', string.letters) <_sre.SRE_Match object at 0xb6f2c480> re.search('pycon', string.letters) if is not None: ... print _.group() lmnop
Raymond
- Previous message: [Python-Dev] Is implicit underscore assignment buggy?
- Next message: [Python-Dev] Is implicit underscore assignment buggy?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]