[Tutor] raising exceptions in constructor code?

James Hartley jjhartley at gmail.com
Tue Jul 16 17:29:15 EDT 2019


I ask this having more C++ knowledge than sense.

There is an adage in the halls of everything Stroustrup that one needs to
think about how resource allocation will be unwound if an exception is
thrown.  This gets watered down to the mantra "Don't throw exceptions from
within constructors."  Does this carry over to Python?  I'm trying to
develop a Pythonistic mindset as opposed to carrying over old baggage...

Thanks!

Jim


More information about the Tutor mailing list