[Python-Dev] test_subprocess failing

2008-04-19 Thread skip
test_subprocess failed in Neal's regression test overnight.  My guess for
the culprit would be Christian's checkin on Friday:

  r62386 | christian.heimes | 2008-04-18 21:23:57 -0500 (Fri, 18 Apr 2008) | 2 
lines

  Added kill, terminate and send_signal to subprocess.Popen.  The bits and
  pieces for the Windows side were already in place. The POSIX side is trivial
  (as usual) and uses os.kill().

Skip

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


Re: [Python-Dev] unscriptable?

2008-04-19 Thread Nick Coghlan
Benjamin Peterson wrote:
> On Fri, Apr 18, 2008 at 5:43 PM, Benjamin Peterson
> <[EMAIL PROTECTED]> wrote:
>> Consider this error:
>>  >>> 3["something"]
>>  Traceback (most recent call last):
>>   File "", line 1, in 
>>  TypeError: 'int' object is unsubscriptable
>>
>>  "unscriptable" seems rather ambiguous. How about "[object] cannot be 
>> indexed"?
> Titus just noticed that I confused "unscriptable" with
> "unsubscriptable."  :P Still, though, unsubscriptable seems to be a
> Python invented word.
> What does (un)subscriptable even mean?

You can't pass the object a subscript (the expression between the square 
brackets) and get a meaningful answer.

Being indexable is subtly different from being subscriptable - the 
former has stronger connotations of numeric indices and sequence-like 
behaviour (particularly since the introduction of operator.index), while 
the latter merely states that the container provides some kinds of 
mapping from subscripts to values in the container, without provide any 
implications as to the nature of that mapping.

'Unsubscriptable' may be a bit clumsy, but it's as accurate a 
description of the error as you're likely to find.

Cheers,
Nick.

-- 
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---
 http://www.boredomandlaziness.org
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] unscriptable?

2008-04-19 Thread Steven
On Sat, 19 Apr 2008 22:13:19 +1000
Nick Coghlan <[EMAIL PROTECTED]> wrote:

> Being indexable is subtly different from being subscriptable - the 
> former has stronger connotations of numeric indices and sequence-like 
> behaviour 

I dispute this. Indices aren't necessarily numeric (think of an A-Z 
file), and I don't believe you are correct about the connotations of
indexable being numeric or sequence-like. Think of index cards. 

With my maths background, I would expect that subscripts are (almost)
always numeric, e.g. x-subscript-i means the i-th x value, where i 
is a natural number.

+0 on keeping unsubscriptable.
+1 on changing it to unidexable.
-1 on keeping the current misspelling.


-- 
Steven D'Aprano
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Interface to change Py3kWarning in Python

2008-04-19 Thread Georg Brandl
Christian Heimes schrieb:
> Benjamin Peterson schrieb:
>> I currently have a patch to make it possible to change py3k warnings
>> in Python through new functions in sys: issue 2458. I realize the
>> functions are rather ugly, but I don't think there is another
>> practical way to do it unless you want to be writing PySys_GetObject
>> and checking it for NULL whenever you add a Py3k warning.
> 
> In Python we usually have to methods for the job, like
> set_py3kwarningmode and get_py3kwarningmode. I don't like the enable*
> and disable* style. Even the get/set methods are an ugly workaround for
> the fact, Python doesn't support module properties. :/
> 
> How do you like a macro or function PyErr_Warn3k(msg) that does all the
> dirty work?

Which additional dirty work would it do? It should never have to do more than
check a simple static C variable, for obvious reasons.

Georg


-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.

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


Re: [Python-Dev] Interface to change Py3kWarning in Python

2008-04-19 Thread Benjamin Peterson
On Sat, Apr 19, 2008 at 9:12 AM, Georg Brandl <[EMAIL PROTECTED]> wrote:
> Christian Heimes schrieb:
>  >
>  > How do you like a macro or function PyErr_Warn3k(msg) that does all the
>  > dirty work?
>
>  Which additional dirty work would it do? It should never have to do more than
>  check a simple static C variable, for obvious reasons.
Even if there's no dirty work, it could clean up this:

