Re: [Python-Dev] Python 2.6.4rc2

2009-10-19 Thread Vinay Sajip
Barry Warsaw  python.org> writes:

> http://www.python.org/download/releases/2.6.4/

Good news, but just one little nit: the page above appears to link to the NEWS
file for 2.6.4rc1.

Regards,

Vinay Sajip

___
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] SIGCHECK() in longobject.c

2009-10-19 Thread Mark Dickinson
On Sun, Oct 18, 2009 at 11:46 PM, Antoine Pitrou  wrote:
> Sure, but it's no different than doing, e.g.:
>    list(range(1)).sort()
>
> (don't try this, it just made by computer slow down to a crawl and I had to 
> kill
> -9 the Python interpreter)

Maybe you were running out of RAM?  On a 64-bit machine,
list(range(10**8)) takes over 3 Gb.

For me, x = list(range(10**8)) takes around 6 seconds, and then
x.sort() takes around 2 seconds.  This is on a machine with
16 Gb of RAM.  (Though I do seem to recall that timsort is
extra fast for already sorted lists: O(n) rather than O(n log n)?)

So I'd say that it *is* different.  A million digit integer takes less
than half a megabyte of RAM, so a single operation can be
horribly slow long before memory limitations are reached.

I'd prefer to keep the SIGCHECK unless there's a really
compelling advantage to getting rid of it.

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] Python 2.6.4rc2

2009-10-19 Thread Barry Warsaw

On Oct 19, 2009, at 3:59 AM, Vinay Sajip wrote:


Barry Warsaw  python.org> writes:


http://www.python.org/download/releases/2.6.4/


Good news, but just one little nit: the page above appears to link  
to the NEWS

file for 2.6.4rc1.


Ooops!  Fixed, thanks.
-Barry



PGP.sig
Description: This is a digitally signed message part
___
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] SIGCHECK() in longobject.c

2009-10-19 Thread Mark Dickinson
On Sun, Oct 18, 2009 at 9:01 PM, Antoine Pitrou  wrote:

> Can we remove this check, or are there people doing million-digits 
> calculations
> they want to interrupt using Control-C ?

By the way, here's an example of an *almost* real-life use of million digit
calculations.

For an elementary number theory course that I taught a while ago, there
was an associated (optional) computer lab, where the students used
Python to investigate various ideas, conjectures, examples, etc.  One
of the less open-ended questions might have been[1] something like:

"On August 23rd, 2008 a computer at UCLA found the first example
of a prime with more than 10 million digits: p = 2**43112609-1.  Find

(1) the exact number of digits in p, when written out in decimal
(2) the last 100 digits of p
(3) the first 100 digits of p."

It's wonderfully easy to get answers to these questions with Python:

>>> import math
>>> e = 43112609
>>> p = 2**e - 1
>>> ndigits = int(math.ceil(math.log10(p)))
>>> last_100_digits = '{:0100d}'.format(p % 10**100)
>>> first_100_digits = str(p // 10**(ndigits-100))

Getting the first 100 digits takes a good few seconds;  the
other operations are faster.

But if you (not unreasonably) try to compute str(p),
you'll find it's impossibly slow, and it's very handy
that it's possible to interrupt that calculation, attempt
to understand *why* it's slow, and then try different
methods.

(And yes, there are better ways to get both the first
and last hundred digits.)

Mark


[1] Might have been, but wasn't.  Hence the *almost*.  If I'd been
teaching that course this semester I'd almost certainly have included
something like this.
___
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] Proposal : Python Trusted Computing API

2009-10-19 Thread Guido van Rossum
On Sun, Oct 18, 2009 at 11:29 PM, Abhiram Kasina
 wrote:
> Trusted Computing (TC) is a technology developed and promoted by the Trusted
> Computing Group (TCG)[3]. So, basically the group came up with these chips
> called TPM chips which are present on most motherboards nowadays. The main
> purpose of it is to enhance security so that infected executables don't run.
> It also provides memory curtaining such that cryptographic keys won't be
> accessible and many other features. There was a criticism on this from the
> FOSS community as well that it enables DRM. No wonder, it is being pushed by
> Intel, Microsoft, AMD, etc.. But personally I think its a good idea from
> security point of view.

Hm... Given that most infections these days are JavaScript based and
run in the browser, how does this provide any protection? I'm
presuming you're going to say that it doesn't but that there are other
use cases where it *does* provide protection; but most likely those
use cases are only relevant for Windows (since that's what most
attackers attack anyway).

> So, currently there is an TSS (TCG Software Stack)[1] API written in C. And
> TrustedJava[2] is a project which ported it to Java and is going to be
> included in the standard API of Java soon. They have 2 versions of it. One
> is a simple wrapper on top of the API and the other is a whole
> implementation of the stack in Java.

Since this intefaces with the hardware, doesn't it require some kind
of cooperation from the Linux kernel? And wouldn't it be better if
Python was never allowed access to any of the protected resources in
the first place?

> My proposal is we create an API for it in python.
> Reason: I am a developer in Umit

Where/what is Umit? (Google gives several meanings but it's unclear
which you might mean.)

> and I think Python is a very good platform
> for developing applications. So, why not create an API which helps in
> developing secure applications?

You'd first have to tell us more about the security model. What is a
"secure application" and what does it protect against? And how?

> I would love to learn more and provide you with any more information. Please
> let me know what you guys think of it?

This is better directed at python-ideas, so I've redirected this reply
there and Bcc'ed the python-dev list.

