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


Groups > comp.lang.python > #107524 > unrolled thread

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

Started byChristopher Reimer <christopher_reimer@icloud.com>
First post2016-04-23 18:30 -0700
Last post2016-04-23 18:30 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

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

FromChristopher Reimer <christopher_reimer@icloud.com>
Date2016-04-23 18:30 -0700
SubjectRe: How much sanity checking is required for function inputs?
Message-ID<mailman.17.1461461419.32212.python-list@python.org>
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.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web