Re: [Python-Dev] ctypes and win64

2006-08-20 Thread Thomas Wouters
On 8/19/06, Jack Diederich [EMAIL PROTECTED] wrote:
It has always just worked for me on Opterons + Debian.Python 2.4 (#1, May 31 2005, 10:19:45)[GCC 3.3.5 (Debian 1:3.3.5-12)] on linux2Type help, copyright, credits or license for more information.
 import sys sys.maxint9223372036854775807While that's certainly useful behaviour, it isn't exactly the same thing as the 64-bit support in Python 2.5. 64-bit longs have always worked (as Tim said, CPython is good C), but large parts of CPython were using ints instead of longs -- and I'm fairly certain there are still quite a few bugs with container types and more than 31-bits worth of elements. (I say that because I found more than I hoped for, writing the bigmem tests a few months back. And those tests only consider bytestrings, lists and tuples.) So, while 
sys.maxint doesn't change, and any container with sane amounts of elements will almost certainly work (one would hope that's tested enough by now), real-world code that actually uses, say, more than 100Gb worth of memory in a single container may still break. Unless we write more bigmem tests :
Luxury-problem-anyone?'ly y'rs,-- Thomas Wouters [EMAIL PROTECTED]Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
___
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] ctypes and win64

2006-08-20 Thread Fredrik Lundh
Martin v. Löwis wrote:

 It isn't. Python ran on 64-bit Alpha for nearly a decade now (I guess)

make that over a decade.  the first Python system I built was on 
tru64, back in 1995 (portions of the the initial prototype was written 
on a 286 box under MS-DOS, but the bulk was developed on tru64 and 
deployed on tru64...)

/F

___
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] String formatting / unicode 2.5 bug?

2006-08-20 Thread John J Lee
On Sun, 20 Aug 2006, Nick Coghlan wrote:

 John J Lee wrote:
  Is this a bug?

 I don't believe so - the string formatting documentation states that the 
 result will be unicode if either the format string is unicode or any of the 
 objects passed to a %s format code is unicode.

 That latter part has just been extended to include any object that returns 
 Unicode from __str__, instead of being restricted to actual Unicode 
 instances.

 Note that the following behaves the same way regardless of whether you use 
 2.4 or 2.5:
 %s % 'hi'
 %s % u'hi'

Given that, the following wording should be changed:

http://docs.python.org/lib/typesseq-strings.html

Conversion  Meaning   Notes
...
s   String (converts any python object using str()).  (4)
...
(4) If the object or format provided is a unicode string, the resulting 
string will also be unicode.


The note (4) says that the result will be unicode, but it doesn't say how, 
in this case, that comes about.  This case is confusing because the docs 
claim string formatting with %s converts ... using str(), and yet 
str(a()) returns a bytestring.  Does it *really* use str, or just __str__? 
Surely the latter? (given the observed behaviour, and not reading the C 
source)


FWIW, this change broke epydoc (fails with an AssertionError -- so perhaps 
without the assert it would still work, dunno).


 And once the result has been promoted to unicode, __unicode__ is used 
 directly:

print repr(%s%s % (a(), a()))
 __str__
 accessing __main__.a object at 0x00AF66F0.__unicode__
 __str__
 accessing __main__.a object at 0x00AF6390.__unicode__
 __str__
 u'hihi'

I don't understand this part.  Why is __unicode__ called?  Your example 
doesn't appear to show this happening once [i.e., because?] the result 
has been promoted to unicode -- if that were true, it would stand to 
reason wink that the interpreter would then conclude it should call
__unicode__ for all remaining %s, and not bother with __str__.  If OTOH 
__unicode__ is called because __str__ returned a unicode object, it makes
(very slightly) more sense that it goes through the same 
__str__-then-__unicode__ rigmarole for each object on the RHS of the %.

But none of that seems to make a huge amount of sense.  I've now found the 
September 2004 discussion of this, and I'm none the wiser.


John

___
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] What should the focus for 2.6 be?

2006-08-20 Thread Guido van Rossum
I've been thinking a bit about a focus for the 2.6 release.

We are now officially starting parallel development of 2.6 and 3.0. I
really don't expect that we'll be able to merge the easily into the
3.0 branch much longer, so effectively 3.0 will be a fork of 2.5.

I wonder if it would make sense to focus in 2.6 on making porting of
2.6 code to 3.0 easier, rather than trying to introduce new features
in 2.6. We've done releases without new language features before;
notable 2.3 didn't add anything new (except making a few __future__
imports redundant) and concentrated on bugfixes, performance, and
library additions.

Some projects that could be undertaken in 2.6:

- add warnings when apply() is used
- add warnings when string exceptions or non-BaseException-derived
exceptions are used (this is already planned in PEP 252, which has a
very specific roll-out plan)
- add warnings when has_key() is used
- add warnings when the result of dict.keys(), .values(), .items() is
used for anything else than iterating over it
- a warning if a class defines has_key() but not __contains__().
- add __contains__ to dbm and gdbm
- add warnings to modules and built-ins that will die in 3.0

Some of these warnings should be suppressed by default, but enabled by
a command line option. We should also do the work on the standard
library to avoid the warnings: get rid of apply(), use 'x in d'
instead of 'd.has_key(x)', etc. I've recently done some of this work
in the 3.0 branch (e.g. dbm/gdbm are fresh in my memory).

Another area that could use a lot of work (and from which 3.0 could
also benefit directly) is converting all unit tests to using either
unittest.py or doctest.py. There are still at least 40 tests written
in the old compare the output with one we prepared earlier style.

Of course, if people are chomping at the bit to implement certain new
features (and those features are generally approved of) then I don't
want to stop them; but I would recommend that our effort may better be
focused on smoothing the 2.6/3.0 transition rather than looking for
new features to add to 2.6.

