[Python-Dev] pyc files, constant folding and borderline portability issues (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Mon Apr 6 16:43:11 CEST 2009
- Previous message: [Python-Dev] pyc files, constant folding and borderline portability issues
- Next message: [Python-Dev] pyc files, constant folding and borderline portability issues
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Cesare Di Mauro <cesare.dimauro a-tono.com> writes:
def f(): return ['a', ('b', 'c')] * (1 + 2 * 3) [...]
With proper constant folding code, both functions can be reduced to a single LOADCONST and a RETURNVALUE (or, definitely, by a single instruction at all with an advanced peephole optimizer).
Lists are mutable, you can't optimize the creation of list literals by storing them as singleton constants.
Regards
Antoine.
- Previous message: [Python-Dev] pyc files, constant folding and borderline portability issues
- Next message: [Python-Dev] pyc files, constant folding and borderline portability issues
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]