I am a C++ developer with only a little experience using Python. I
want to create a Python class where by I can construct an instance from
that class based on one of two different object types.
For example, if I were programming in C++, I would do the something
like the following:
class MyClass
[EMAIL PROTECTED] wrote:
I am a C++ developer with only a little experience using Python. I
want to create a Python class where by I can construct an instance from
that class based on one of two different object types.
For example, if I were programming in C++, I would do the something
On Sunday 08 May 2005 03:05 pm, [EMAIL PROTECTED] wrote:
I am a C++ developer with only a little experience using Python. I
want to create a Python class where by I can construct an instance from
that class based on one of two different object types.
For example, if I were programming in
On Sunday 08 May 2005 03:28 pm, James Stroud wrote:
try:
self.avalue = isinstance.get_avalue()
except NameError:
self.avalue = isinstance.get_anothervalue()
I have no idea where I copied those isinstances from. Also, the except
should be an AttributeError. Here is a retry:
[EMAIL PROTECTED] wrote:
I am a C++ developer with only a little experience using Python. I
want to create a Python class where by I can construct an instance from
that class based on one of two different object types.
The approaches I've seen used are to use a new class method as an
James Stroud wrote:
If you know what type of object object is
(BTW, a keyword in 2.3 and later, I believe)
Not a keyword, but a builtin as of 2.2.
STeVe
--
http://mail.python.org/mailman/listinfo/python-list