Re: [Python-Dev] n.numbits: method or property?

2008-11-12 Thread Antoine Pitrou
Greg Ewing  canterbury.ac.nz> writes:
> 
> Terry Reedy wrote:
> 
> > Math is pretty much float, not int functions.
> 
> Also, it's supposed to be confining itself to
> wrapping the C math library.

Too late, because we now have a math.factorial() function.

As for numbits, I think it should be a method, because while it's very fast for
the current implementation of longs, it could be longer to calculate for a long
implementation using something other than a power-of-2 base.

Having it as a method may also be more consistent with a hypothetical popcount()
method.

Regards

Antoine.


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Python 2.5.3: call for patches

2008-11-12 Thread Matthias Klose
Martin v. Löwis schrieb:
>> I would like to apply fixes for some CVE's which are addressed in 2.5 but not
>> yet in 2.4. this would include
>>
>> CVE-2007-4965
>> CVE-2008-1679
>> CVE-2008-1721
>> CVE-2008-2315
>> CVE-2008-3144
>> CVE-2008-1887
>> CVE-2008-4864
> 
> Can you identify the revisions that would need backporting?
> 
> I could only find (trunk revisions)
>   CVE-2007-4965: r65880
>   CVE-2008-1721: r62235, issue2586
>   CVE-2008-3144: issue2588, issue2589, r63734, r63728.
>   CVE-2008-1887: issue2587, r62261, r62271
>   CVE-2008-4864: r66689
> 
> So what about
> 
>   CVE-2008-1679: claimed to be issue1179 in the CVE, but
>  that says it fixes CVE-2007-4965 only?

the original fix for CVE-2007-4965 did miss two chunks, which are included in
r65878 on the 2.5 branch.

>   CVE-2008-2315

this is r65334 on the 2.5 branch and r65335 on the trunk:
Security patches from Apple:  prevent int overflow when allocating memory
this was already checked in, with an added NEWS item in 2.4.5. Moved this
to 2.4.6.

> In principle, this is fine with me, so go ahead.

Done.
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] n.numbits: method or property?

2008-11-12 Thread Mark Dickinson
On Wed, Nov 12, 2008 at 3:15 PM, Antoine Pitrou <[EMAIL PROTECTED]> wrote:

> As for numbits, I think it should be a method, because while it's very fast 
> for
> the current implementation of longs, it could be longer to calculate for a 
> long
> implementation using something other than a power-of-2 base.

Right:  numbits is only a natural property of a *binary* integer.

On the other hand, I can't realistically see Python ever adopting a
non power-of-two based implementation.

Mark
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] n.numbits: method or property?

2008-11-12 Thread Aahz
On Wed, Nov 12, 2008, Mark Dickinson wrote:
> On Wed, Nov 12, 2008 at 3:15 PM, Antoine Pitrou <[EMAIL PROTECTED]> wrote:
>> 
>> As for numbits, I think it should be a method, because while it's
>> very fast for the current implementation of longs, it could be longer
>> to calculate for a long implementation using something other than a
>> power-of-2 base.
>
> Right: numbits is only a natural property of a *binary* integer.
>
> On the other hand, I can't realistically see Python ever adopting a
> non power-of-two based implementation.

What do you call Decimal?  ;-)
-- 
Aahz ([EMAIL PROTECTED])   <*> http://www.pythoncraft.com/

"It is easier to optimize correct code than to correct optimized code."
--Bill Harlan
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] n.numbits: method or property?

2008-11-12 Thread Antoine Pitrou
Mark Dickinson  gmail.com> writes:
> 
> Right:  numbits is only a natural property of a *binary* integer.
> 
> On the other hand, I can't realistically see Python ever adopting a
> non power-of-two based implementation.

No, but Python is duck-typed and alternate integer classes could adopt such an
implementation while trying to respect the Python-level long API.

cheers

Antoine.


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] n.numbits: method or property?

2008-11-12 Thread Greg Ewing

Terry Reedy wrote:


Math is pretty much float, not int functions.


Also, it's supposed to be confining itself to
wrapping the C math library.

--
Greg

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] n.numbits: method or property?

2008-11-12 Thread Mark Dickinson
[Antoine Pitrou]
> No, but Python is duck-typed and alternate integer classes could adopt such an
> implementation while trying to respect the Python-level long API.

Good point.  That makes me feel a little uneasy about adding numbits
at all.  Though I guess there are other parts of Python's integer API that are
inherently linked to a binary representation, namely, the bit operations and
shifts.  And there'd be no *requirement* for alternative integer types to
implement numbits (it wouldn't be part of the Integral ABC, for example).

[Aahz]
> What do you call Decimal?  ;-)

Um.  A stdlib module?  I guess I should have said that I can't see Python
adopting a nonbinary implementation for the 'int/long' types.

It *is* fun to dream about, though: there are some definite advantages
to an internal decimal representation---notably, faster str <-> int
conversion.  And it turns out that overall performance doesn't suffer:
I've coded up a Python extension module that implements decimal
integers (stored internally in base 10**9) whose performance handily
beats that of the current binary int/long.

Mark
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] n.numbits: method or property?

2008-11-12 Thread Greg Ewing

Antoine Pitrou wrote:


As for numbits, I think it should be a method


It feels more method-like to me too, because it's something
derived from the int's value rather than an independent
piece of information.

--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] n.numbits: method or property?

2008-11-12 Thread Greg Ewing

Aahz wrote:


What do you call Decimal?  ;-)


If you're working with decimal numbers, you're more
likely to want a numdigits() method.

--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Python 2.5.3: call for patches

2008-11-12 Thread Martin v. Löwis
>> In principle, this is fine with me, so go ahead.
> 
> Done.

Thanks for looking into these!

Martin
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] How does one build Python25.chm on Windows?

2008-11-12 Thread Dave Peterson
I'm trying to build a Python25.chm file using the source in the Python 
2.5.2 tarball.  

I'm not really a Windows guru so I'm at a loss of even where to begin as 
the Doc\README file doesn't mention how to build .chm files at all.   
I've done a number of web searches with things like "how to build 
python25.chm" but am not finding any useful hits.   (Most hits tell 
people how to use the Python25.chm for various purposes but none on 
actually building it that I've seen.)



Any pointers would be appreciated!


-- Dave

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] How does one build Python25.chm on Windows?

2008-11-12 Thread Martin v. Löwis
> I'm not really a Windows guru so I'm at a loss of even where to begin as
> the Doc\README file doesn't mention how to build .chm files at all.  

You need to build the html files, then run prechm.py, then invoke the
HTML Help Workshop.

HTH,
Martin
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com