I am often approached by people who object against this or that
feature proposal not because they dislike the proposed feature in
particular, but because they believe Python is already large enough,
and they worry that if we keep adding features at the current pace, it
will soon become too unwieldy, and hence harder to learn or to keep in
one's brain. I am very sympathetic to this concern (and you should be
too!). This is one of the reasons that so much of the Python 3000 work
is about ripping out old stuff and simplifying / unifiying things.
Dropping two common data types (long and unicode -- of course they
will really be merged into their simpler counterparts int and str, but
it means much less to learn/remember) is one example. Ripping out
classic classes and string exceptions another. Removing dead library
modules a third.

-- 
--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] ctypes and win64

2006-08-20 Thread Ganesan Rajagopal
 Fredrik Lundh [EMAIL PROTECTED] writes:

 Martin v. Löwis wrote:
 It isn't. Python ran on 64-bit Alpha for nearly a decade now (I guess)

 make that over a decade.  the first Python system I built was on 
 tru64, back in 1995 (portions of the the initial prototype was written 
 on a 286 box under MS-DOS, but the bulk was developed on tru64 and 
 deployed on tru64...)

Well, there's 64-bit support and then there's 64-bit support. While all Unix
or Unix like OSs follow LP64 model, I believe Win64 follows a P64 model. So
it's a whole new ball game.

Ganesan

-- 
Ganesan Rajagopal

___
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] String formatting / unicode 2.5 bug?

2006-08-20 Thread Neil Schemenauer
John J Lee [EMAIL PROTECTED] wrote:
 The note (4) says that the result will be unicode, but it doesn't say how, 
 in this case, that comes about.  This case is confusing because the docs 
 claim string formatting with %s converts ... using str(), and yet 
 str(a()) returns a bytestring.  Does it *really* use str, or just __str__? 
 Surely the latter? (given the observed behaviour, and not reading the C 
 source)

It uses __str__ and confirms that the returned object is a 'str' or
'unicode'.  The docs are not precise but they were not for 2.4
either.  Note the following case:

'%s' % u'Hello!'

The operand is not forced to be a str.

  Neil

___
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] String formatting / unicode 2.5 bug?

2006-08-20 Thread John J Lee
On Sun, 20 Aug 2006, Neil Schemenauer wrote:

 John J Lee [EMAIL PROTECTED] wrote:
 The note (4) says that the result will be unicode, but it doesn't say how,
 in this case, that comes about.  This case is confusing because the docs
 claim string formatting with %s converts ... using str(), and yet
 str(a()) returns a bytestring.  Does it *really* use str, or just __str__?
 Surely the latter? (given the observed behaviour, and not reading the C
 source)

 It uses __str__ and confirms that the returned object is a 'str' or
 'unicode'.  The docs are not precise but they were not for 2.4
 either.  Note the following case:
[...]

OK, but I assume you're not saying that the fact that the docs were broken 
in 2.4 implies they shouldn't be fixed now?

I would suggest revised wording, but I'm clearly confused about what 
actually goes on under the hood...


John

___
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] ctypes and win64

2006-08-20 Thread Alex Martelli

On Aug 19, 2006, at 3:28 AM, Steve Holden wrote:
...
 It's going to be very interesting to see what comes out of the Google
 sprints. I am sure the 64-bitters will be out in force, so there'll be

Hmmm, we'll be working on our laptops, as is typical of sprints, so  
I'm not sure how many 64-bit machines will in fact be around -- we'll  
see.

 useful data about any such problems. irony wink=0.9764 bits is,  
 I am
 sure, as much as anyone is ever going to need, so the pain will  
 finally
 be over./irony

 It's good to see the idea of industry support for open source sprints
 taking off. Tomorrow, the world ... :-)

Sprints are indeed a fascinating idea and have proven they work, in  
an open-source context -- I do wonder if they could be made to work  
in other contexts, and I'm sure many others are wondering similarly.


Alex



___
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] ctypes and win64

2006-08-20 Thread Thomas Wouters
On 8/21/06, Alex Martelli [EMAIL PROTECTED] wrote:
On Aug 19, 2006, at 3:28 AM, Steve Holden wrote:... It's going to be very interesting to see what comes out of the Google sprints. I am sure the 64-bitters will be out in force, so there'll be
Hmmm, we'll be working on our laptops, as is typical of sprints, soI'm not sure how many 64-bit machines will in fact be around -- we'llsee.FWIW, I have access to a pair of AMD64 machines with 16Gb RAM and several hundred Gb swap. I can't give anyone else access, but I can run tests and debug.
Sprints are indeed a fascinating idea and have proven they work, inan open-source context -- I do wonder if they could be made to work
in other contexts, and I'm sure many others are wondering similarly. We've had commercial, private sprints at XS4ALL for years, every 6 months or so, until last year. We didn't call them sprints and they obviously weren't as freeform as the Python sprints, but the concept was the same (as well as the atmosphere.) We stopped having them because the number of concurrent projects was consistently larger than the number of programmers, which makes the sprinting setup somewhat useless. 
-- Thomas Wouters [EMAIL PROTECTED]Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
___
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] A cast from Py_ssize_t to long

2006-08-20 Thread Alexander Belopolsky

On Aug 15, 2006, at 3:16 AM, Martin v. Löwis wrote:


 Where does it assume that it is safe to case ssize_t - long?
 That would be a bug.

Is this a bug?

file_readinto(PyFileObject *f, PyObject *args)
{
...
 Py_ssize_t ndone, nnow;
...
 return PyInt_FromLong((long)ndone);
}

See Objects/fileobject.c (revision 51420).

___
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