How much sanity checking is required for function inputs?

Michael Torrie torriem at gmail.com
Sat Apr 23 23:19:56 EDT 2016


On 04/23/2016 08:32 PM, Christopher Reimer wrote:
> That's the other problem I'm running into. Building a chess engine is a 
> big project. This is probably bigger than the Java XML parser I built 
> from scratch for a college project. I can't seem to find any information 
> on how to build bigger programs. Community college taught me how to 
> program, but it didn't teach me how to go beyond class inheritance.

The reason you weren't taught beyond class inheritance is because Java
implements organization only through a class hierarchy. Whole
generations of Java programmers think that program organization is
through classes (a static main method means your code is procedural, by
the way).

Learn about Python namespaces and how to use them.  I guess it just
comes with experience, a lot of trial and a lot of error.  And checking
on how others are doing it.  Take a look at examples from the Python
standard library, as well as other projects.  For example, Beautiful
Soup.  Not that you have to understand their code, but take a look at
how they organize things.

In my mind namespaces matter more than files as an organizational tool.
 Because namespaces are my primary organization, I will put multiple
class definitions in the same file (if they belong in the same
namespace), so they can be imported from the same module. If the classes
and functions get more complicated, I can separate them into their own
submodules and wrap them all up in one Python package (like a module but
more flexible and has submodules).

The nice thing about building with Python is you can start with one
thing, like a module, and convert it to a package later on as needed.





More information about the Python-list mailing list