How much sanity checking is required for function inputs?

Ethan Furman ethan at stoneleaf.us
Thu Apr 21 22:10:47 EDT 2016


On 04/21/2016 06:34 PM, Christopher Reimer wrote:

> class PieceFactory(object):
 > [...]

Better.

> I do plan to incorporate a sanity test in each Piece class to validate
> the initial position value. Pawns have 16 specific positions. Bishop,
> Knight and Rook each have four specific positions. King and Queen each
> have two specific positions. An invalid value will raise an exception.

This will make it so you cannot use your PieceFactory for custom setups.

--
~Ethan~




More information about the Python-list mailing list