Paul Rudin wrote:
Gregory Ewing greg.ew...@canterbury.ac.nz writes:
You can clean up dir() by defining __all__ as a list of
names that you want to officially export.
I'm not sure that's necessarily a good idea... when you're trying to figure
out why something behaves in a certain way you
On Sat, 30 Oct 2010 19:30:21 +1300, Gregory Ewing wrote:
(BTW, there are no function names that have a special meaning in a
module dict -- a module is not like a class.)
Pity... it would be nice to have a __main__() function, or perhaps
main(), that was automatically called when you call the
Brendan wrote:
I use
Python sporadically, and frequently use the dir command to learn or
remind myself of class methods.
You can clean up dir() by defining __all__ as a list of
names that you want to officially export. Other names will
still be there, but they won't show up in the dir()
Gregory Ewing greg.ew...@canterbury.ac.nz writes:
Brendan wrote:
I use
Python sporadically, and frequently use the dir command to learn or
remind myself of class methods.
You can clean up dir() by defining __all__ as a list of
names that you want to officially export. Other names will
In message 8idvgaf21...@mid.individual.net, Peter Pearson wrote:
Yes, module w imports x, and therefore w.x exists. Is that bad?
No-one seems to have come out and said this yet (unless it was in one of
those messages that no longer seem to be accessible on my ISP’s news
server): Python has
On Oct 22, 2:21 pm, Peter Pearson ppear...@nowhere.invalid wrote:
On Fri, 22 Oct 2010 07:49:39 -0700 (PDT), Brendan wrote:
[snip]
x.py
class X(object):
pass
y.py
import x
class Y(x.X):
pass
z.py
import x
import y
class ZX(x.X):
pass
class ZY(y.Y):
On Thu, 21 Oct 2010 12:12:34 -0700, Brendan wrote:
Because y.py has from x import x the x class from x.py is added to
the y.py namespace.
~Ethan~- Hide quoted text -
- Show quoted text -
So what is usually done to prevent this? (In my case not wanting class x
added to the y.py
On Oct 22, 5:02 am, Steven D'Aprano st...@remove-this-
cybersource.com.au wrote:
On Thu, 21 Oct 2010 12:12:34 -0700, Brendan wrote:
Because y.py has from x import x the x class from x.py is added to
the y.py namespace.
~Ethan~- Hide quoted text -
- Show quoted text -
So what is
On 2:59 PM, Brendan wrote:
On Oct 21, 3:56 pm, Ethan Furmanet...@stoneleaf.us wrote:
snip
Because y.py has from x import x the x class from x.py is added to the
y.py namespace.
~Ethan~- Hide quoted text -
- Show quoted text -
So what is usually done to prevent this? (In my case not
On Oct 22, 9:16 am, Dave Angel da...@dejaviewphoto.com wrote:
On 2:59 PM, Brendan wrote: On Oct 21, 3:56 pm, Ethan
Furmanet...@stoneleaf.us wrote:
snip
Because y.py has from x import x the x class from x.py is added to the
y.py namespace.
~Ethan~- Hide quoted text -
- Show quoted
On Fri, 22 Oct 2010 07:49:39 -0700 (PDT), Brendan wrote:
[snip]
x.py
class X(object):
pass
y.py
import x
class Y(x.X):
pass
z.py
import x
import y
class ZX(x.X):
pass
class ZY(y.Y):
pass
w.py
import x
import y
import z
class WX(x.X):
pass
class WY(y.Y):
Two modules:
x.py:
class x(object):
pass
y.py:
from x import x
class y(x):
pass
Now from the python command line:
import y
dir(y)
['__builtins__', '__doc__', '__file__', '__name__', '__package__',
'x', 'y']
I do not understand why class 'x' shows up here.
--
On 10/21/2010 08:09 PM, Brendan wrote:
Two modules:
x.py:
class x(object):
pass
y.py:
from x import x
class y(x):
pass
Now from the python command line:
import y
dir(y)
['__builtins__', '__doc__', '__file__', '__name__', '__package__',
'x', 'y']
I do not understand why class 'x'
On Oct 21, 11:09 am, Brendan brendandetra...@yahoo.com wrote:
Two modules:
x.py:
class x(object):
pass
y.py:
from x import x
class y(x):
pass
Now from the python command line: import y
dir(y)
['__builtins__', '__doc__', '__file__', '__name__', '__package__',
'x', 'y']
I
On Oct 21, 3:47 pm, Carl Banks pavlovevide...@gmail.com wrote:
On Oct 21, 11:09 am, Brendan brendandetra...@yahoo.com wrote:
Two modules:
x.py:
class x(object):
pass
y.py:
from x import x
class y(x):
pass
Now from the python command line: import y
dir(y)
Jonas H. wrote:
On 10/21/2010 08:09 PM, Brendan wrote:
Two modules:
x.py:
class x(object):
pass
y.py:
from x import x
class y(x):
pass
Now from the python command line:
import y
dir(y)
['__builtins__', '__doc__', '__file__', '__name__', '__package__',
'x', 'y']
I do not
On Thu, Oct 21, 2010 at 11:53 AM, Brendan brendandetra...@yahoo.com wrote:
On Oct 21, 3:47 pm, Carl Banks pavlovevide...@gmail.com wrote:
On Oct 21, 11:09 am, Brendan brendandetra...@yahoo.com wrote:
Two modules:
x.py:
class x(object):
pass
y.py:
from x import x
class y(x):
On 10/21/10 1:53 PM, Brendan wrote:
On Oct 21, 3:47 pm, Carl Bankspavlovevide...@gmail.com wrote:
On Oct 21, 11:09 am, Brendanbrendandetra...@yahoo.com wrote:
Two modules:
x.py:
class x(object):
pass
y.py:
from x import x
class y(x):
pass
Now from the python command
On Oct 21, 12:53 pm, Brendan brendandetra...@yahoo.com wrote:
So it must never make sense to put subclasses in separate modules?
It doesn't matter to Python whether the subclass is in the same module
or imported. Do it whichever way makes the most sense to you from a
code organization
On Oct 21, 3:56 pm, Ethan Furman et...@stoneleaf.us wrote:
Jonas H. wrote:
On 10/21/2010 08:09 PM, Brendan wrote:
Two modules:
x.py:
class x(object):
pass
y.py:
from x import x
class y(x):
pass
Now from the python command line:
import y
dir(y)
On Oct 21, 11:53 am, Brendan brendandetra...@yahoo.com wrote:
On Oct 21, 3:47 pm, Carl Banks pavlovevide...@gmail.com wrote:
On Oct 21, 11:09 am, Brendan brendandetra...@yahoo.com wrote:
Two modules:
x.py:
class x(object):
pass
y.py:
from x import x
class y(x):
On 10/21/10 2:12 PM, Brendan wrote:
On Oct 21, 3:56 pm, Ethan Furmanet...@stoneleaf.us wrote:
Jonas H. wrote:
On 10/21/2010 08:09 PM, Brendan wrote:
Two modules:
x.py:
class x(object):
pass
y.py:
from x import x
class y(x):
pass
Now from the python command line:
import y
22 matches
Mail list logo