Re: [Python-ideas] __first__ method

2019-02-14 Thread Stephane Wirtel
-1 for the idea, sorry -- Stéphane Wirtel - https://wirtel.be - @matrixise ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] __first__ method

2019-02-14 Thread Christopher Barker
I forstthpughthgegoal here was to avoid imports that may not be needed if the class isn’t actually used. If that’s the case, then it’s better to simply put classes with heavyweight imports in their own module. And: class Bar(object): > def __first__(): > import math > def

Re: [Python-ideas] __first__ method

2019-02-14 Thread Greg Ewing
The Big Cheese wrote: however at the start of this module it imports os and glob and it also runs some setup for how it reads the sensors and has such I have to just do 'import temperature' and then every time I create a sensor I have to call temperature.Sensor which isn't as nice. I think

[Python-ideas] __first__ method

2019-02-14 Thread The Big Cheese
I have an idea for a new special method in a class called __first__(). The main purpose of it would be to setup somethings a class needs to run before it is first initiated, probably only really in modules because in your code you could simply put this setup stuff before the class however if you