[issue14965] super() and property inheritance behavior

2021-12-09 Thread Ronny Pfannschmidt


Ronny Pfannschmidt  added the comment:

im on the noisy list because i  faced this first in 2012

a key problem where i ran into this was mixins, - depending on whether a mixin 
was added or not one would get errors or not

from  my pov a super object should look like the "next class"

so properties of the next base should behave as such, special methods as well

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2021-12-08 Thread Aaron Gallagher

Aaron Gallagher <_...@habnab.it> added the comment:

I will note, Raymond, that I’ve wanted this for years before discovering
this bpo issue, and I found it because you linked it on Twitter. ;)

On Wed, Dec 8, 2021 at 19:08 Raymond Hettinger 
wrote:

>
> Raymond Hettinger  added the comment:
>
> Another thought:  Given that this tracker issue has been open for a decade
> without resolution, we have evidence that this isn't an important problem
> in practice.
>
> Arguably, people have been better off being nudged in another direction
> toward better design or having been forced to be explicit about what method
> is called and when.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2021-12-08 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Another thought:  Given that this tracker issue has been open for a decade 
without resolution, we have evidence that this isn't an important problem in 
practice.

Arguably, people have been better off being nudged in another direction toward 
better design or having been forced to be explicit about what method is called 
and when.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2021-12-08 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

-0 from me as well.  I don't think this is common or something that should be 
encouraged.  As Andrew points out, "del super().x" doesn't have an obvious 
meaning and it could be regarded as a code smell.

The OP's first example would be an unpleasant API to debug -- it exhibits tight 
coupling between the parent and child class, it has Liskov issues, and it has 
implicit forwarding and indirection through descriptors.  The tight coupling is 
especially problematic because Python's super() isn't guaranteed to call the 
parent class; rather, it can call a sibling class as determined by the MRO 
which cannot be known at the time the class is written.

Another thought is that super() is intentionally not a completely transparent 
proxy.  While an explicit call super().__getitem__(k) works, we've denied 
support for super()[k].  To me, "super().x = 10" and "del super().x" fall in 
the same category.

Looking at the OP's 

Fortunately, it doesn't seem to be a common need to use super() in a property 
setter or deleter to bypass the current class and call setter or deleter in a 
parent class property.  Arguably, this kind of tight coupling isn't good 
design.  The OP's first example would be an unpleasant API to debug.

FWIW,

--
nosy: +rhettinger
versions:  -Python 3.10, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2021-12-06 Thread Markus Kitsinger (he/him/his)


Change by Markus Kitsinger (he/him/his) :


--
nosy: +SwooshyCueb
nosy_count: 23.0 -> 24.0
pull_requests: +28175
pull_request: https://github.com/python/cpython/pull/29950

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2021-05-28 Thread Aaron Gallagher


Aaron Gallagher <_...@habnab.it> added the comment:

@daniel.urban would you kindly resubmit your patch as a PR to the cpython repo? 
I've learned out-of-band from someone else that putting patches on bpo is 
considered obsolete. you can use the PR I've submitted 
(https://github.com/python/cpython/pull/26194) and reset the author. 

I'd be happy to do it myself (giving you a branch that's all set up, so all you 
need to do is click the 'new PR' button) if you tell me what to set the author 
to.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2021-05-20 Thread Will Razen


Will Razen  added the comment:

Fixed superprop.py workaround, now works with multiple inheritance and follows 
mro adequately. Renamed to duper.py as inspired by Torsten. Uploading here and 
also to https://gist.github.com/willrazen/bef3fcb26a83dffb6692e5e10d3e67ac

--
Added file: https://bugs.python.org/file50057/duper.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2021-05-20 Thread Daniel Urban


Daniel Urban  added the comment:

@habnabit I believe I've already signed some contributor form some years ago. 
If there is a new one, I can sign that one too.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2021-05-20 Thread Will Razen


Will Razen  added the comment:

@simonzack Your superprop.py doesn't work for multiple inheritance, because 
you're using __thisclass__.__mro__ in each step instead of the initial object 
mro

--
nosy: +willrazen

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2021-05-17 Thread Aaron Gallagher


Aaron Gallagher <_...@habnab.it> added the comment:

@daniel.urban I'm attempting to move this patch along, but since the 
contributing process has changed in the years since your patch, you'll need to 
sign the CLA. Are you interested in picking this back up at all? I haven't been 
given any indication of how to proceed if I'm doing this on your behalf, but 
hopefully the core team will enlighten us.

--
nosy: +habnabit

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2021-05-17 Thread Aaron Gallagher


Change by Aaron Gallagher :


--
nosy: +Aaron Gallagher
nosy_count: 20.0 -> 21.0
pull_requests: +24811
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/26194

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2021-05-04 Thread wyz23x2


Change by wyz23x2 :


--
components: +Interpreter Core -Extension Modules
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2021-04-24 Thread Victor Milovanov


Victor Milovanov  added the comment:

There's a patch attached to this bug. Why is its stage "needs patch"?

--
nosy: +Victor Milovanov

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2017-03-22 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
versions: +Python 3.7 -Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2017-03-20 Thread Ken Odegard

Changes by Ken Odegard :


--
nosy: +njalerikson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2017-02-04 Thread irdb

Changes by irdb :


--
nosy: +irdb

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2016-09-11 Thread Christian Heimes

Christian Heimes added the comment:

I had to add a workaround to ssl.SSLContext and would appreciate a better 
solution.

--
nosy: +christian.heimes

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2016-09-11 Thread Joseph L. Casale

Changes by Joseph L. Casale :


--
nosy: +jcasale

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2016-09-08 Thread Ethan Furman

