PEP: possibility of inline using of a symbol instead of "import"
Duncan Booth
duncan.booth at invalid.invalid
Thu Jan 6 11:02:40 EST 2011
dmitrey <dmitrey.kroshko at scipy.org> wrote:
> e.g. instead of
>
> import MyModule
> (...lots of code...)
> r = MyModule.myFunc(...)
>
> someone could just type in the single place
>
> r = @MyModule.myFunc(...)
>
> Also, "import MyModule2 as mm2" could be replaced to mere
> mm2 = @MyModule2
> and "from MyModule3 import myFunc3 as mf3" could be replaced to mere
> "mf3 = @MyModule3.myFunc3".
If you just import the modules at the top of the file then there's
nothing to prevent you writing:
mm2 = MyModule2
mf3 = MyModule3.myFunc3
without any punctuation to obscure the meaning.
Your complaint seems to be that:
r1 = myFunc1(...)
is unclear when you don't know where myfunc1 originates, so why don't
you write:
r1 = MyModule1.myFunc1(...)
--
Duncan Booth http://kupuguy.blogspot.com
More information about the Python-list
mailing list