PEP: possibility of inline using of a symbol instead of "import"

Mike Kent mrmakent at cox.net
Thu Jan 6 11:40:16 EST 2011


On Jan 6, 11:02 am, Duncan Booth <duncan.bo... at invalid.invalid> wrote:

> 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 Boothhttp://kupuguy.blogspot.com

My interpretation of his proposal is a bit different.  I thought he
meant that '@MyModule.myFunc' (yes, using '@' here is bad, but for
conversation sake...) would cause MyModule to be imported if this was
the first time '@MyModule' was encountered in the current module.
Sort of an implied 'import MyModule', which would eliminate the need
to actually use the explicit import.

My reaction to his proposal is 'Meh.'  Explicit is better than
implicit.  Python is not Perl.



More information about the Python-list mailing list