
Hi, I'm wondering if it's possible and consistent that loosen 'as' assignment, for example:
import psycopg2 as pg import psycopg2.extensions as pg.ex
You can't now assign to an attribute in as statement but are there some reasons? To be honest, I'll be satisfied if the statement above become valid, but also interested in general design decisions about 'as' functionality, I mean, it can be applicable to all expression that can be left side of '=' such as 'list[n]' one, and also other statement than 'import' such as 'with'. Thanks,

On 16 June 2018 at 15:49, Rin Arakaki <koyukukan@gmail.com> wrote:
This is essentially monkeypatching the psycopg2 module to alias the "extensions" submodule as the "ex" submodule. You can already do that today as: >>> import psycopg2 as pg >>> import psycopg2.extensions >>> pg.ex = pg.extensions Monkeypatching other modules at runtime is a questionable enough practice that we're unlikely to add syntax that actively encourages it. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia

On 16 June 2018 at 15:49, Rin Arakaki <koyukukan@gmail.com> wrote:
This is essentially monkeypatching the psycopg2 module to alias the "extensions" submodule as the "ex" submodule. You can already do that today as: >>> import psycopg2 as pg >>> import psycopg2.extensions >>> pg.ex = pg.extensions Monkeypatching other modules at runtime is a questionable enough practice that we're unlikely to add syntax that actively encourages it. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia
participants (2)
-
Nick Coghlan
-
Rin Arakaki