osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Python3 - How do I import a class from another file


Greg,

> In that case, it was only working by accident.

I don't think so.

Or you must be thinking that the __del__ method of an instance is only 
called by the garbage collector - which would be rather daft (just think of 
a file thats created when initialising an instance, but not closes until the 
garbage collector comes around to it.   Much luck with reopening the file). 
Removing an unused object from memory is a bit different than 
closing/"destroying" an instance.

> Python differs from VBScript and other VB-family languages in that
> names are case-sensitive.

I was aware of that.

> So it's common to use case to distinguish
> between things such as a class and an instance.

For some reason (the lacluster use of interpunction on tha intarwebz, or 
perhaps The Irritating Habit To Capitalise Every Word) I tend to largely 
ignore capitalisation.   Time will tell if I can cope with names that only 
differ by their capitalisation.   Most likely not.  Combine that with 
Pythons create-on-use behaviour and you have a recipe for disaster. :-|

Regards,
Rudy Wieser