Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #107524

Re: How much sanity checking is required for function inputs?

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:30 -0700
Message-ID <mailman.17.1461461419.32212.python-list@python.org> (permalink)
References (5 earlier) <57197FC3.4030701@icloud.com> <1461291613.433097.586174185.01BB7E37@webmail.messagingengine.com> <57199BA5.4000703@icloud.com> <1461302724.477236.586265777.181ACCA0@webmail.messagingengine.com> <571C21A3.5090507@icloud.com>

Show all headers | View raw


On 4/21/2016 10:25 PM, Stephen Hansen wrote:
>
> Why not, 'color in ("black", "white")'?

Checkers seems popular around here. What if I want to change "white" to 
"red," as red and black is a common color scheme for checkers. Do I 
change a single constant variable or replace all the occurrences in the 
files?

Some of these constants are shortcuts. Instead of writing slice(0, 16) 
or slice(48, 64), and getting the two confused, I write 
const['board_bottom'] or const['board_top'], respectively, when I want 
to pull the correct set of positions from coordinates list.

> That said, if you're wanting to share constants across different parts
> of your code, use a module.

I did that at first, made it into a dictionary class and added 
ConfigParser to the mix. I had a lot of fun putting that one together. 
However, as I refactor my code further as I learn new things, it will 
probably get changed or removed. Being a research project, I'm willing 
to dive into every rabbit hole that I come across to learn Python properly.

Thank you,

Chris R.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: How much sanity checking is required for function inputs? Christopher Reimer <christopher_reimer@icloud.com> - 2016-04-23 18:30 -0700

csiph-web