if (Py_Py3kWarningFlag &&
   PyErr_WarnEx(PyErr_DeprecationWarning, "msg", 2) < 0)

to

if (PyErr_WarnPy3k("msg", 2) < 0)
>
>  Georg



-- 
Cheers,
Benjamin Peterson
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] test_subprocess failing

2008-04-19 Thread Christian Heimes
[EMAIL PROTECTED] schrieb:
> test_subprocess failed in Neal's regression test overnight.  My guess for
> the culprit would be Christian's checkin on Friday:
> 
>   r62386 | christian.heimes | 2008-04-18 21:23:57 -0500 (Fri, 18 Apr 2008) | 
> 2 lines
> 
>   Added kill, terminate and send_signal to subprocess.Popen.  The bits and
>   pieces for the Windows side were already in place. The POSIX side is trivial
>   (as usual) and uses os.kill().

The processes were killed too early. The tests now wait until the
subprocess sends out a string.

Christian
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] unscriptable?

2008-04-19 Thread Georg Brandl
Steven schrieb:
> On Sat, 19 Apr 2008 22:13:19 +1000
> Nick Coghlan <[EMAIL PROTECTED]> wrote:
> 
>> Being indexable is subtly different from being subscriptable - the 
>> former has stronger connotations of numeric indices and sequence-like 
>> behaviour 
> 
> I dispute this. Indices aren't necessarily numeric (think of an A-Z 
> file), and I don't believe you are correct about the connotations of
> indexable being numeric or sequence-like. Think of index cards. 

In normal language use, perhaps -- I'm no native speaker. But in the
Python world, Nick is right -- think of the __index__ special method that
adapts the object to a sequence index; it has to return an integer.

> With my maths background, I would expect that subscripts are (almost)
> always numeric, e.g. x-subscript-i means the i-th x value, where i 
> is a natural number.

Maths background isn't always directly transferable to computer
languages. Think 1 / 2 == 0 -- with terms, it's even worse.

An interesting point here is that the special methods are called
__getitem__ et al., smartly evading the problem. "'int' object
has no items" sounds equally strange to me though.

> +0 on keeping unsubscriptable.
> +1 on changing it to unidexable.
> -1 on keeping the current misspelling.

There is currently no misspelling.

Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.

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


[Python-Dev] 3k checkin mails to python-checkins

2008-04-19 Thread Georg Brandl
Since a few days, checkin notifications for the 3k branch seem to be sent
to both the python-checkins and the python-3000-checkins lists. Was that a
deliberate decision or has some bug crept into the SVN hook?

Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.

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


[Python-Dev] unscriptable?

2008-04-19 Thread Jim Jewett
> I dispute this. Indices aren't necessarily numeric
> (think of an A-Z file),

Python has recently added an __index__ slot which means "as an
integer, and I really am an integer, I'm not just rounding like
int(3.4) would do"

So in the context of python, an index is numeric, whereas "subscript"
has already been used for hashtables with arbitrary keys.

-jJ
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] unscriptable?

2008-04-19 Thread Stephen J. Turnbull
Steven writes:
 > On Sat, 19 Apr 2008 22:13:19 +1000
 > Nick Coghlan <[EMAIL PROTECTED]> wrote:
 > 
 > > Being indexable is subtly different from being subscriptable - the 
 > > former has stronger connotations of numeric indices and sequence-like 
 > > behaviour 

 > With my maths background, I would expect that subscripts are (almost)
 > always numeric, e.g. x-subscript-i means the i-th x value, where i 
 > is a natural number.

I don't think you can get general agreement on which tend to connote
numerical indicies more.  On the other hand, in many contexts "index"
is a general concept, while "subscript" is a typographical convention
for representing an index.

