Re: Python 3 and PEP238 division

2008-03-18 Thread Ninereeds
On Mar 17, 7:26 pm, Terry Reedy [EMAIL PROTECTED] wrote: Ninereeds [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | Is the PEP238 change to division going into Python 3 as planned? IDLE 3.0a3 1/2 0.5 | I realise that the new integer division semantics have been available

Re: finding items that occur more than once in a list

2008-03-18 Thread Ninereeds
Just to throw in one more alternative, if you sort your list, you only need to test adjacent items for equality rather than needing a search for each unique item found. You should get O(n log n) rather than O(n^2), since the performance bottleneck is now the sorting rather than the searching for

Re: finding items that occur more than once in a list

2008-03-18 Thread Ninereeds
Hrvoje Niksic wrote: This doesn't apply to Python, which implements dict storage as an open-addressed table and automatically (and exponentially) grows the table when the number of entries approaches 2/3 of the table size. Assuming a good hash function, filling the dict should yield

Re: lists v. tuples

2008-03-17 Thread Ninereeds
On Mar 17, 11:49 am, [EMAIL PROTECTED] wrote: What are the considerations in choosing between: return [a, b, c] and return (a, b, c) # or return a, b, c Why is the immutable form the default? My understanding is that the immutable form is not the default - neither form is a

Re: lists v. tuples

2008-03-17 Thread Ninereeds
On Mar 17, 12:28 pm, [EMAIL PROTECTED] wrote: Why is the immutable form the default? Using a house definition from some weeks ago, a tuple is a data structure such which cannot contain a refrence to itself. Can a single expression refer to itself ever? Can't imagine why that feature was

Python 3 and PEP238 division

2008-03-17 Thread Ninereeds
Is the PEP238 change to division going into Python 3 as planned? I realise that the new integer division semantics have been available in from __future__ for quite a few years now, but a warning might be appropriate now that Python 3 is in alpha. A lot of people have probably either forgotten, or

Re: lists v. tuples

2008-03-17 Thread Ninereeds
On Mar 17, 1:31 pm, Duncan Booth [EMAIL PROTECTED] wrote: A common explanation for this is that lists are for homogenous collections, tuples are for when you have heterogenous collections i.e. related but different things. I interpret this as meaning that in a data table, I should have a list

Re: Compile python with Mingw

2007-07-27 Thread Ninereeds
Steve Holden wrote: You are wrong about the compatibility. You can't compile a library with VC 2005 and run it with a Python compiled with VC 2003. OK, my bad - sorry about that red herring. -- http://mail.python.org/mailman/listinfo/python-list

Re: Compile python with Mingw

2007-07-27 Thread Ninereeds
[EMAIL PROTECTED] wrote: I don't have VS2003, so I think I may compile both pymol and python with mingw. Sorry I can't help with mingw, but Microsoft has released a free version of VC2005, which should be binary compatible with VC2003, I'd have thought. Of course that means going through the

Re: *Naming Conventions*

2007-06-05 Thread Ninereeds
Google Groups appears to have thrown away my original reply, so sorry if this appears twice... On Jun 4, 9:51 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: 'i' and 'j' are the canonical names for for loops indices in languages that don't support proper iteration over a sequence. Using them

Re: *Naming Conventions*

2007-06-03 Thread Ninereeds
On Jun 4, 5:03 am, Thorsten Kampe [EMAIL PROTECTED] wrote: for validanswer in validanswers: if myAnswers.myanswer in myAnswers.validAnswers[validanswer]: MyOptions['style'] = validanswer First, for small loops with loop variables whose meaning is obvious from context, the most