How much sanity checking is required for function inputs?
Christopher Reimer
christopher_reimer at icloud.com
Sat Apr 23 21:45:37 EDT 2016
On 4/22/2016 1:40 PM, Michael Selik wrote:
> Frankly, for someone coming from Java, the best advice is to not write any
> classes until you must. Of course classes in Python are very useful. It's
> just that your Java habits are unnecessary and often counter-productive.
I disagree. I wrote procedural scripts and translated old BASIC games
into Python for two years. One day I came across a Python book that
described the principles of subclassing from a base class for chess
pieces, but there was no code to demonstrate the process. I had no
problem creating the Python classes. That's how my research project got
started to build a chess engine. If you ever check the academic
literature for chess programming, this research project could turn into
a lifelong endeavor.
I had to confront all the bad habits I brought over Java and change my
code to be more Pythonic. This is where I started having fun, learning
the tricks and collapsing multi-line code into a single line code. I've
learned more about Python in the few weeks than I had in two years of
writing procedural scripts and translating BASIC goto hell.
Thank you,
Chris R.
More information about the Python-list
mailing list