Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #107527
| From | Christopher Reimer <christopher_reimer@icloud.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: How much sanity checking is required for function inputs? |
| Date | 2016-04-23 18:45 -0700 |
| Message-ID | <mailman.20.1461462339.32212.python-list@python.org> (permalink) |
| References | (6 earlier) <1461291613.433097.586174185.01BB7E37@webmail.messagingengine.com> <57199BA5.4000703@icloud.com> <1461302724.477236.586265777.181ACCA0@webmail.messagingengine.com> <CAGgTfkNz5aeS5Jo+3yc+nWjUKnfhe=0zBVNeNHUMHD6Uj9VyEA@mail.gmail.com> <571C2541.9050309@icloud.com> |
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.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: How much sanity checking is required for function inputs? Christopher Reimer <christopher_reimer@icloud.com> - 2016-04-23 18:45 -0700
csiph-web