Re: [Python-Dev] Py_ssize_t formatting

2006-05-14 Thread Thomas Wouters
On 5/14/06, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
Georg Brandl wrote:>> Right. At least, not with changing structmember.[ch].>> Did you mean "without"?Oops, right.> Can I submit a patch?I personally don't mind having more types added to structmember,
so I'm +0 on adding Py_ssize_t to the list of types supported.I wonder what the specific application is that you have in mind,though.I ended up needing T_SSIZE_T or T_SIZE_T (I forget which) in my first attempt to fully Py_ssize-t-ify ctypes (but I was learning a lot about ctypes at the same time, and I ended up breaking a lot of stuff.) I'm now not sure whether it's really necessary for ctypes, but it was trivial to add, not to mention symmetric and completely logical. However, I also have a C extension of my own that exposes something quite like 'length' as an attribute, and it really ought to be a Py_ssize_t struct member (instead of the long it is now.)
-- Thomas Wouters <[EMAIL PROTECTED]>Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
___
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] correction of a bug

2006-05-14 Thread draconux
Hello all ,I found a bug in pythonI'm using python 2.4 with debian etchstring.lstrip("source/old_prog","source/") return "ld_prog" instead of "old_prog"
So I wanted to create a patch in order to contribute to python, but I have some question :- grep 'def lstrip' show that this function are defined in string.pyIn this fill I read :# NOTE: Everything below here is deprecated.  Use string methods instead.
# This stuff will go away in Python 3.0.so lstrip is deprecated, and we are recommanded to use string methodBut this is string.py which define string method, isn't it ?- The function lstrip is :
  def lstrip(s, chars=None):    """lstrip(s [,chars]) -> string    Return a copy of the string s with leading whitespace removed.    If chars is given and not None, remove characters in chars instead.
    """    return s.lstrip(chars)but where is defined this lstrip(chars) function I can't found it with grep.Sorry I'm a c programer, and I'm not used with pythonfor me, It's easier to debug c program than python :)

___
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] correction of a bug

2006-05-14 Thread skip

draconux> I found a bug in python I'm using python 2.4 with debian etch

draconux> string.lstrip("source/old_prog","source/") return "ld_prog"
draconux> instead of "old_prog"

The above is the same as

"source/old_prog".lstrip("source/")

String methods are defined in the Objects/stringobject.c file of the source
distribution.

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] correction of a bug

2006-05-14 Thread Heiko Wundram
Am Samstag 13 Mai 2006 17:30 schrieb draconux:
> I found a bug in python
> I'm using python 2.4 with debian etch
>
> string.lstrip("source/old_prog","source/") return "ld_prog" instead of
> "old_prog"

This is not a bug, but rather expected behaviour. Read the specification of 
lstrip() correctly.

--- Heiko.
___
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] correction of a bug

2006-05-14 Thread Edward Loper
draconux wrote:
> 
> Hello all ,
> string.lstrip("source/old_prog","source/") return "ld_prog" instead of 
> "old_prog"

You are misunderstanding what the second argument to lstrip does.  It is 
interpreted as a list of characters; and lstrip will remove the maximal 
prefix of the string that consists of these characters.  E.g.:

 >>> 'aaabbbcccaax'.lstrip('abc')
'x'

The first character in your string that is not one of the characters 
's', 'o', 'u', 'r', 'c', 'e', or '/' is 'l', so it strips all characters 
up to that one.

-Edward
___
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