D
dmitrey
hi all,
I have th PEP (I'm not sure something like that hadn't been proposed
although):
very often in a Python file header the following lines are present,
like:
from MyModule1 import myFunc1
import MyModule2 as mm2
from MyModule3 import myFunc3 as mf3
etc
and after several pages of code they are using somewhere, maybe only
one time, e.g.
r1 = myFunc1(...)
r2 = mm2.myFunc2(...)
r3 = mf3(...)
It makes programs less clear, you have to scroll several pages of code
in IDE to understand what it refers to.
I propose to add possibility of using a symbol instead (for simplicity
I use @ here, that is already reserved for decorators, thus it should
be other symbol, maybe from Unicode although for simplicity to type it
I would prefer something ordinary like $ or ` or !).
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".
As for __import__(ModuleTextName), it could be replaced to something
like @(ModuleTextName) or @{ModuleTextName} or @[ModuleTextName].
Regards, D.
I have th PEP (I'm not sure something like that hadn't been proposed
although):
very often in a Python file header the following lines are present,
like:
from MyModule1 import myFunc1
import MyModule2 as mm2
from MyModule3 import myFunc3 as mf3
etc
and after several pages of code they are using somewhere, maybe only
one time, e.g.
r1 = myFunc1(...)
r2 = mm2.myFunc2(...)
r3 = mf3(...)
It makes programs less clear, you have to scroll several pages of code
in IDE to understand what it refers to.
I propose to add possibility of using a symbol instead (for simplicity
I use @ here, that is already reserved for decorators, thus it should
be other symbol, maybe from Unicode although for simplicity to type it
I would prefer something ordinary like $ or ` or !).
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".
As for __import__(ModuleTextName), it could be replaced to something
like @(ModuleTextName) or @{ModuleTextName} or @[ModuleTextName].
Regards, D.