← Back to team overview

kicad-developers team mailing list archive

Re: Python binding of enums

 

On Fri, Aug 10, 2012 at 07:33:24AM +0200, Miguel Angel Ajo Pelayo wrote:
> I keep reading and thinking.
> 
> And one idea comes to my mind:
> 
> Why don't we do those checks on the python side, but, with one
> restriction (to cut out the maintenance drawback): have the MAX_VALUE
> / MIN_VALUE for every enum in C++, example:

I see no problem with that, many of them already behave this way...
Often there is the -1 as unspecified/invalid marker. Other enums
starts at 0 (since it's the default behaviour for enums and there is no
reason to choose otherwise).

For example: UNDEFINED_LAYER = -1, LAYER_COUNT = 32
for color we have UNSPECIFIED = -1 and LAST_COLOR (last time I looked
was 24...)

Bitmasked enum are not a problem (since these are inherently used at the
bit level), other critical stuff will be handled in a case-by-case
fashion (I didn't see much funky stuff in there)

This would be plan 3b (facade but only for strange stuff XD)

-- 
Lorenzo Marcantonio
Logos Srl


Follow ups

References