suggestions for functional style (singleton pattern?)

yves at zioup.com yves at zioup.com
Sat Feb 28 18:12:54 EST 2015


Hi,

For some scripts, I write in a a more functional way, using a lot of small
functions outside of any class. Although it makes the code clearer for
specific cases, I have found that it makes debugging and using the repl in
general difficult, as as I have to re-initialise every single objects every time.

I have now started to use some kind of state pattern to alleviate this, here's
a simplistic example:

https://github.com/dorfsmay/state_pattern_for_debugging_python/blob/master/dirstats.py

Are there better ways to address this? Any suggestion on this style?

Thanks.

--
http://yves.zioup.com
gpg: 4096R/32B0F416



More information about the Python-list mailing list