New submission from Stefan Behnel:
fractions.gcd() is required for normalising numerator and denominator of the
Fraction data type. Some speed improvements were applied to Fraction in issue
22464, now the gcd() function takes up about half of the instantiation time in
the benchmark in issue
Stefan Behnel added the comment:
I created issue 22486 about the gcd() performance. I think we can close this
ticket - I don't see any more obvious low hanging fruit and future findings can
have their own ticket.
Out of interest, I modified the fractions module to compile Fraction
Wolfgang Maier schrieb am 23.09.2014 um 18:38:
While at first I thought this to be a rather irrelevant debate over module
private vs public naming conventions, I now think the OP is probably right
and renaming fractions.gcd to fractions._gcd may be a good idea.
Making a public API private is
blindanagram schrieb am 23.09.2014 um 19:43:
On 23/09/2014 18:26, Stefan Behnel wrote:
Wolfgang Maier schrieb am 23.09.2014 um 18:38:
While at first I thought this to be a rather irrelevant debate over module
private vs public naming conventions, I now think the OP is probably right
Ian Kelly schrieb am 23.09.2014 um 19:39:
On Tue, Sep 23, 2014 at 11:26 AM, Stefan Behnel wrote:
Wolfgang Maier schrieb am 23.09.2014 um 18:38:
While at first I thought this to be a rather irrelevant debate over module
private vs public naming conventions, I now think the OP is probably right
Stefan Behnel added the comment:
This simple Cython variant of gcd() is substantially faster for me (you may
consider it pseudo-code for a C implementation):
def _gcd(a, b):
# Try doing all computation in C space. If the numbers are too large
# at the beginning, retry until
New submission from Stefan Behnel:
Fractions are great for all sorts of exact computations (including
money/currency calculations), but are quite slow due to the need for
normalisation at instantiation time.
I adapted the existing telco benchmark to use Fraction instead of Decimal to
make
Stefan Behnel added the comment:
I just thought that it might also be nice to have a direct comparison with
Decimal, so here's an updated benchmark that has an option --use-decimal to
run the same code with Decimal instead of Fraction.
Decimal is about 66x faster with Py3.4 on my side (due
Stefan Behnel added the comment:
As I said, where ever exact calculations are needed. I use them for currency
calculations, for example, as they inherently avoid rounding errors during the
calculations regardless of the relative size of values. They are basically like
Decimal
Stefan Behnel added the comment:
I admit that I keep meeting developers who are not aware of their merits,
simply because many other programming languages don't have them available.
Specifically, many developers with a Java background firmly believe that
BigDecimal is the only way to do money
New submission from Stefan Behnel:
Fractions are an excellent way to do exact money calculations and largely beat
Decimal in terms of simplicity, accuracy and safety. Clearly not in terms of
speed, though.
The current implementation does some heavy type checking and dispatching in
__new__
Stefan Behnel added the comment:
Speed improvements for fractions should have their own ticket(s). I created
issue 22464 for this.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22458
Stefan Behnel added the comment:
Adding Mark Dickinson to the noisy list who mentioned having worked on a C
implementation for gcd(). I think this would be a good thing to try. However,
the most important part would be to restructure and specialise
Fraction.__new__().
--
nosy
Stefan Behnel added the comment:
Here is a straight forward patch that special cases int values in the
constructor. It gives me a 35% speedup in the benchmark.
--
keywords: +patch
Added file: http://bugs.python.org/file36687/special_case_int.patch
Changes by Stefan Behnel sco...@users.sourceforge.net:
--
type: - performance
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22464
___
___
Python
Stefan Behnel added the comment:
Updated patch - there is a somewhat hidden attempt in the code to keep
nominator and denominater plain int values, not subtypes. That means that it's
safer to restrict the optimisation to plain ints as well, which should still
hit 95% of the use cases
Changes by Stefan Behnel sco...@users.sourceforge.net:
Added file: http://bugs.python.org/file36689/special_case_int3.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22464
Stefan Behnel added the comment:
The second isn't a big difference because it only hits plain instantiations
from integers. They are less likely to be performance critical than those from
a quotient, which happen for all calculations.
It's more for symmetry, I guess
Stefan Behnel added the comment:
I found one more place where special casing helps: equal comparisons to
integers, e.g. f == 0 or f == 1 or so. timeit shows me a speedup by a factor of
three for this, with only a tiny slow-down when comparing fractions on both
sides.
I put all of them in one
Stefan Behnel added the comment:
Benchmark profile after the patch:
5930670 function calls (5930288 primitive calls) in 3.748 seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
5196320.8280.0000.8280.000
Stefan Behnel added the comment:
Here is another little optimisation that removes the redundant property lookups
for the denominator in __add__() and __sub__().
New profile:
5291182 function calls (5290800 primitive calls) in 3.596 seconds
Ordered by: internal time
ncalls
George Silva schrieb am 15.09.2014 um 21:49:
It's pretty useful. I use it for some time now and I very much like it.
[...]
The most powerful for me are the rename refactor and extract. Works like
charm (no pun intended).
Dito.
On Mon, Sep 15, 2014 at 4:44 PM, Skip Montanaro s...@pobox.com
Skip Montanaro schrieb am 12.09.2014 um 17:52:
I have slowly been converting some Python source to Cython. I'm pretty
conservative in what changes I make, mostly sprinkling a few cdef,
float and int declarations around the pyx file. Still, conservative or
not, it's enough to choke pylint.
Stefan Behnel added the comment:
Agreed that it's not a bug in CPython, but my guess is that it's not a bug in
NumPy either. The C function you call (which IIRC creates a new NumPy array)
almost certainly needs the GIL to protect it against race conditions, and since
you mentioned OpenMP, you
Stefan Behnel added the comment:
Yes, please. The sequential build in distutils is very annoying.
(too late for Py3.4, though, I guess...)
--
nosy: +scoder
versions: +Python 3.5 -Python 3.4
___
Python tracker rep...@bugs.python.org
http
Stefan Behnel added the comment:
Is this superseded by issue 22194 now or the other way round?
--
nosy: +scoder
versions: +Python 3.5 -Python 3.4
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15237
Changes by Stefan Behnel sco...@users.sourceforge.net:
--
nosy: +scoder
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7946
___
___
Python-bugs
Stefan Behnel added the comment:
CPython 3.5, latest development versions. This started failing on August 21st,
presumably with the changes for issue 22118.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22311
Stefan Behnel added the comment:
I noticed this, too. I think it's due to the urllib changes in issue 22118.
--
components: +Library (Lib)
nosy: +pitrou, scoder
type: - behavior
___
Python tracker rep...@bugs.python.org
http://bugs.python.org
Changes by Stefan Behnel sco...@users.sourceforge.net:
--
nosy: -scoder
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20035
___
___
Python-bugs
New submission from Stefan Behnel:
longintrepr.h is a non-public header file (not included by Python.h) that
defines the inner struct layout of PyLong objects. Including it allows for very
fast access to small integers through ob_digit[0] when -1 = Py_SIZE(n) = 1,
which is a great feature
Stefan Behnel added the comment:
Were the tests in
http://bugs.python.org/file32591/urischemes.py
merged yet, that Nick Coghlan mentioned in
http://bugs.python.org/issue22118#msg225662 ?
--
___
Python tracker rep...@bugs.python.org
http
Stefan Behnel added the comment:
Stefan (Behnel), could you comment on the strategy that you had in mind?
Is it similar to module_get_symbol.diff or entirely different?
I agree with Antoine that a Capsule would work better here (and yes, the
performance problem of capsules is only with cases
dieter schrieb am 22.08.2014 um 08:12:
David Palao writes:
Why to use C++ instead of python?
Likely, you would not use Python to implement most parts of an
operating system (where, for efficiency reasons, some parts
are even implemented in an assembler language).
I can imagine that the
Robin Becker schrieb am 22.08.2014 um 17:50:
I'm trying to build a bunch of extensions in a 2.7 virtual environment on a
centos 7 VM. I don't know centos very well and I understand centos 7 is
quite new
building 'lxml.etree' extension
creating build/temp.linux-x86_64-2.7
creating
If you want to add Cython to that (overly simplified) graph, you might get
something like this:
Christian Gollwitzer schrieb am 22.08.2014 um 21:25:
as |--|
c ||
c++ |---|
Cython ||
python
Stefan Behnel added the comment:
I'm now getting duplicated slashes in URLs, e.g.:
https://new//foo.html
http://my.little.server/url//logo.gif
In both cases, the base URL that gets joined with the postfix had a trailing
slash, e.g.
http://my.little.server/url/; + logo.gif -
http
Stefan Behnel added the comment:
(for the record, the context is that we would like to support decimal objects
efficiently in Numba)
Same for Cython, although I guess we wouldn't do more than shipping the
necessary declarations and (likely) also enable auto-coercion between the
libmpdec
Stefan Behnel added the comment:
The current implementation doesn't work with Unicode file paths. Try passing a
Unicode string e.g. as cafile into context.load_verify_locations(). It calls
PyString_AsEncodedObject() on it, which then fails with a PyErr_BadArgument()
on the entry type check
Steven D'Aprano schrieb am 17.08.2014 um 16:21:
I wonder whether Ruby programmers are as obsessive about
Ruby's GIL?
I actually wonder more whether Python programmers are really all that
obsessive about CPython's GIL. Sure, there are always the Loud Guys who
speak up when they feel like
Stefan Behnel added the comment:
FWIW, functions in Cython (which C-level-inherit from PyCFunction) support weak
references just fine. Adding that as a general feature to PyCFunction sounds
like the right thing to do.
--
nosy: +scoder
___
Python
Stefan Behnel added the comment:
Patch looks ok. Not sure about the test dependency from test_weakref.py to
_testcapi, though. Is that module allowed to be used everywhere? Wouldn't it be
enough to test that one of the builtin functions is now weak referencible?
len seems to be used in other
Stefan Behnel added the comment:
Looks like a duplicate of issue 17781. Ubuntu already does this for their
builds and gets substantially better performance, so I can't see a reason why
CPython shouldn't just follow.
--
nosy: +scoder
___
Python
Stefan Behnel added the comment:
Even if there is no way to explicitly request a RO buffer, the Py_buffer struct
that you get back actually tells you if it's read-only or not. Shouldn't that
be enough to enable this optimisation?
Whether or not implementors of the buffer protocol set
Stefan Behnel added the comment:
Ok. This has been idling long enough to just close it.
--
resolution: - rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14121
Stefan Behnel added the comment:
you'd be surprised how much cheaper indexing a sequence is relative to
dictionary access
This is a bit off-topic (and I realise that this ticket is closed now), but the
difference isn't really all that large:
$ python3.4 -m timeit -s 'seq = list(range(1000
CM, 28.06.2014 05:57:
Now type
nuitka --recurse-all something_or_other.py
and hit Enter. What happens?
I did that and the message is:
'nuitka' is not recognized as an internal
or external command, operable program or batch file.
which makes sense because some kind of
Steven D'Aprano, 26.06.2014 04:56:
On Wed, 25 Jun 2014 14:12:31 -0700, Maciej Dziardziel wrote:
Floating points values use finite amount of memory, and cannot
accurately represent infinite amount of numbers, they are only
approximations. This is limitation of float type and applies to any
Stefan Behnel added the comment:
Your code adds a lot of new code. Why is that necessary? Can't the new feature
be integrated into the existing code?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20928
Stefan Behnel added the comment:
I tried the same with a Cython compiled version of select.py in the latest
CPython 3.5 build. It pretty clearly shows that select2 is pretty much always
faster than sorting, by a factor of 2-5x or so. I'll also attach the annotated
source file that Cython
Changes by Stefan Behnel sco...@users.sourceforge.net:
Added file: http://bugs.python.org/file35427/select.html
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21592
Stefan Behnel added the comment:
Here's also the pathological average of three calls case. As Steven suggests,
it shows that select() suffers quite heavily (algorithmically), but select2()
also suffers enough to jump up to about 2/3 of the runtime of sorting (so it's
still 1/3 faster even
Stefan Behnel added the comment:
Updating the type declaration file to remove the dependency on the list builtin
and allow arbitrary containers. The test code has this dependency (calls
a.sort()), but the current statistics module in the stdlib does not (calls
sorted()). Timings do not change
Changes by Stefan Behnel sco...@users.sourceforge.net:
Added file: http://bugs.python.org/file35430/select.html
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21592
Johannes Bauer, 31.05.2014 13:09:
Lucky for you 2.7.5 isn't all that different from Py3 and most of it
will apply. You'll be missing out on a bunch of cool features (arbitrary
precision ints
Py2 has them as well (although they are called long). 1 300 gives the
right answer in both Py2 and
Lakshmipathi.G, 28.05.2014 12:22:
I have C-Python api like below. It works fine, but the problem is
while invoking this method
from python script say
#cat script.py
snip
offset=0
size=4
write_object(offset,size)
/snip
This calls write_this_c() C api and returns quickly to next
Terry Reedy, 29.05.2014 02:41:
On 5/28/2014 3:23 PM, Larry Martell wrote:
Somthing I came across in my travels through the ether:
https://medium.com/@deliciousrobots/5d2ad703365d/
Claim: Python 3 languishes in disuse.
Fact: in 2013, there were around 14 million downloads of windows
Ben Finney, 26.05.2014 05:20:
bookaa bookaa writes:
Generally, people consider Python as a script language.
It has high development efficiency
but run too slowly
Which Python implementation are you talking about? Run time is not a
property of the language. It is a property of the language
Roy Smith, 24.05.2014 01:57:
I installed and ran caniusepython3. It tells me:
Finding and checking dependencies ...
[WARNING] rpclib not found
You need 19 projects to transition to Python 3.
Of those 19 projects, 17 have no direct dependencies blocking their
transition:
beanstalkc
bookaa bookaa, 25.05.2014 10:17:
I think the significance of Python to Go, is it give us opportunity to
make Python project run fast.
You shouldn't make that your only goal, because you'll have a really hard
time achieving it (to put it mildly).
Stefan
--
Devin Jeanpierre, 24.05.2014 18:03:
On Sat, May 24, 2014 at 2:59 AM, Marko Rauhamaa wrote:
blindanagram:
Instead of focusing on bringing legacy libraries to Python3 (for which
there never seems to be a critical need), Python3 needs a brand new
killer module/application/library that is only
Roland Plüss, 20.05.2014 19:17:
PyObject * const loadedModule = Py_InitModule3( fullname, NULL, Loaded
module );
PyObject * const moduleDict = PyModule_GetDict( loadedModule ); //
borrowed reference
PyDict_SetItemString( moduleDict, __builtins__, PyEval_GetBuiltins() );
PyRun_StringFlags(
Roland Plüss, 17.05.2014 02:27:
I'm using Python in an embedded situation. In particular I have to load
python scripts through a memory interface so regular python module
loading can not be used. I got working so far a module loader object
I've added using C++ to sys.meta_path . Now I'm
Roland Plüss, 17.05.2014 15:00:
On 05/17/2014 01:58 PM, Stefan Behnel wrote:
Roland Plüss, 17.05.2014 02:27:
I'm using Python in an embedded situation. In particular I have to load
python scripts through a memory interface so regular python module
loading can not be used. I got working so far
Hi,
please avoid top-posting.
Roland Plüss, 17.05.2014 15:49:
On 05/17/2014 03:26 PM, Stefan Behnel wrote:
Roland Plüss, 17.05.2014 15:00:
On 05/17/2014 01:58 PM, Stefan Behnel wrote:
Roland Plüss, 17.05.2014 02:27:
I'm using Python in an embedded situation. In particular I have to load
Roland Plüss, 17.05.2014 17:28:
On 05/17/2014 04:01 PM, Stefan Behnel wrote:
Roland Plüss, 17.05.2014 15:49:
On 05/17/2014 03:26 PM, Stefan Behnel wrote:
Roland Plüss, 17.05.2014 15:00:
On 05/17/2014 01:58 PM, Stefan Behnel wrote:
Roland Plüss, 17.05.2014 02:27:
I'm using Python
Roland Plüss, 17.05.2014 18:28:
On 05/17/2014 05:49 PM, Stefan Behnel wrote:
Roland Plüss, 17.05.2014 17:28:
On 05/17/2014 04:01 PM, Stefan Behnel wrote:
Roland Plüss, 17.05.2014 15:49:
On 05/17/2014 03:26 PM, Stefan Behnel wrote:
Roland Plüss, 17.05.2014 15:00:
On 05/17/2014 01:58 PM
lgabiot, 12.05.2014 07:33:
Le 11/05/14 17:40, lgabiot a écrit :
I guess if my calculation had to be performed on a small number of
samples (i.e. under the value of the Pyaudio buffer size (2048 samples
for instance), and that the calculation would last less than the time it
takes to get the
esaw...@gmail.com, 10.05.2014 19:07:
Let me state at the start that I am new to Python. I am moving away from
Fortran and Matlab to Python and I use all different types of numerical and
statistical recipes in my work. I have been reading about NumPy and SciPy and
could not find any
Stefan Behnel added the comment:
The avoid rebuilding part doesn't seem to work for me. Source build currently
fails as follows:
/bin/mkdir -p Include
python ./Parser/asdl_c.py -h Include ./Parser/Python.asdl
# Substitution happens here, as the completely-expanded BINDIR
# is not available
Stefan Behnel added the comment:
That fixes it. Thanks!
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19655
___
___
Python-bugs-list mailing
Chris Angelico, 09.05.2014 11:02:
On Fri, May 9, 2014 at 6:59 PM, Percy Tambunan wrote:
Hai, I would like to parse this multiple root element XML
Easy fix might be to wrap it in root and /root, which will give
you a new root.
ElementTree's XMLParser() can be use efficiently for this.
Marko Rauhamaa, 09.05.2014 14:38:
Marko Rauhamaa:
Alain Ketterlin:
Marko Rauhamaa writes:
Sometimes the XML elements come through a pipe as an endless
sequence. You can still use the wrapping technique and a SAX parser.
However, the other option is to write a tiny XML scanner that
Marko Rauhamaa, 09.05.2014 20:04:
I think the worst part of XML is that you can't parse it without a DTD
or schema.
Nonsense.
I was very hopeful about json until I discovered they require the parser
to dynamically support five different character encodings.
XML at least standardized on
Burak Arslan, 09.05.2014 18:52:
On 05/09/14 16:55, Stefan Behnel wrote:
ElementTree has gained a nice API in
Py3.4 that supports this in a much saner way than SAX, using iterators.
Basically, you just dump in some data that you received and get back an
iterator over the elements
Stefan Behnel added the comment:
LGTM, can't see a case where this might go wrong (errors and type checks are
handled before the added code).
It also seems a sufficiently common case to optimise it internally. The 2**n
spelling is easier to read and to get right than the shifting, so it's
Stefan Behnel added the comment:
Works for me in 3.2 and 3.4, fails in 2.7, as reported.
I'll leave it to Eli to decide if this should get fixed in 2.7. In Py2, ET and
cET were different modules, so this could also be considered a missing feature
in cET. Given that it leads to a serialisation
Stefan Behnel added the comment:
Ah, sorry, actually, it does not work in Py3.2:
import xml.etree.cElementTree as cET
root = cET.Element('root', attrib={'Name':'Root'})
child = cET.SubElement(root, 'child', attrib={'Name':'Child'})
cET.tostring(root)
b'root attrib={\'Name\': \'Root\'}child
Stefan Behnel added the comment:
According to issue 1572710, this is not a bug. The attrib argument is
supposed to be a positional argument, not a keyword argument. This makes sense,
given that arbitrary keyword arguments are accepted for additional XML
attributes
Stefan Behnel added the comment:
Note that this has been fixed in Py3 already (Py3.3, I guess). The only
question is whether the behaviour will be changed in Py2.7.
--
components: -XML
___
Python tracker rep...@bugs.python.org
http
Stefan Behnel added the comment:
You can already use iterparse for this.
it = ET.iterparse('somefile.xml')
for _, el in it:
el.tag = el.tag.split('}', 1)[1] # strip all namespaces
root = it.root
As I said, this would be a little friendlier with support in the QName class
Stefan Behnel added the comment:
@gene_wood: that's unrelated. This ticket is about attributes being rejected
incorrectly.
Fixing the example of the OP:
from xml.etree.ElementTree import *
svg = ElementTree(XML(
... svg width=12cm height=4cm viewBox=0 0 1200 400
xmlns=http://www.w3.org
Sturla Molden, 11.04.2014 11:17:
Joshua Landau wrote:
However, if this really is your major blocker to using Python, I
suggest compiling with Cython.
Cython restains all the code as text, e.g. to readable generate exceptions.
No, it actually doesn't. It only keeps the code in C comments,
Stefan Behnel added the comment:
Add all the element methods to the elementtree object.
Ok, but why? An ElementTree object *is not* an Element. It's a
representation of a document that *has* a root Element.
It makes sense for a document to allow searches over its content, and the
ElementTree
Stefan Behnel added the comment:
I don't see any benefit from having this code fail:
from xml.etree.ElementTree import parse
catalog = parse('books.xml')
for book in catalog:
print book.get('id')
Why would you expect it to work? And how?
Why would it only iterate
Stefan Behnel added the comment:
How about just making a sensibly-behaving __iter__ for ElementTree?
Well, the problem is to determine what sensibly-behaving is. I can see
three options.
1) tree.iter() == tree.getroot().iter()
2) iter(tree.getroot())
3) iter([tree.getroot()])
The second
Stefan Behnel added the comment:
I think you attached the wrong file.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20375
___
___
Python-bugs
Stefan Behnel added the comment:
catalog = xml.etree.ElementTree.parse('books.xml')
# This succeeds
for book in catalog.findall('book'):
print(book.tag)
This is a bit of a convenience break in the API. The normal way to do it
would be either catalog.getroot().findall('book
Stefan Behnel added the comment:
Agreed that this should be done. The XInclude spec suggests that the processing
is transitive. Also, lxml does it that way, in both the libxml2 based
implementation and the ElementInclude compatibility module.
https://github.com/lxml/lxml/blob/master/src/lxml
Barry Scott, 11.03.2014 22:37:
On 5 Mar 2014, at 00:14, Bill wrote:
I can't figure out how to create an instance
of a python class from 'C++':
Why not use pycxx from http://sourceforge.net/projects/cxx/?
This lib does all the heavy lifting for you for both python2 and python3.
Has docs
Stefan Behnel added the comment:
My latest status is that a decision on the future of the parser argument is
still pending. See #20219.
It's correctly deprecated in the sense that passing any previously existing
parser isn't going to be supported anymore, but passing an XMLPullParser (which
Juraj Ivančić, 04.03.2014 16:23:
Just for reference, it is doable in pure Python, with ctypes help
For some questionable meaning of pure.
Stefan
--
https://mail.python.org/mailman/listinfo/python-list
Haven't seen any mention of it on this list yet, but since it's such an
obvious flaw in quite a number of programming languages, here's a good
article on the recent security bug in iOS, which was due to accidentally
duplicated code not actually being as indented as it looked:
graeme.piete...@gmail.com, 24.02.2014 10:45:
I am building HTML pages using ElementTree.
I need to insert chunks of untrusted HTML into the page. I do not need or
want to parse this, just insert it at a particular point as is.
How would you want to find out if it can be safely inserted or not
Stefan Behnel added the comment:
I tested it and it works, so I could take the simple route now and say yes, it
fixes the problem, but it's actually no longer required because I already
added a __signature__ property to Cython's functions. However, as Yury noted,
that's a hack because
Changes by Stefan Behnel sco...@users.sourceforge.net:
--
nosy: +scoder
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20632
___
___
Python-bugs
Stefan Behnel added the comment:
inspect.isbuiltin() returns False
Are you absolutely sure about this?
Yes.
Oh, well...
isbuiltin(cyfunction) *does* return False. However,
ismethoddescriptor(cyfunction) returns True, because Cython's functions bind as
methods and thus have a __get__
Stefan Behnel added the comment:
BTW, ismethoddescriptor() is an exceedingly broad test, IMHO. I wonder if it
should even be relied upon for anything in inspect.py.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17159
Stefan Behnel added the comment:
Since this is a problem in Cython, not in CPython, maybe you can fix it in
Cython?
I'm actually considering that. Now that Signature.from_function() allows
function-like types, it appears like it's the easiest solution to add a
__signature__ property
Stefan Behnel added the comment:
Oh, sound like a big hack.
Well, it's certainly a bunch of overhead (even assuming that inspect will
most likely be imported already - just looked it up in import.c, there's
lots of useless generic code there), with a lot of potential for something
going wrong
901 - 1000 of 3085 matches
Mail list logo