Steven D'Aprano writes:
> On Fri, 26 Feb 2016 10:38 am, Ben Finney wrote:
>
> > Gregory Ewing writes:
> >
> >> sohcahto...@gmail.com wrote:
> >> > Now, I've noticed people talking about importing os.path. Is there any
> >> > reason to use "import os.path" rather than "import os"? Both of them
On Fri, Feb 26, 2016 at 2:56 PM, Ian Kelly wrote:
> On Thu, Feb 25, 2016 at 5:40 PM, Steven D'Aprano wrote:
>> If you take "Special cases are not special enough" seriously, you will not
>> use `import os.path` since os is not a package:
>>
>> py> os.__package__
>> ''
>>
>> and os.path is not part
On Thu, Feb 25, 2016 at 5:40 PM, Steven D'Aprano wrote:
> If you take "Special cases are not special enough" seriously, you will not
> use `import os.path` since os is not a package:
>
> py> os.__package__
> ''
>
> and os.path is not part of os, it's just a publicly exposed attribute which
> merel
On Fri, 26 Feb 2016 10:38 am, Ben Finney wrote:
> Gregory Ewing writes:
>
>> sohcahto...@gmail.com wrote:
>> > Now, I've noticed people talking about importing os.path. Is there any
>> > reason to use "import os.path" rather than "import os"? Both of them
>> > will still put the "os" module in
Gregory Ewing writes:
> sohcahto...@gmail.com wrote:
> > Now, I've noticed people talking about importing os.path. Is there any
> > reason to use "import os.path" rather than "import os"? Both of them will
> > still put the "os" module into the global namespace.
>
> In the case of os.path it do
sohcahto...@gmail.com wrote:
Now, I've noticed people talking about importing os.path. Is there any
reason to use "import os.path" rather than "import os"? Both of them will
still put the "os" module into the global namespace.
In the case of os.path it doesn't matter, because the
os module im
On Wednesday, February 24, 2016 at 5:07:57 PM UTC-8, Dan Stromberg wrote:
> Could people please compare and contrast the two ways of doing imports
> in the Subject line?
>
> I've long favored the latter, but I'm working in a code base that
> prefers the former.
>
> Is it fair to say that the form
On 02/25/2016 08:20 AM, Dan Stromberg wrote:
My intuition is telling me that "module.data; module.data.mutate()"
would be easier to monkey patch in a way that all modules will see.
Is that fair to say?
It is fair to say that if you need to monkey-patch a module, you should
import the module.
On 02/24/2016 07:39 PM, Steven D'Aprano wrote:
(2) import module
(a) Mutation is no different from (1)(a) above. No change.
(b) Rebinding `module.data = []` affects the imported module, and therefore
everything that relies on it.
More accurate: and therefore everything that has not already d
On Thu, Feb 25, 2016 at 8:15 AM, Dan Stromberg wrote:
> On Wed, Feb 24, 2016 at 7:39 PM, Steven D'Aprano
> wrote:
>> On Thursday 25 February 2016 12:07, Dan Stromberg wrote:
>>
>>> Could people please compare and contrast the two ways of doing imports
>>> in the Subject line?
>>
>> from module im
On Wed, Feb 24, 2016 at 7:39 PM, Steven D'Aprano
wrote:
> On Thursday 25 February 2016 12:07, Dan Stromberg wrote:
>
>> Could people please compare and contrast the two ways of doing imports
>> in the Subject line?
>
> from module import data; print(data)
>
> import module; print(module.data)
>>
On Thursday 25 February 2016 12:07, Dan Stromberg wrote:
> Could people please compare and contrast the two ways of doing imports
> in the Subject line?
from module import data; print(data)
import module; print(module.data)
> I've long favored the latter, but I'm working in a code base that
>
On 24Feb2016 17:07, Dan Stromberg wrote:
Could people please compare and contrast the two ways of doing imports
in the Subject line?
I've long favored the latter, but I'm working in a code base that
prefers the former.
I largely use the former "from module import name, name..." over "import
Could people please compare and contrast the two ways of doing imports
in the Subject line?
I've long favored the latter, but I'm working in a code base that
prefers the former.
Is it fair to say that the former increases the surface area of your
shared (sometimes mutable) state?
It's clear that
14 matches
Mail list logo