Re: [Python-Dev] Reintroduce or drop completly hex, bz2, rot13, ... codecs

2010-06-11 Thread Walter Dörwald
On 10.06.10 21:31, Terry Reedy wrote:

> On 6/10/2010 7:08 AM, M.-A. Lemburg wrote:
>> Walter Dörwald wrote:
> 
 The PEP would also serve as a reference back to both this discussion and
 the previous one (which was long enough ago that I've forgotten most of 
 it).
>>>
>>> I too think that a PEP is required here.
>>
>> Fair enough. I'll write a PEP.
> 
> Thank you from me.
>>
>>> Codecs support several types of error handling that don't make sense for
>>> transform()/untransform(). What should 'abc'.decode('hex', 'replace')
>>> do? (In 2.6 it raises an assertion error, because errors *must* be strict).
> 
> I would expext either ValueError: errors arg must be 'strict' for 
> trransform

What use is an argument that must always have the same value?

'abc'.transform('hex', errors='strict', obey_the_flufl=True)

> or else TypeError: tranform takes 1 arg, 2 given.

IMHO that's the better option.

>> That's not really an issue since codecs don't have to implement
>> all error handling schemes.
>>
>> For starters, they will all only implement 'strict' mode.

I would prefer it if transformers were separate from codecs and had
their own registry.

Servus,
   Walter
___
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] Summary of Python tracker Issues

2010-06-11 Thread Python tracker

ACTIVITY SUMMARY (2010-06-04 - 2010-06-11)
Python tracker at http://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue 
number.  Do NOT respond to this message.


 2764 open (+54) / 18028 closed (+23) / 20792 total (+77)

Open issues with patches:  1115

Average duration of open issues: 714 days.
Median duration of open issues: 502 days.

Open Issues Breakdown
   open  2737 (+54)
languishing12 ( +0)
pending14 ( +0)

Issues Created Or Reopened (79)
___

datetime.datetime operator methods are not subclass-friendly   2010-06-09
   http://bugs.python.org/issue2267reopened belopolsky  
 
   patch   

DeprecationWarning message applies to wrong context with exec( 2010-06-10
   http://bugs.python.org/issue3423reopened ghazel  
 
   

sunau bytes / str TypeError in Py3k2010-06-04
CLOSED http://bugs.python.org/issue8897created  tjollans
 
   patch   

The email package should defer to the codecs module for all al 2010-06-04
   http://bugs.python.org/issue8898created  r.david.murray  
 
   easy

Add docstrings to time.struct_time 2010-06-04
CLOSED http://bugs.python.org/issue8899created  belopolsky  
 
   patch, easy 

IDLE crashes if Preference set to At Startup -> Open Edit Wind 2010-06-04
   http://bugs.python.org/issue8900created  mhuster 
 
   

Windows registry path not ignored with -E option   2010-06-05
   http://bugs.python.org/issue8901created  flashk  
 
   patch, needs review 

add datetime.time.now() for consistency2010-06-05
   http://bugs.python.org/issue8902created  techtonik   
 
   

Add module level now() and today() functions to datetime modul 2010-06-05
CLOSED http://bugs.python.org/issue8903created  techtonik   
 
   

quick example how to fix docs  2010-06-05
   http://bugs.python.org/issue8904created  techtonik   
 
   

difflib should accept arbitrary line iterators 2010-06-05
   http://bugs.python.org/issue8905created  techtonik   
 
   

Document TestCase attributes in class docstring2010-06-05
   http://bugs.python.org/issue8906created  flub
 
   

time module documentation differs in trunk and py3k2010-06-05
CLOSED http://bugs.python.org/issue8907created  belopolsky  
 
   patch   

friendly errors for UAC misbehavior in windows installers  2010-06-05
   http://bugs.python.org/issue8908created  techtonik   
 
   patch   

mention bitmap size for bdist_wininst  2010-06-05
CLOSED http://bugs.python.org/issue8909created  techtonik   
 
   patch   

Write a text file explaining why Lib/test/data exists  2010-06-06
   http://bugs.python.org/issue8910created  brett.cannon
 
   patch, easy, needs review   

regrtest.main should have a test skipping argument 2010-06-06
   http://bugs.python.org/issue8911created  brett.cannon
 
   easy

`make patchcheck` should check the whitespace of .c/.h files   2010-06-06
   http://bugs.python.org/issue8912created  brett.cannon
 
   

Document that datetime.__form

[Python-Dev] Are PyCFunctions supposed to invisibly consume self when used as a method?

2010-06-11 Thread Brett Cannon
The logging module taught me something today about the difference of a
function defined in C and a function defined in Python::

  import importlib

  class Base:
def imp(self, name):
return self.import_(name)

  class CVersion(Base):
import_ = __import__

  class PyVersion(Base):
import_ = importlib.__import__

  CFunction().imp('tokenize')
  PyFunction().imp('tokenize')  # Fails!


Turns out the use of __import__ works while the importlib version
fails. Why does importlib fail? Because the first argument to the
importlib.__import__ function is an instance of PyVersion, not a
string. And yet the __import__ version works as if the self argument
is never passed to it!

This "magical" ignoring of self seems to extend to any PyCFunction. Is
this dichotomy intentional or just a "fluke"? Maybe this is a
hold-over from before we had descriptors and staticmethod, but now
that we have these things perhaps this difference should go away.
___
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] Are PyCFunctions supposed to invisibly consume self when used as a method?

