Re: [Python-3000] threading, part 2 --- + a bit of ctypes FFI worry

2006-08-14 Thread Thomas Heller
Tim Peters schrieb: > [Josiah Carlson] >> ... >> Python 2.3.5 (#62, Feb 8 2005, 16:23:02) [MSC v.1200 32 bit (Intel)] on >> win32 >> Type "help", "copyright", "credits" or "license" for more information. >> >>> import ctypes >> >>> import threading >> >>> import time >> >>> def foo(): >> ...

Re: [Python-3000] Ctypes as cross-interpreter C calling interface

2006-08-14 Thread Guido van Rossum
After thinking about it some more, IMO for most purposes ctypes is really quite sub-optimal. I think it would make more sense to work on Parrot support for Python. Sure, in the short term ctypes is more practical than Parrot -- in its most recent incarnation, the latter doesn't even list Python as

Re: [Python-3000] Ctypes as cross-interpreter C calling interface

2006-08-14 Thread Jean-Paul Calderone
On Mon, 14 Aug 2006 08:31:31 -0700, Guido van Rossum <[EMAIL PROTECTED]> wrote: >After thinking about it some more, IMO for most purposes ctypes is >really quite sub-optimal. I think it would make more sense to work on >Parrot support for Python. Sure, in the short term ctypes is more >practical t

Re: [Python-3000] Ctypes as cross-interpreter C calling interface

2006-08-14 Thread Guido van Rossum
No. Why would it be a joke? Because it's a Perl thing? Because it doesn't acknowledge Python's obvious supremacy in the universe of languages? Because it admits that other projects sometimes have good ideas? Because it's a good idea to have to write separate wrappers around every useful library for

Re: [Python-3000] Ctypes as cross-interpreter C calling interface

2006-08-14 Thread Jean-Paul Calderone
On Mon, 14 Aug 2006 09:09:49 -0700, Guido van Rossum <[EMAIL PROTECTED]> wrote: >On 8/14/06, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: >>On Mon, 14 Aug 2006 08:31:31 -0700, Guido van Rossum <[EMAIL PROTECTED]> >>wrote: >> >After thinking about it some more, IMO for most purposes ctypes is >>

Re: [Python-3000] PEP3102 Keyword-Only Arguments

2006-08-14 Thread Guido van Rossum
Not remembering the PEP in detail, I agree with Jim's resolution of all these. I guess the right rule is that all positional arguments come first (first the regular ones, then * or *args). Then come the keyword arguments, again, first the regular ones (name=value), then **kwds. I believe the PEP

Re: [Python-3000] PEP3102 Keyword-Only Arguments

2006-08-14 Thread Steven Bethard
On 8/14/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > I believe the PEP doesn't address the opposite use case: positional > arguments that should *not* be specified as keyword arguments. For > example, I might want to write > > def foo(a, b): ... > > but I don't want callers to be able to cal

Re: [Python-3000] PEP3102 Keyword-Only Arguments

2006-08-14 Thread Guido van Rossum
On 8/14/06, Steven Bethard <[EMAIL PROTECTED]> wrote: > On 8/14/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > I believe the PEP doesn't address the opposite use case: positional > > arguments that should *not* be specified as keyword arguments. For > > example, I might want to write > > > >

Re: [Python-3000] Ctypes as cross-interpreter C calling interface

2006-08-14 Thread Guido van Rossum
On 8/14/06, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Mon, 14 Aug 2006 09:09:49 -0700, Guido van Rossum <[EMAIL PROTECTED]> > wrote: > >On 8/14/06, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > >>This is a joke, right? > >Because it's a good idea to have to write separate wrappers > >

Re: [Python-3000] Python/C++ question

2006-08-14 Thread Guido van Rossum
On 8/13/06, Georg Brandl <[EMAIL PROTECTED]> wrote: > Talin wrote: > > Guido van Rossum wrote: > >> On 8/9/06, Talin <[EMAIL PROTECTED]> wrote: > >> For the majority of Python developers it's probably the other way > >> around. It's been 15 years since I wrote C++, and unlike C, that > >> language

Re: [Python-3000] threading, part 2

2006-08-14 Thread Guido van Rossum
On 8/11/06, tomer filiba <[EMAIL PROTECTED]> wrote: > i mailed this to several people separately, but then i thought it could > benefit the entire group: > > http://sebulba.wikispaces.com/recipe+thread2 > > it's an implementation of the proposed " thread.raise_exc", through an > extension > to the

Re: [Python-3000] Ctypes as cross-interpreter C calling interface

2006-08-14 Thread Paul Prescod
I guess I don't see ctypes and Parrot solving the same problem at all. My idea with ctypes was the opposite of choosing a new runtime. It was to help various runtimes (PyPy, Jython, IronPython, CPython 2.5, CPython 3.0, Parrot, ...) to compete on their own merits (primarily performance and interope

Re: [Python-3000] Draft pre-PEP: function annotations

2006-08-14 Thread Jim Jewett
On 8/13/06, Paul Prescod <[EMAIL PROTECTED]> wrote: > My proposed text for the PEP is as follows: Mostly good. A few remaining comments... Should annotation objects with defined semantics have some standard way to indicate this? (By analogy, new exceptions *should* inherit from Exception; shoul

Re: [Python-3000] threading, part 2

2006-08-14 Thread Josiah Carlson
"Guido van Rossum" <[EMAIL PROTECTED]> wrote: > > On 8/11/06, tomer filiba <[EMAIL PROTECTED]> wrote: > > i mailed this to several people separately, but then i thought it could > > benefit the entire group: > > > > http://sebulba.wikispaces.com/recipe+thread2 > > > > it's an implementation of th

Re: [Python-3000] threading, part 2

2006-08-14 Thread Georg Brandl
Guido van Rossum wrote: > On 8/11/06, tomer filiba <[EMAIL PROTECTED]> wrote: >> i mailed this to several people separately, but then i thought it could >> benefit the entire group: >> >> http://sebulba.wikispaces.com/recipe+thread2 >> >> it's an implementation of the proposed " thread.raise_exc",

Re: [Python-3000] Python/C++ question

2006-08-14 Thread Georg Brandl
Guido van Rossum wrote: > On 8/13/06, Georg Brandl <[EMAIL PROTECTED]> wrote: >> Talin wrote: >> > Guido van Rossum wrote: >> >> On 8/9/06, Talin <[EMAIL PROTECTED]> wrote: >> >> For the majority of Python developers it's probably the other way >> >> around. It's been 15 years since I wrote C++, an

Re: [Python-3000] threading, part 2

2006-08-14 Thread Tim Peters
[tomer filiba] >> i mailed this to several people separately, but then i thought it could >> benefit the entire group: >> >> http://sebulba.wikispaces.com/recipe+thread2 >> >> it's an implementation of the proposed " thread.raise_exc", >> ... [Guido] > Cool. Question: what's the problem with raisi

Re: [Python-3000] Draft pre-PEP: function annotations

2006-08-14 Thread Jim Jewett
On 8/13/06, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > However, it's only a problem if you insist on writing brain-damaged > code. If you want interoperability here, you must write tell-don't-ask > code. ... is it really the case that > so many people don't know what tell-don't-ask code is or w

Re: [Python-3000] Ctypes as cross-interpreter C calling interface

2006-08-14 Thread Jean-Paul Calderone
On Mon, 14 Aug 2006 11:08:56 -0700, Guido van Rossum <[EMAIL PROTECTED]> wrote: >On 8/14/06, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: >>On Mon, 14 Aug 2006 09:09:49 -0700, Guido van Rossum <[EMAIL PROTECTED]> >>wrote: >I also consider .NET's CLR a success, based on the testimony of Jim >Hugu

Re: [Python-3000] Draft pre-PEP: function annotations

2006-08-14 Thread Collin Winter
On 8/13/06, Paul Prescod <[EMAIL PROTECTED]> wrote: > "In order for processors of function annotations to work interoperably, they > must use a common interpretation of objects used as annotations on a > particular function. For example, one might interpret string annotations as > docstrings. Anoth

Re: [Python-3000] Ctypes as cross-interpreter C calling interface

2006-08-14 Thread Paul Prescod
On 8/14/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: The major difference between all these examples and ctypes is thatctypes has no way of introspecting the wrapped library; you have torepeat everything you know about the API in your calls to ctypes (andas was just shown in another thread about

Re: [Python-3000] Draft pre-PEP: function annotations

2006-08-14 Thread Paul Prescod
On 8/14/06, Collin Winter <[EMAIL PROTECTED]> wrote: The way I read this, it forces (more or less) eachannotation-consuming library to invent new ways to spell Python'sbuilt-in types.I think that this is related to your other question. What if an annotation consuming library wanted to use Python's

Re: [Python-3000] PEP3102 Keyword-Only Arguments; Signature

2006-08-14 Thread Jim Jewett
On 8/14/06, Steven Bethard <[EMAIL PROTECTED]> wrote: > On 8/14/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > I believe the PEP doesn't address the opposite use case: positional > > arguments that should *not* be specified as keyword arguments. ... > It would be really nice in the example ab

Re: [Python-3000] PEP3102 Keyword-Only Arguments

2006-08-14 Thread Steven Bethard
On 8/14/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 8/14/06, Steven Bethard <[EMAIL PROTECTED]> wrote: > > On 8/14/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > > I believe the PEP doesn't address the opposite use case: positional > > > arguments that should *not* be specified as key

Re: [Python-3000] Draft pre-PEP: function annotations

2006-08-14 Thread Paul Prescod
On 8/14/06, Jim Jewett <[EMAIL PROTECTED]> wrote: Should annotation objects with defined semantics have some standardway to indicate this?  (By analogy, new exceptions *should* inheritfrom Exception; should annotation objects inherit from an Annotationclass, at least as a mixin?) All annotation obj

Re: [Python-3000] Draft pre-PEP: function annotations

2006-08-14 Thread Collin Winter
On 8/14/06, Paul Prescod <[EMAIL PROTECTED]> wrote: > There are three issues: first, we need to RESERVE the types for > standardization by Guido and crew. You're just pushing the decision off to someone else. Regardless of who makes it, decisions involving the built-in types are going to make some

Re: [Python-3000] Draft pre-PEP: function annotations

2006-08-14 Thread Paul Prescod
On 8/14/06, Collin Winter <[EMAIL PROTECTED]> wrote: On 8/14/06, Paul Prescod <[EMAIL PROTECTED]> wrote:> There are three issues: first, we need to RESERVE the types for> standardization by Guido and crew.You're just pushing the decision off to someone else. Regardless of who makes it, decisions in

Re: [Python-3000] Draft pre-PEP: function annotations

2006-08-14 Thread Collin Winter
On 8/14/06, Paul Prescod <[EMAIL PROTECTED]> wrote: > On 8/14/06, Collin Winter <[EMAIL PROTECTED]> wrote: > > On 8/14/06, Paul Prescod <[EMAIL PROTECTED]> wrote: > > > Second, we can decide to do the standardization at any point. > > > > Um, "at any point"? You mean it's conceivable that this > >

[Python-3000] Conventions for annotation consumers (was: Re: Draft pre-PEP: function annotations)

2006-08-14 Thread Collin Winter
On 8/14/06, Paul Prescod <[EMAIL PROTECTED]> wrote: > Third, we absolutely need a standard for > multiple independent annotations on a parameter. Using lists is a > no-brainer. So let's do that. The problem with using lists is that its impossible for non-decorator annotation consumers to know whic

Re: [Python-3000] Draft pre-PEP: function annotations

2006-08-14 Thread Jim Jewett
On 8/14/06, Paul Prescod <[EMAIL PROTECTED]> wrote: > > > "This implies that the interpretation of built-in types would be > controlled > > > by Python's developers and documented in Python's documentation. > > It also implies that the interpretation of annotations made with a > > built-in type s

Re: [Python-3000] Conventions for annotation consumers (was: Re: Draft pre-PEP: function annotations)

2006-08-14 Thread Jim Jewett
On 8/14/06, Collin Winter <[EMAIL PROTECTED]> wrote: > On 8/14/06, Paul Prescod <[EMAIL PROTECTED]> wrote: > The problem with using lists is that its impossible for non-decorator > annotation consumers to know which element "belongs" to them. The ones whose type they own -- which is why I see at

Re: [Python-3000] Draft pre-PEP: function annotations

2006-08-14 Thread Paul Prescod
On 8/14/06, Collin Winter <[EMAIL PROTECTED]> wrote: Because not having standardised meanings at the same time as thefeature becomes available says to developers, "don't use the built-intypes in your annotations because we might give them a meaninglater...or maybe we won't...but in the meantime, yo

Re: [Python-3000] Conventions for annotation consumers (was: Re: Draft pre-PEP: function annotations)

2006-08-14 Thread Collin Winter
On 8/14/06, Jim Jewett <[EMAIL PROTECTED]> wrote: > On 8/14/06, Collin Winter <[EMAIL PROTECTED]> wrote: > > The problem with using lists is that its impossible for non-decorator > > annotation consumers to know which element "belongs" to them. > > The ones whose type they own -- which is why I see

Re: [Python-3000] Conventions for annotation consumers (was: Re: Draft pre-PEP: function annotations)

2006-08-14 Thread Paul Prescod
On 8/14/06, Collin Winter <[EMAIL PROTECTED]> wrote: What would the rule be about top-level types? Would you have to use alist, or could a set or dict be used?I argue to restrict to a list for the following reasons:1. Better to just pick something for visual consistency (someone said they liked tup

Re: [Python-3000] PEP3102 Keyword-Only Arguments; Signature

2006-08-14 Thread Guido van Rossum
On 8/14/06, Jim Jewett <[EMAIL PROTECTED]> wrote: > On 8/14/06, Steven Bethard <[EMAIL PROTECTED]> wrote: > > On 8/14/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > > I believe the PEP doesn't address the opposite use case: positional > > > arguments that should *not* be specified as keyword a

Re: [Python-3000] Draft pre-PEP: function annotations

2006-08-14 Thread Phillip J. Eby
At 1:51 PM 8/14/2006 -0700, "Paul Prescod" <[EMAIL PROTECTED]> wrote: >On 8/14/06, Jim Jewett <[EMAIL PROTECTED]> wrote: > > The definition of a type as an annotation should probably be either > > defined or explicitly undefined. Earlier discussions talked about > > things like > > > > def f (

Re: [Python-3000] Draft pre-PEP: function annotations

2006-08-14 Thread Calvin Spealman
On 8/14/06, Collin Winter <[EMAIL PROTECTED]> wrote: > On 8/13/06, Paul Prescod <[EMAIL PROTECTED]> wrote: > > "In order for processors of function annotations to work interoperably, they > > must use a common interpretation of objects used as annotations on a > > particular function. For example,

Re: [Python-3000] Draft pre-PEP: function annotations

2006-08-14 Thread Greg Ewing
Phillip J. Eby wrote: > It can't be a "separate program altogether", since to get at the > annotations, the program must import the module that contains them. Why? I can imagine something like a documentation generator or static type checker that just parses the source, being careful not to exe

Re: [Python-3000] Draft pre-PEP: function annotations

2006-08-14 Thread Greg Ewing
Phillip J. Eby wrote: > The examples there are very short > and simple; in fact the complete Message implementation, including > imports and overload declarations is only *6 lines long*. > > So, my only guess is that the people who looked at that skimmed right > past it, looking for something

Re: [Python-3000] Ctypes as cross-interpreter C calling interface

2006-08-14 Thread Nick Coghlan
Guido van Rossum wrote: > On 8/14/06, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: >> On Mon, 14 Aug 2006 09:09:49 -0700, Guido van Rossum <[EMAIL PROTECTED]> >> wrote: >>> On 8/14/06, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: This is a joke, right? >>> Because it's a good idea to have

Re: [Python-3000] Draft pre-PEP: function annotations

2006-08-14 Thread Phillip J. Eby
At 01:13 PM 8/15/2006 +1200, Greg Ewing wrote: >Phillip J. Eby wrote: > >>It can't be a "separate program altogether", since to get at the >>annotations, the program must import the module that contains them. > >Why? I can imagine something like a documentation >generator or static type checker t

Re: [Python-3000] Draft pre-PEP: function annotations

2006-08-14 Thread Phillip J. Eby
At 01:19 PM 8/15/2006 +1200, Greg Ewing wrote: >Phillip J. Eby wrote: > > > The examples there are very short >>and simple; in fact the complete Message implementation, including >>imports and overload declarations is only *6 lines long*. >>So, my only guess is that the people who looked at that s

Re: [Python-3000] threading, part 2 --- + a bit of ctypes FFI worry

2006-08-14 Thread Tim Peters
[Tim Peters] >> ... >> When the ctypes docs talk about passing and returning integers, they >> never explain what "integers" /means/, but it seems the docs >> implicitly have a 32-bit-only view of the world here. In reality >> "integer" seems to mean the native C `int` type. [Thomas Heller] > 'ct

Re: [Python-3000] PEP3102 Keyword-Only Arguments

2006-08-14 Thread Nick Coghlan
Guido van Rossum wrote: >> It would be really nice in the example above to mark ``self`` in >> ``__call__`` as a positional only argument. > > But this is a rather unusual use case isn't it? It's due to the bound > methods machinery. Do you have other use cases? I would assume that > normally such

Re: [Python-3000] Python/C++ question

2006-08-14 Thread Nick Coghlan
Georg Brandl wrote: > Guido van Rossum wrote: >> Implementation Language >> == >> >> Python 3000 will be implemented in C, and the implementation will be >> derived as an evolution of the Python 2 code base. This reflects my >> views (which I share with Joel Spolsky) on the dangers

Re: [Python-3000] Python/C++ question

2006-08-14 Thread Terry Reedy
"Georg Brandl" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Guido van Rossum wrote: >> Implementation Language >> == >> >> Python 3000 will be implemented in C, and the implementation will be >> derived as an evolution of the Python 2 code base. This reflects my >

Re: [Python-3000] [Python-Dev] Type of range object members

2006-08-14 Thread Alexander Belopolsky
On Aug 14, 2006, at 10:01 PM, Nick Coghlan wrote: > Guido van Rossum wrote: >> Methinks that as long as PyIntObject uses long (see intobject.h) >> there's no point in changing this to long. > > Those fields are going to have to change to Py_Object* eventually > if xrange() is going to become th

Re: [Python-3000] [Python-Dev] Type of range object members

2006-08-14 Thread Nick Coghlan
Alexander Belopolsky wrote: > > On Aug 14, 2006, at 10:01 PM, Nick Coghlan wrote: > >> Guido van Rossum wrote: >>> Methinks that as long as PyIntObject uses long (see intobject.h) >>> there's no point in changing this to long. >> >> Those fields are going to have to change to Py_Object* eventuall

Re: [Python-3000] Draft pre-PEP: function annotations

2006-08-14 Thread Greg Ewing
Phillip J. Eby wrote: > How is such a thing going to know what doc("foo") means at the time the > code is run? What about closures, dynamic imports, etc.? Annotations intended for such external processors would have to be designed not to rely on anything dynamic, i.e. be purely declarative. Ma

Re: [Python-3000] Python/C++ question

2006-08-14 Thread Guido van Rossum
+1 On 8/14/06, Terry Reedy <[EMAIL PROTECTED]> wrote: > > "Georg Brandl" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Guido van Rossum wrote: > >> Implementation Language > >> == > >> > >> Python 3000 will be implemented in C, and the implementation will be > >

Re: [Python-3000] PEP3102 Keyword-Only Arguments

2006-08-14 Thread Guido van Rossum
On 8/14/06, Nick Coghlan <[EMAIL PROTECTED]> wrote: > However, I'm also wondering if we need an actual syntax, or if a simple > convention would do the trick: start the names of positional-only arguments > with an underscore. Hm... and perhaps we could forbid keyword arguments starting with an und

Re: [Python-3000] threading, part 2 --- + a bit of ctypes FFI worry

2006-08-14 Thread Guido van Rossum
Perhaps this thread can be moved back to python-dev? I'm not sure how relevant a discussion of the ambiguities in ctypes' docs are for Py3k. On 8/14/06, Tim Peters <[EMAIL PROTECTED]> wrote: > [Tim Peters] > >> ... > >> When the ctypes docs talk about passing and returning integers, they > >> neve

Re: [Python-3000] Draft pre-PEP: function annotations

2006-08-14 Thread Guido van Rossum
On 8/14/06, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > At 1:51 PM 8/14/2006 -0700, "Paul Prescod" <[EMAIL PROTECTED]> wrote: > >On 8/14/06, Jim Jewett <[EMAIL PROTECTED]> wrote: > > > The definition of a type as an annotation should probably be either > > > defined or explicitly undefined. Earlie

Re: [Python-3000] PEP3102 Keyword-Only Arguments

2006-08-14 Thread Steven Bethard
[Steven Bethard] > It would be really nice in the example above to mark ``self`` in > ``__call__`` as a positional only argument. [Nick Coghlan] > However, I'm also wondering if we need an actual syntax, or if a simple > convention would do the trick: start the names of positional-only arguments >

Re: [Python-3000] PEP3102 Keyword-Only Arguments

2006-08-14 Thread Aahz
On Mon, Aug 14, 2006, Guido van Rossum wrote: > On 8/14/06, Nick Coghlan <[EMAIL PROTECTED]> wrote: >> >> However, I'm also wondering if we need an actual syntax, or if a simple >> convention would do the trick: start the names of positional-only arguments >> with an underscore. > > Hm... and perh

Re: [Python-3000] [Python-Dev] Type of range object members

2006-08-14 Thread Alexander Belopolsky
On Aug 14, 2006, at 10:34 PM, Nick Coghlan wrote: > Alexander Belopolsky wrote: [snip] >> Would it make sense to unify rangeobject with PySliceObject? > > Not really. The memory layouts may end up being the same in Py3k, > but they're still different types. The major differences between > the

Re: [Python-3000] PEP3102 Keyword-Only Arguments

2006-08-14 Thread Josiah Carlson
Aahz <[EMAIL PROTECTED]> wrote: > > On Mon, Aug 14, 2006, Guido van Rossum wrote: > > On 8/14/06, Nick Coghlan <[EMAIL PROTECTED]> wrote: > >> > >> However, I'm also wondering if we need an actual syntax, or if a simple > >> convention would do the trick: start the names of positional-only argume

Re: [Python-3000] PEP3102 Keyword-Only Arguments

2006-08-14 Thread Nick Coghlan
Steven Bethard wrote: > [Steven Bethard] >> It would be really nice in the example above to mark ``self`` in >> ``__call__`` as a positional only argument. > > [Nick Coghlan] >> However, I'm also wondering if we need an actual syntax, or if a simple >> convention would do the trick: start the name