Re: missing 'xor' Boolean operator

2009-07-15 Thread Wayne Brehaut
ot a "super xor" (commonly known as XOR). Rather than describing xor as: check if exactly one element of two elements is true describe it as: check if an odd number of two elements is true then you'll get the correct definition of "super xor": chec

Re: missing 'xor' Boolean operator

2009-07-15 Thread Wayne Brehaut
es on the observation that subtracting an integer value from 0x gives the same result as XOR-ing that same value to 0x." And, perhaps the most useful use of all, for Bouton's solution of the game of Nim--both for the proof that his strategy "solves" the game and for an easy implementation of a Nim-playing program--and the only operator needed is XOR (e.g., http://www.wordiq.com/definition/Nim). wayne -- http://mail.python.org/mailman/listinfo/python-list

Re: missing 'xor' Boolean operator

2009-07-15 Thread Wayne Brehaut
On Wed, 15 Jul 2009 11:51:44 -0700 (PDT), Mark Dickinson wrote: >On Jul 15, 7:29 pm, Wayne Brehaut wrote: >> On Tue, 14 Jul 2009 11:47:41 -0700 (PDT), Mark Dickinson >> wrote: >> >I'd also guess that 'xor' would be much less used than 'and' o

Re: missing 'xor' Boolean operator

2009-07-15 Thread Wayne Brehaut
, >>> 'civet']) >>> nasty = set(['doggy-doo', 'polecat', 'limburger', 'Perl']) >>> cheese & stinky # stinky cheese set(['limburger', 'stilton']) >>> cheese ^ stinky # either cheese or stinky but not both set(['doggy-doo', 'civet', 'polecat', 'skunk', 'cheddar']) >>> cheese ^ stinky ^ nasty # in an odd number of these sets (1 or 3) set(['civet', 'cheddar', 'Perl', 'limburger', 'skunk']) wayne -- http://mail.python.org/mailman/listinfo/python-list

Re: missing 'xor' Boolean operator

2009-07-15 Thread Wayne Brehaut
imburger', 'Perl']) >>> cheese & stinky # stinky cheese set(['limburger', 'stilton']) >>> cheese ^ stinky # either cheese or stinky but not both set(['doggy-doo', 'civet', 'polecat', 'skunk', 'cheddar']) >>> cheese ^ stinky ^ nasty # in an odd number of these sets (1 or 3) set(['civet', 'cheddar', 'Perl', 'limburger', 'skunk']) Who hasn't needed that occasionally? wayne -- http://mail.python.org/mailman/listinfo/python-list

Re: analysis of algoritms

2010-09-09 Thread Wayne Brehaut
On Thu, 09 Sep 2010 18:26:52 -0400, Dave Angel wrote: > On 2:59 PM, Baba wrote: >> Hi >> >> In below code "the outer loop test in step 4 will execute ( n + 1 ) >> times (note that an extra step is required to terminate the for loop, >> hence n + 1 and not n executions), which will consume T4( n

Re: Nautilus Python

2010-09-27 Thread Wayne Brehaut
On Mon, 27 Sep 2010 20:57:09 -0700 (PDT), Peter wrote: >On Sep 28, 12:31 pm, Steven D'Aprano t...@cybersource.com.au> wrote: >> On Mon, 27 Sep 2010 15:28:34 -0700, Eduardo Ribeiro wrote: >> > But it doesn't work. >> >> What do you mean "doesn't work"? >> >> - It crashes the operating system; >> -

Re: Introducing Kids to Programming: 2 or 3?

2010-09-28 Thread Wayne Brehaut
On Mon, 27 Sep 2010 12:45:44 -0400, Andreas Waldenburger wrote: >On Mon, 27 Sep 2010 17:48:06 +0200 Marco Gallotta > wrote: > >> Since these are kids, we feel the nice changes in 3 such as removing >> integer division will help in teaching. It will also remove confusion >> when they go to downloa

Re: How to create a (transparent) decorator with status information?

2011-04-18 Thread Wayne Witzel III
> > Thinking object-orientedly, my first idea was to use an object as a > decorator: > > class CallCounter: > def __init__(self, decorated): > self.__function = decorated > self.__numCalls = 0 > > def __call__(self, *args, **kwargs): > self.__numCalls += 1 > return self.__fun

Read tab delimited ascii file

2005-05-11 Thread Irvine, Wayne D
appreciated. Wayne -- http://mail.python.org/mailman/listinfo/python-list

Column data with first value from each row as key?

2005-05-15 Thread Irvine, Wayne D
t.valuelist.append([])     else: # The rest of the data     mydict.valuelist.append(word)     for key, value in mydict.iteritems():     print key, value     if __name__ == '__main__':     readfile() ### End of code ### Cheers, Wayne -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: sqlite3 bug?

2010-02-11 Thread wayne . dads . bell
Thank you It just highlights that when your tired things can easily be missed and maybe you should leave things until the morning to view things with fresh eyes =) -- http://mail.python.org/mailman/listinfo/python-list

Re: Persisting functions typed into the shell

2022-11-12 Thread Wayne Harris via Python-list
On 12/11/2022 10:01, Stefan Ram wrote: > Many readers here know interactive Python sessions with > prompts like ">>>". But a "session" could be something else. > One could imagine that when starting a new session, one > still sees all the variables and constants defined in > preceding s

<    1   2