Daniel Nogradi a écrit :
>> Can an instance of a class in a module, in any simple way find out which
>> other classes that exists in said module ?
>
>
> # module x ##
> class c1:
>pass
>
> class c2:
>pass
> ###
>
>
> Python 2.5 (r25:51908, Nov 1 2006, 1
> Can an instance of a class in a module, in any simple way find out which
> other classes that exists in said module ?
# module x ##
class c1:
pass
class c2:
pass
###
Python 2.5 (r25:51908, Nov 1 2006, 11:42:37)
[GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3
Roland Hedberg wrote:
> Can an instance of a class in a module, in any simple way find out which
> other classes that exists in said module ?
set(v for v in globals().values() if inspect.isclass(v) and v.__module__ ==
__name__)
Peter
--
http://mail.python.org/mailman/listinfo/python-list
Hi!
Can an instance of a class in a module, in any simple way find out which
other classes that exists in said module ?
-- Roland
--
http://mail.python.org/mailman/listinfo/python-list