[Q] Type checking...
Fredrik Lundh
fredrik at pythonware.com
Mon Jul 19 08:03:03 EDT 1999
More information about the Python-list mailing list
Mon Jul 19 08:03:03 EDT 1999
- Previous message (by thread): [Q] Type checking...
- Next message (by thread): [Q] Type checking...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Olivier Deckmyn <olivier.deckmyn at mail.dotcom.fr> wrote: > Abstract : [Q]How to check the type of an instance before(after?) sending it > to a method... > > Here is my source : > > class ClassA > ... > > > class ClassB : > def myMethod(self, anInstance) > ... > > and myMethod expects that anInstance is a ClassA ! > How can I force my user to send only instances of this > class (or subclasses)? assert isinstance(anInstance, ClassA) </F>
- Previous message (by thread): [Q] Type checking...
- Next message (by thread): [Q] Type checking...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list