2010-06-11 Thread Benjamin Peterson
2010/6/11 Brett Cannon :
> This "magical" ignoring of self seems to extend to any PyCFunction. Is
> this dichotomy intentional or just a "fluke"? Maybe this is a
> hold-over from before we had descriptors and staticmethod, but now
> that we have these things perhaps this difference should go away.

There are several open feature requests about this. It is merely
because PyCFunction does not implement __get__.



-- 
Regards,
Benjamin
___
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] Are PyCFunctions supposed to invisibly consume self when used as a method?

2010-06-11 Thread Guido van Rossum
On Fri, Jun 11, 2010 at 5:41 PM, Benjamin Peterson  wrote:
> 2010/6/11 Brett Cannon :
>> This "magical" ignoring of self seems to extend to any PyCFunction. Is
>> this dichotomy intentional or just a "fluke"? Maybe this is a
>> hold-over from before we had descriptors and staticmethod, but now
>> that we have these things perhaps this difference should go away.
>
> There are several open feature requests about this. It is merely
> because PyCFunction does not implement __get__.

Yeah, but this of course is because before descriptors only Python
functions were special-cased as methods, and there was known code that
depended on this. I'm sure there's even more code that depends on this
today (because there is just more code, period :-).

Maybe we could offer a decorator that adds a __get__ to a PyCFunction though.

-- 
--Guido van Rossum (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] Are PyCFunctions supposed to invisibly consume self when used as a method?

2010-06-11 Thread Brett Cannon
On Fri, Jun 11, 2010 at 18:30, Guido van Rossum  wrote:
> On Fri, Jun 11, 2010 at 5:41 PM, Benjamin Peterson  
> wrote:
>> 2010/6/11 Brett Cannon :
>>> This "magical" ignoring of self seems to extend to any PyCFunction. Is
>>> this dichotomy intentional or just a "fluke"? Maybe this is a
>>> hold-over from before we had descriptors and staticmethod, but now
>>> that we have these things perhaps this difference should go away.
>>
>> There are several open feature requests about this. It is merely
>> because PyCFunction does not implement __get__.
>
> Yeah, but this of course is because before descriptors only Python
> functions were special-cased as methods, and there was known code that
> depended on this. I'm sure there's even more code that depends on this
> today (because there is just more code, period :-).
>
> Maybe we could offer a decorator that adds a __get__ to a PyCFunction though.

Well, staticmethod seems to work just as well.

I'm going to make this my first request for what to change in Py4K. =)

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