-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
... > I have always felt uncomfortable with *any* kind of optimization -- > whether AST-based or bytecode-based. I feel the cost in code > complexity is pretty high and in most cases the optimization is not > worth the effort. Also I don't see the point in optimizing expressions > like "3 * 4 * 5" in Python. In C, this type of thing occurs frequently > due to macro expansion and the like, but in Python your code usually > looks pretty silly if you write that. Just as a side comment here, I often do this sort of thing when dealing with time based comments, or large constants. It is a bit more obvious that: 10*1024*1024 vs 10485760 is 10MiB especially since you can't put commas in your constants. 10,485,760 would at least make it immediately obvious it was 10M not 104M or something else. Similarly is 10,800s 3 hours? 3*60*60 certainly is. I don't think I've done that sort of thing in anything performance critical. But I did want to point out that writing "X*Y*Z" as a constant isn't always "pretty silly". John =:-> -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk17c0sACgkQJdeBCYSNAAMUrQCdEhissWuvTElIc6Wy/2qotzaU xz4AnRO+ND/3NkKWC7Bbu78ACjs2X920 =QR/2 -----END PGP SIGNATURE----- _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com