+1 on indexable
+0.5 on subscriptable
-0.1 on scriptable
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] unscriptable?

2008-04-19 Thread Scott Dial
Georg Brandl wrote:
> There is currently no misspelling.

We should at least make the set object match the others.

-Scott

-- 
Scott Dial
[EMAIL PROTECTED]
[EMAIL PROTECTED]
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] unscriptable?

2008-04-19 Thread Greg Ewing
Nick Coghlan wrote:

> Being indexable is subtly different from being subscriptable - the 
> former has stronger connotations of numeric indices and sequence-like 
> behaviour (particularly since the introduction of operator.index), while 
> the latter merely states that the container provides some kinds of 
> mapping from subscripts to values in the container, without provide any 
> implications as to the nature of that mapping.

I don't think everyone would agree with that. For example,
databases have these things that are called "indexes" even
when the value being used as a key isn't a number.

I've never really liked the term "subscript" in this
context, because to me it implies a typographical feature,
i.e. writing something below the baseline, which isn't
normally done in a textual programming language. The
term "index", on the other hand, directly suggests the
idea of looking something up, without relying on
indirection through typography and mathematical convention.

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


Re: [Python-Dev] unscriptable?

2008-04-19 Thread Nick Coghlan
Stephen J. Turnbull wrote:
> Steven writes:
>  > On Sat, 19 Apr 2008 22:13:19 +1000
>  > Nick Coghlan <[EMAIL PROTECTED]> wrote:
>  > 
>  > > Being indexable is subtly different from being subscriptable - the 
>  > > former has stronger connotations of numeric indices and sequence-like 
>  > > behaviour 
> 
>  > With my maths background, I would expect that subscripts are (almost)
>  > always numeric, e.g. x-subscript-i means the i-th x value, where i 
>  > is a natural number.
> 
> I don't think you can get general agreement on which tend to connote
> numerical indicies more.

Indices and arrays go hand-in-hand for me (probably due to my signal 
processing background) and I believe PEP 357's choice of __index__ for 
sequence indexing made that association reasonably official in Python terms.

>  On the other hand, in many contexts "index"
> is a general concept,  while "subscript" is a typographical convention
> for representing an index.

Granted, but the latter is explicitly used as the general term for 
sequence indexing and mapping in the relevant section of the language 
reference [1]. So specifically in the context of Python, the error 
message from 'int' is absolutely correct, and the error message from 
'set' isn't technically wrong either (although perhaps not quite as 
correct as it could be).

To suggest yet another colour for the bikeshed, maybe we should ditch 
both unindexable and unsubscriptable and go with "'int' is not a 
sequence or mapping". Any object which supports subscript notation will 
be one or the other.

Cheers,
Nick.

[1] http://docs.python.org/dev/reference/expressions.html#id7

-- 
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---
 http://www.boredomandlaziness.org
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] unscriptable?

2008-04-19 Thread Steve Holden
Nick Coghlan wrote:
[...]>
> To suggest yet another colour for the bikeshed, maybe we should ditch 
> both unindexable and unsubscriptable and go with "'int' is not a 
> sequence or mapping". Any object which supports subscript notation will 
> be one or the other.
> 
All the object needs to to to be "indexable" or "subscriptable" is to 
implement .__index__() or .__getitem__(). While sequences and mappings 
are the only built-in types to do so, this says nothing about 
user-defined types.

Couldn't we find a more obvious and direct error message like

"Illegal use of [] subscripting/indexing"?

one-more-coat-for-the-bikeshed-ly y'rs  - steve
-- 
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC  http://www.holdenweb.com/

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


Re: [Python-Dev] unscriptable?

2008-04-19 Thread Stephen J. Turnbull
Nick Coghlan writes:

 > To suggest yet another colour for the bikeshed, maybe we should ditch 
 > both unindexable and unsubscriptable and go with "'int' is not a 
 > sequence or mapping".

I like this best.
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com