2017-02-15 10:36 GMT+01:00 Makoto Kuwata <k...@kuwata-lab.com>: > Thanks Irmen and Steven, > > I'm sorry that my explanation is not enough. > I'm looking for bad python code, not refactoring examples. > I can do (and want to do) refactor bad code by myself. > > Is there any bad python code (or project) with proper size? > > # I found a lot of bad PHP code in github, but didn't find bad Python code. > > -- > regards, > makoto kuwata > > > On Wed, Feb 15, 2017 at 3:28 PM, Steven D'Aprano <st...@pearwood.info> > wrote: > >> On Wed, 15 Feb 2017 07:44:03 +0900, Makoto Kuwata wrote: >> >> > Hi, >> > >> > Is there any *just right* python code to refactor? >> > In other words, I'm finding bad code example in python. >> >> >> Try looking at the ActiveState website for recipes in Python. Especially >> look at the ones with negative ratings, but even positively rated recipes >> are often nonsense. >> >> E.g. http://code.activestate.com/recipes/580750 >> >> does nothing more that define >> >> echo = sys.stdout.write >> >> Why not use sys.stdout.write directly? Or print? If I saw somebody using >> this recipe in production code, in the way shown, I'd refactor it to just >> use print. There's no advantage to re-inventing the wheel this way. >> >> >> >> -- >> Steve >> -- >> https://mail.python.org/mailman/listinfo/python-list >> > -- > https://mail.python.org/mailman/listinfo/python-list
Hello, IMHO most code can be refactored. Forme the point is how you want to teach it and what you want to teach exactly. For instance, if you are following a tdd approach, then the project you choose, should better come with that in mind. If you are not considering tests, for whatever reason, I guess any simple enough project would be good. Of course, it depends on the details of what you want to teach. BTW, at work I have been told to organize a course about testing and good programming practices with Python. I was thinking in developing an example by myself... Best David -- https://mail.python.org/mailman/listinfo/python-list