> Thanks in advance
>
> Cheers
> Abhiram
>
> [1]
> http://www.trustedcomputinggroup.org/resources/tcg_software_stack_tss_specification
> [2] http://trustedjava.sourceforge.net/index.php?item=jtss/about
> [3] http://www.trustedcomputinggroup.org/
>
> ___
> 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/guido%40python.org
>
>



-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
___
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] Proposal : Python Trusted Computing API

2009-10-19 Thread Nick Coghlan
Abhiram Kasina wrote:
> I would love to learn more and provide you with any more information.
> Please let me know what you guys think of it?

This is really an off-topic question for python-dev. This list is just
about developing the core interpreter and standard library - we have no
control over the APIs that people choose to develop and publish on top
of that.

If you want to develop such an API and put it up on PyPI, then go right
ahead. comp.lang.python (aka python-list) would be the place to ask for
interest from other developers.

Regards,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
---
___
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] Add const to python API - issue 6952

2009-10-19 Thread Barry Scott

http://bugs.python.org/issue6952

Martin v. Löwis suggested that solutions to this issue should be  
discussed here.


My goal is to avoid compiler warning and the need to cast to remove  
const when

calling the python API.

For example I see compiler messages like this on Mac OS X Snow Leopard  
g++ reports:


example.cxx:633: warning: deprecated conversion from string constant  
to ‘char*’


The patch I developed for comment only adds const to the input  
parameters and used casts to

allow output parameters to stay without the const.

This is because adding the const to the input params will not break  
existing code, but
adding const to output parameters may well require code changes for  
users of the Python

API.

What is the best approach to this problem that will be acceptable?

Barry

___
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] SIGCHECK() in longobject.c

2009-10-19 Thread Tim Peters
[Mark Dickinson]
> By the way, here's an example of an *almost* real-life use of million digit
> calculations.
>
> For an elementary number theory course that I taught a while ago, there
> was an associated (optional) computer lab, where the students used
> Python to investigate various ideas, conjectures, examples, etc.  One
> of the less open-ended questions might have been[1] something like:
>
> "On August 23rd, 2008 a computer at UCLA found the first example
> of a prime with more than 10 million digits: p = 2**43112609-1.  Find
>
> (1) the exact number of digits in p, when written out in decimal
> (2) the last 100 digits of p
> (3) the first 100 digits of p."
>
> It's wonderfully easy to get answers to these questions with Python:
...
> But if you (not unreasonably) try to compute str(p),
> you'll find it's impossibly slow, and it's very handy
> that it's possible to interrupt that calculation, attempt
> to understand *why* it's slow, and then try different
> methods.

Don't want to hijack this thread, but this is the kind of use case
justifying keeping the 3-argument pow in the decimal module.  People
"playing" with number theory questions can learn a bag of tricks to
worm around that non-decimal arithmetic can make it inconvenient &
slow to get answers about decimal digits, but most people -- and
especially beginners -- find life easier when doing calculations in
decimal to begin with.  Then they can use obvious methods, and not get
sidetracked by wondering why they take forever to finish.

Although, to be fair, I started

>>> decimal.getcontext().prec = 2000
>>> p10 = pow(decimal.Decimal(2), 43112609)

before I started typing this, and am still waiting for it to finish ;-)

OTOH,

>>> decimal.getcontext().prec = 200
>>> pow(decimal.Decimal(2), 43112609)   # get the first 100 digits (& then some)

and

>>> pow(decimal.Decimal(2), 43112609, 10**100) - 1  # get the last 100 digits

both appear to work instantaneously.
___
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.6.4rc2

2009-10-19 Thread Lisandro Dalcin
I'm getting this warning. It seems nothing is actually broken, but the
fix is pretty easy.

gcc -pthread -c -fno-strict-aliasing -g -Wall -Wstrict-prototypes  -I.
-IInclude -I./Include   -DPy_BUILD_CORE -o Objects/unicodeobject.o
Objects/unicodeobject.c
Objects/unicodeobject.c: In function 'PyUnicodeUCS2_FromFormatV':
Objects/unicodeobject.c:687: warning: pointer targets in passing
argument 1 of 'strlen' differ in signedness
/usr/include/string.h:397: note: expected 'const char *' but argument
is of type 'unsigned char *'
Objects/unicodeobject.c:687: warning: pointer targets in passing
argument 1 of 'PyUnicodeUCS2_DecodeUTF8' differ in signedness
Include/unicodeobject.h:752: note: expected 'const char *' but
argument is of type 'unsigned char *'

BTW, should Python build with a C++ compiler? It seems this is not
possible with 2.6.4rc2 (and GCC 4.4.1)



On Mon, Oct 19, 2009 at 8:55 AM, Barry Warsaw  wrote:
> On Oct 19, 2009, at 3:59 AM, Vinay Sajip wrote:
>
>> Barry Warsaw  python.org> writes:
>>
>>> http://www.python.org/download/releases/2.6.4/
>>
>> Good news, but just one little nit: the page above appears to link to the
>> NEWS
>> file for 2.6.4rc1.
>
> Ooops!  Fixed, thanks.
> -Barry
>
>
> ___
> 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/dalcinl%40gmail.com
>
>



-- 
Lisandro Dalcín
---
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
___
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] Add const to python API - issue 6952

2009-10-19 Thread Martin v. Löwis
> The patch I developed for comment only adds const to the input
> parameters and used casts to
> allow output parameters to stay without the const.

What specific APIs are you talking about here?

Regards,
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