[issue1683368] object.__init__ shouldn't allow args/kwds

2015-05-13 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- stage: -> resolved type: -> behavior ___ Python tracker ___ ___ Python-bugs-list mailing list Unsub

[issue1683368] object.__init__ shouldn't allow args/kwds

2014-06-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: Jason, I made some recommendations on this subject in my blog post a few years ago: http://rhettinger.wordpress.com/2011/05/26/super-considered-super/ ''' A more flexible approach is to have every method in the ancestor tree cooperatively designed to accep

[issue1683368] object.__init__ shouldn't allow args/kwds

2014-05-28 Thread Guido van Rossum
Guido van Rossum added the comment: Hrm. I've always thought that the key point of cooperative MI was the term *cooperative*. Consider a regular (non-constructor) method. You must have a common base class that defines this method, and *that* method shouldn't be calling the super-method (becaus

[issue1683368] object.__init__ shouldn't allow args/kwds

2014-05-28 Thread Jason R. Coombs
Jason R. Coombs added the comment: Based on the example above, I've created a blog post to publish my recommendation for overriding these special methods in a way that's safe regardless of the parent implementation, given the status quo: http://blog.jaraco.com/2014/05/how-to-safely-override-in

[issue1683368] object.__init__ shouldn't allow args/kwds

2014-05-28 Thread Jason R. Coombs
Jason R. Coombs added the comment: Maybe I should have focused on a more trivial example to demonstrate the place where my expectation was violated. The use of a real-world example is distracting from my intended point. Consider instead this abstract example: class SomeClass(SomeParentClass):

[issue1683368] object.__init__ shouldn't allow args/kwds

2014-05-28 Thread Guido van Rossum
Guido van Rossum added the comment: Sorry, I didn't realize why __new__ was being used. But what Jason's code is doing isn't any cleaner than monkey-patching. -- ___ Python tracker __

[issue1683368] object.__init__ shouldn't allow args/kwds

2014-05-28 Thread Eric Snow
Eric Snow added the comment: > If you don't know enough about the base class you shouldn't be subclassing it. That's important when overriding any API in subclass and absolutely always essential when it comes to __new__ and __init__! That's something that isn't very obvious at first. :( > In t

[issue1683368] object.__init__ shouldn't allow args/kwds

2014-05-28 Thread Terry J. Reedy
Terry J. Reedy added the comment: >From what I see, you do not need to change either __new__ or __init__, just >add __enter__ and __exit__ , and you only need to do that in 2.6. Since >Zipfile is written in Python, you could monkey-patch instead of subclassing, >if that is easier in your parti

[issue1683368] object.__init__ shouldn't allow args/kwds

2014-05-28 Thread Guido van Rossum
Guido van Rossum added the comment: If you don't know enough about the base class you shouldn't be subclassing it. In this particular case you should be overriding __init__, not __new__. -- ___ Python tracker __

[issue1683368] object.__init__ shouldn't allow args/kwds

2014-05-28 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- Removed message: http://bugs.python.org/msg219255 ___ Python tracker ___ ___ Python-bugs-list mailing

[issue1683368] object.__init__ shouldn't allow args/kwds

2014-05-28 Thread Guido van Rossum
Changes by Guido van Rossum : -- Removed message: http://bugs.python.org/msg219253 ___ Python tracker ___ ___ Python-bugs-list maili

[issue1683368] object.__init__ shouldn't allow args/kwds

2014-05-27 Thread Jason R. Coombs
Jason R. Coombs added the comment: I recently ran into this error again. I was writing this class to provide backward-compatible context manager support for zipfile.ZipFile on Python 2.6 and 3.1: class ContextualZipFile(zipfile.ZipFile): """ Supplement ZipFile class to support context

[issue1683368] object.__init__ shouldn't allow args/kwds

2014-05-27 Thread Jason R. Coombs
Jason R. Coombs added the comment: I recently ran into this error again. I was writing this class to provide backward-compatible context manager support for zipfile.ZipFile on Python 2.6 and 3.1: class ContextualZipFile(zipfile.ZipFile): """ Supplement ZipFile class to support context

[issue1683368] object.__init__ shouldn't allow args/kwds

2013-01-14 Thread Jason R. Coombs
Jason R. Coombs added the comment: Aah. Indeed, that's where I should have looked. Thanks for the pointer. -- ___ Python tracker ___ ___

[issue1683368] object.__init__ shouldn't allow args/kwds

2013-01-14 Thread Terry J. Reedy
Terry J. Reedy added the comment: First, What's New " explains the new features in Python". This issue is a bugfix. AFAIK, object() has always been documented as having no parameters. The fact that passing extra args should raise a TypeError is no secret. Second, this *is* documented. The thir

[issue1683368] object.__init__ shouldn't allow args/kwds

2013-01-14 Thread Jason R. Coombs
Jason R. Coombs added the comment: For reference, I encountered an issue due to this change and didn't quite understand what was going on. I distilled the problem down and posted a question on stack overflow: http://stackoverflow.com/questions/14300153/why-does-this-datetime-subclass-fail-on-p

[issue1683368] object.__init__ shouldn't allow args/kwds

2012-03-16 Thread Benjamin Peterson
Benjamin Peterson added the comment: python-dev is just the name of the robot which notes records changesets. -- ___ Python tracker ___ ___

[issue1683368] object.__init__ shouldn't allow args/kwds

2012-03-16 Thread Guido van Rossum
Guido van Rossum added the comment: Please don't add python-...@python.org to the nosy list. -- nosy: -python-dev ___ Python tracker ___ _

[issue1683368] object.__init__ shouldn't allow args/kwds

2012-03-16 Thread Roundup Robot
Roundup Robot added the comment: New changeset 25b71858cb14 by Benjamin Peterson in branch 'default': make extra arguments to object.__init__/__new__ to errors in most cases (finishes #1683368) http://hg.python.org/cpython/rev/25b71858cb14 -- nosy: +python-dev

[issue1683368] object.__init__ shouldn't allow args/kwds

2010-04-01 Thread Terry J. Reedy
Terry J. Reedy added the comment: @dauerbaustelle I believe your question is a separate issue and that it should have been asked on Python list. However, yes, subclasses of immutables must override __new__. For more, do ask on the list, not here. -- __

[issue1683368] object.__init__ shouldn't allow args/kwds

2010-04-01 Thread dauerbaustelle
dauerbaustelle added the comment: What exactly is the correct solution with Python 2.6 to avoid this warning? My use case is something like class myunicode(unicode): def __init__(self, *args, **kwargs): unicode.__init__(self, *args, **kwargs) self.someattribute = calculate_attribute_

[issue1683368] object.__init__ shouldn't allow args/kwds

2010-02-01 Thread Gregory P. Smith
Gregory P. Smith added the comment: FYI - A discussion on why this change may have been a bad idea and breaks peoples existing code: http://freshfoo.com/blog/object__init__takes_no_parameters -- nosy: +gregory.p.smith ___ Python tracker

[issue1683368] object.__init__ shouldn't allow args/kwds

2009-04-20 Thread Kirit Sælensminde
Changes by Kirit Sælensminde : -- nosy: +KayEss ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.p

[issue1683368] object.__init__ shouldn't allow args/kwds

2008-10-13 Thread Jesús Cea Avión
Changes by Jesús Cea Avión <[EMAIL PROTECTED]>: -- nosy: +jcea ___ Python tracker <[EMAIL PROTECTED]> ___ ___ Python-bugs-list mailin

[issue1683368] object.__init__ shouldn't allow args/kwds

2008-04-14 Thread Guido van Rossum
Changes by Guido van Rossum <[EMAIL PROTECTED]>: -- status: open -> closed _ Tracker <[EMAIL PROTECTED]> _ ___ Python-bugs-list maili

[issue1683368] object.__init__ shouldn't allow args/kwds

2008-04-12 Thread Benjamin Peterson
Benjamin Peterson <[EMAIL PROTECTED]> added the comment: Can this be closed? -- nosy: +benjamin.peterson _ Tracker <[EMAIL PROTECTED]> _

[issue1683368] object.__init__ shouldn't allow args/kwds

2007-08-29 Thread Guido van Rossum
Changes by Guido van Rossum: -- versions: +Python 3.0 _ Tracker <[EMAIL PROTECTED]> _ ___ Python-bugs-list mailing list Unsubscribe: