Proposal: Inline Import

"Martin v. Löwis" martin at v.loewis.de
Sun Dec 11 05:48:46 EST 2005


Shane Hathaway wrote:
> Thoughts?

I have two reasons to dislike it:
1. It's a language change. Others have pointed out that you can achieve
   the same without a language change; it would be easy to write

   name_expr = _import.re.compile('[a-zA-Z]+')

2. In the form in which you have written it, I believe it is
   unimplementable (or, else, an implementation would have
   counter-intuitive border cases). For example, what would

   .xml.sax.expatreader.ExpatParser.__init__(self)

   mean? From the description, it appears that it would be

   from xml.sax.expatreader.ExpatParser import __init__ as \
    __hidden_xml_sax_expatreader_ExpatParser___init__

   which, of course, wouldn't work, because ExpatParser is
   not a module.
3. As in any good list of two items, I have a third complaint:
   for packages, this would be tedious to type (as the sax
   example illustrates)

Regards,
Martin



More information about the Python-list mailing list