isinstance() bug

Michs Vitecek fuf at mageo.cz
Wed Jan 28 15:08:00 EST 2004


On Wed, 28 Jan 2004 11:32:19 -0600 Skip Montanaro <skip at pobox.com> wrote:
>You need to compare inode numbers to see if you have the same or different
>files. 
>
>    >>> import stat
>    >>> os.stat(a.__file__)[stat.ST_INO]
>    37041L
>    >>> os.stat(b.__file__)[stat.ST_INO]
>    37041L
>

this could also be used to verify whether the imported module, class etc. 
comes from the same file without messing with the absolute path and 
problems related to it. really a good idea, Skip.
--
	fuf
		fuf at mageo.cz





More information about the Python-list mailing list