New submission from Jennie :
The documentation for subprocess says that run() can return
CalledProcessError...
https://docs.python.org/3/library/subprocess.html#subprocess.run
...but when you click on the link (5th paragraph down) for CalledProcessError,
it only lists check_call
)
...
p = Point()
p.distance(Point(3, 4))
5.0
Is there a better solution?
--
Jennie
--
http://mail.python.org/mailman/listinfo/python-list
On 11/10/2012 09:29 PM, Terry Reedy wrote:
On 11/10/2012 2:33 PM, Jennie wrote:
I propose three solutions. The first one:
class Point:
... def __init__(self, x=0, y=0):
... self.x = x
... self.y = y
... def __sub__(self, other):
... return Point(self.x
']
...
Foo.__dir__()
['python']
dir(Foo)
['__class__', '__delattr__', '__dict__', ...]
Can someone tell me where is the problem? Thanks a lot in advance
--
Jennie
--
http://mail.python.org/mailman/listinfo/python-list
not work (Python 3.3):
class Foo:
... class __metaclass__(type):
... def __dir__(self): return [python]
...
dir(Foo)
['__class__', '__delattr__', '__dict__', '__dir__', ...]
Regards,
--
Jennie
--
http://mail.python.org/mailman/listinfo/python-list
On 10/20/2012 11:43 AM, Peter Otten wrote:
In Python 3 the way to specify the metaclass has changed:
class FooType(type):
... def __dir__(self): return [python]
...
class Foo(metaclass=FooType):
... pass
...
dir(Foo)
['python']
Thanks! :)
--
Jennie
--
http://mail.python.org