Re: import in code

2018-07-23 Thread Cameron Simpson
On 22Jul2018 15:38, Mark Lawrence wrote: On 22/07/18 05:45, Cameron Simpson wrote: Circular imports: 2 codependent modules. If you have:  module A:    import B  module B:    import B That won't work: the second import (whichever it turns out to be) will fail. One workaround is to make one of

Re: import in code

2018-07-22 Thread Mark Lawrence
On 22/07/18 05:45, Cameron Simpson wrote: On 22Jul2018 06:43, Abdur-Rahmaan Janhangeer wrote: i have found some reputable books that include import within code with ...    import x if ...    import y def ...     import z according to me they should be placed at the top. but an advantage of

Re: import in code

2018-07-21 Thread dieter
Abdur-Rahmaan Janhangeer writes: > i have found some reputable books that include import within code > > with ... > import x > > if ... > import y > > def ... > import z > > according to me they should be placed at the top. but an advantage of it is > optimisation where you only load

Re: import in code

2018-07-21 Thread Abdur-Rahmaan Janhangeer
> > > apart from circular imports? > sorry your last mail was sent to spam by gmail. now seeing it . thank you ! -- Abdur-Rahmaan Janhangeer https://github.com/abdur-rahmaanj Mauritius -- https://mail.python.org/mailman/listinfo/python-list

Re: import in code

2018-07-21 Thread Abdur-Rahmaan Janhangeer
On Sun, Jul 22, 2018 at 8:49 AM Cameron Simpson wrote: > On 22Jul2018 14:45, Cameron Simpson wrote: > >Circular imports: 2 codependent modules. apart from circular imports? -- Abdur-Rahmaan Janhangeer https://github.com/abdur-rahmaanj Mauritius -- https://mail.python.org/mailman/listinfo/pyt

Re: import in code

2018-07-21 Thread Cameron Simpson
On 22Jul2018 14:45, Cameron Simpson wrote: Circular imports: 2 codependent modules. If you have: module A: import B module B: import B That won't work: the second import (whichever it turns out to be) will fail. One workaround is to make one of the modules put off the import. A better

Re: import in code

2018-07-21 Thread Cameron Simpson
On 22Jul2018 06:43, Abdur-Rahmaan Janhangeer wrote: i have found some reputable books that include import within code with ... import x if ... import y def ... import z according to me they should be placed at the top. but an advantage of it is optimisation where you only load modu

import in code

2018-07-21 Thread Abdur-Rahmaan Janhangeer
i have found some reputable books that include import within code with ... import x if ... import y def ... import z according to me they should be placed at the top. but an advantage of it is optimisation where you only load modules if necessary so, import within code can be call