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

Python3 - How do I import a class from another file


> Not really.  The resulting global objects do not normally take enough 
> space to worry about on normal modern desktops.

For some reason I still aim to keep my (running) programs as small as 
possible - even though the ammount of memory has grown more than a 
thousandfold since I started programming.  Old habits die hard.

> Standard for in-file test is

Any reason to put the testcode in a procedure instead of just have it 
directly follow the "if __name__ == '__main__' " test ?

> The PEP 8 convention (except for basic builtin data structures like int, 
> str, list, tuple, set, and dict) is TitleCase.


> Follow or not as you wish.

:-) If I ever want/need to share my code with others (or post here as part 
of a question) it is a good idea to conform to certain standards to keep it 
easily readable.  It will take some getting acustomed to though, as every 
language seems to have its own way to do it  (I myself prefer single prefix 
chars to indicate the variables intended type).

Rudy Wieser