Changes by Ethan Furman :


--
nosy: +ethan.furman

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2015-02-04 Thread Piotr Dobrogost

Changes by Piotr Dobrogost p...@bugs.python.dobrogost.net:


--
nosy: +piotr.dobrogost

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14965
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2014-12-27 Thread Simon Zack

Simon Zack added the comment:

For those who want to use this right away, I've added a python implementation 
of the patch, which passes the unit tests. There's a slight difference in 
usage, where instead of using super() directly, super_prop(super()) needs to be 
used, so we can still use super without arguments.

--
Added file: http://bugs.python.org/file37546/superprop.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14965
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2014-12-10 Thread Simon Zack

Simon Zack added the comment:

+1 to this feature, this will dramatically simplify property setting code.

--
nosy: +simonzack

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14965
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2014-01-31 Thread Yury Selivanov

Changes by Yury Selivanov yselivanov...@gmail.com:


--
versions: +Python 3.5 -Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14965
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2013-03-21 Thread florian-rathgeber

Changes by florian-rathgeber florian.rathge...@gmail.com:


--
nosy: +florian-rathgeber

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14965
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2013-01-06 Thread David Beazley

David Beazley added the comment:

Just as a note, there is a distinct possibility that a property in a 
superclass could be some other kind of descriptor object that's not a property. 
 To handle that case, the solution of

super(self.__class__, self.__class__).x.fset(self, value)

would actually have to be rewritten as

super(self.__class__, self.__class__).x.__set__(self, value)

That said, I agree it would be nice to have a simplified means of accomplishing 
this.

--
nosy: +dabeaz

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14965
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2012-11-05 Thread Andrew Svetlov

Andrew Svetlov added the comment:

I would say

@x.deleter
def x(self):
del super().x

confuses me a bit. 
But I'm only -0, let's see other developers for their opinions.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14965
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2012-11-04 Thread 猫 黒

猫 黒 added the comment:

I'm not a python dev, but would you say

super(self.__class__, self.__class__).x.fset(self, value)

is more readable than

super().x = value

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14965
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2012-11-01 Thread Andrew Svetlov

Andrew Svetlov added the comment:

I'm -0 for proposed changes, these changes reduce code readability from my 
perspective.
I think better to use existing approach: explicitly specify what do you want to 
do with overloaded properties.

--
nosy: +asvetlov

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14965
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2012-10-30 Thread Ronny Pfannschmidt

Changes by Ronny Pfannschmidt ronny.pfannschm...@gmail.com:


--
nosy: +Ronny.Pfannschmidt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14965
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2012-08-24 Thread Chris Rebert

Changes by Chris Rebert pyb...@rebertia.com:


--
nosy: +cvrebert

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14965
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2012-08-22 Thread Torsten Landschoff

Torsten Landschoff added the comment:

I stumbled across this omission as well in 2010 and brought this up on 
python-dev:

http://mail.python.org/pipermail/python-dev/2010-April/099672.html

There were no replies, but perhaps my post adds a bit of information and also 
there is another patch linked from there. I attached my patch from 2010 for 
reference.

--
nosy: +torsten
Added file: http://bugs.python.org/file26966/44560_44559.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14965
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2012-06-04 Thread Daniel Urban

Daniel Urban urban.dani...@gmail.com added the comment:

I'm attaching a patch implementing super.__setattr__ (and __delattr__).

The implementation in the patch only works, if super can find a data descriptor 
in the MRO, otherwise it throws an AttributeError. As it can be seen in the 
tests, in some cases this may result in counter-intuitive behaviour. But I 
wasn't able to find another behaviour, that is consistent with both 
super.__getattr__ and normal __setattr__ semantics.

--
keywords: +patch
nosy: +daniel.urban
Added file: http://bugs.python.org/file25820/super_setattr.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14965
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2012-06-04 Thread Daniel Urban

Changes by Daniel Urban urban.dani...@gmail.com:


--
components: +Extension Modules -Library (Lib)

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14965
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2012-06-01 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


--
nosy: +ncoghlan

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14965
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2012-05-31 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +eric.araujo
stage:  - needs patch
versions: +Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14965
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2012-05-31 Thread josmiley

josmiley joel-murie...@sfr.fr added the comment:

 class DerivedProp(BaseProp):
... @property
... def p(self):
... return super(DerivedProp, self).p * 2
... @p.setter
... def p(self, value):
... BaseProp.p.__set__(self,value / 2)

--
nosy: +josmiley

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14965
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2012-05-30 Thread 猫 黒

New submission from 猫 黒 cyberdup...@gmail.com:

super() objects allow access to inherited properties fget() but not fset() or 
fdel(), resulting in unexpected behavior.

Today on pydev thread 'Property inheritance in Python' GvR said I
don't see the need for a Python-Ideas detour. It seems worth fixing

 class BaseProp(object):
... @property
... def p(self):
... return self._p
... @p.setter
... def p(self, value):
... self._p = value
 class DerivedProp(BaseProp):
... @property
... def p(self):
... return super(DerivedProp, self).p * 2
... @p.setter
... def p(self, value):
... super(DerivedProp, self).p = value / 2
 d = DerivedProp()
 d._p = 21
 d.p
42
 d.p = 50
Traceback (most recent call last):
   ...
AttributeError: 'super' object has no attribute 'p'

--
components: Library (Lib)
messages: 161980
nosy: 猫.黒
priority: normal
severity: normal
status: open
title: super() and property inheritance behavior
type: behavior
versions: Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14965
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2012-05-30 Thread Alex Gaynor

Changes by Alex Gaynor alex.gay...@gmail.com:


--
nosy: +alex

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14965
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com