Nathaniel Smith wrote: > I.e., BIN_ADD could do > > if (Py_REFCNT(left) == 1) > result = PyNumber_InPlaceAdd(left, right); > else > result = PyNumber_Add(left, right) > > Upside: all packages automagically benefit! > > Potential downsides to consider: > - Subtle but real and user-visible change in Python semantics. That would be a real worry. Even if such cases were rare, they'd be damnably difficult to debug when they did occur. I think for safety's sake this should only be done if the type concerned opts in somehow, perhaps by a tp_flag indicating that the type is eligible for temporary elision. -- Greg
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4