Help with two issues, buttons and second class object

Larry Hudson orgnut at yahoo.com
Thu Nov 24 15:37:11 EST 2016


On 11/24/2016 06:53 AM, Peter Otten wrote:
> Thomas Grops via Python-list wrote:
[snip...]
> Instead of repeating your code with copy-and-past make a helper function
> like the randx() posted by Larry Hudson.
>
> By the way, randint(min, max) may return max so there are 9 possible
> outcomes while you handle only 8. To be consistent with Python's half-open
> ranges use
>
> random.randrange(8) # may return 0, 1, 2, 3, 4, 5, 6, 7, but not 8
>

About my (Larry Hudson) randx() example code:

I used randint() in it because that was what the OP was using.  I didn't want to bother with the 
side issue of randint() vs randrange() since it was just meant as example code to be adapted. 
If I had written it for my own use I would have used randrange() for the consistency that you 
are describing.

Not an excuse — just a comment.   ;-)

-- 
      -=- Larry -=-



More information about the Python-list mailing list