[Python-ideas] from foo import bar.baz

Devin Jeanpierre jeanpierreda at gmail.com
Sat May 26 00:54:36 CEST 2012


Has it irritated anyone else that this syntax is invalid? I've wanted
it a couple of times, to be equivalent to:

    import foo.bar.baz
    from foo import bar
    del foo # but only if we didn't import foo already before"

The idea being that one wants access to foo.bar.baz under the name
bar.baz , for readability purposes or what have you.

I played around with adding this, but I seem to have really bad luck
with extending CPython...

-- Devin



More information about the Python-ideas mailing list