[Python-Dev] Syntax suggestion for imports (original) (raw)

Barry Warsaw barry at python.org
Thu Jan 3 04🔞14 CET 2008


-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

On Jan 2, 2008, at 9:08 PM, Aahz wrote:

On Wed, Jan 02, 2008, Raymond Hettinger wrote:

The standard library, my personal code, third-party packages, and my employer's code base are filled with examples of the following pattern: try: import threading except ImportError: import dummythreading as threading How about a new, simpler syntax: * import threading or dummythreading as threading My gut reaction is -0. For starters, many of these should go away with Python 3.0 (e.g. cStringIO). Also, annoying as the try/except is, I think the fact that it signals the special import is helpful; your suggestion is too light-weight IMO. If you could devise something just a bit heavier, that would be much better.

I tend to agree. The little bit of syntactic sugar doesn't really
seem worth it.

-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin)

iQCVAwUBR3xT9nEjvBPtnXfVAQIX/QQAmg9RczTAxHUe3qsry3F9DcUQZX32C9HS VMETbSnoVS0Xrdm5J7cCYqjpHlPXLKRoFCuYGWJ03ivjws/DzAsTXhpFwSmISZId 43W2UCC6mX8izr3E+bC4uEagw7EiVFsDEIX52FoUx6vIig0piZq3XolpQUqk4tP2 EhxQzTZwx6c= =U9qz -----END PGP SIGNATURE-----



More information about the Python-Dev mailing list