How to make a variable's late binding crosses the module boundary?
dn
PythonList at DancesWithMice.info
Wed Aug 31 03:53:49 EDT 2022
On 31/08/2022 19.38, Antoon Pardon wrote:
>
>
> Op 30/08/2022 om 23:52 schreef dn:
>> The conversation seems to be wandering some way from the OP. Whereas
>> both of these answers are clever (and I assume work), the question
>> becomes: why would you want to do this? (especially as it looks ugly and
>> 'smells' a bit convoluted). An example use-case from your experience?
>>
>>
>> Delving into the list-archive, to get back to the OP: the first message
>> in the thread quotes another message that's (apparently) not present.
>>
>> However, in there somewhere is:
>>
>>> from test import *
>> So, the elephant-in-the-room has always been a very stinky 'code-smell'
>> - which pretty much every text or web-tutorial will say is a bad idea.
>
> No that is a red herring. If for some reason a variable in a module has
> to be (re)set after import time, it doesn't matter whether someone uses
>
> from module import *
>
> or
>
> from module import resetable_variable
>
> in both cases the module that did the import will not notice the change
> in the original module.
>
> focussing on the code smell, is leading the attention away from the
> problem.
Are you the OP?
The behavior has been shown to be exactly that which is (should be)
expected.
--
Regards,
=dn
More information about the Python-list
mailing list