Simon Percivall added the comment:
Any and all code from astunparse is certainly available for inclusion. Go ahead.
--
nosy: +simon.percivall
___
Python tracker
<https://bugs.python.org/issue28
Simon Percivall added the comment:
It think it's important to document this caveat in `get_type_hints`, that there
is virtually _no_ way to use it safely with a class, and that there will always
be a high risk of getting an exception unless using this function in a highly
controlled setting
New submission from Simon Percivall:
For classes with ForwardRef annotations, typing.get_type_hints is unusable.
As example, we have two files:
a.py:
class Base:
a: 'A'
class A:
pass
b.py:
from a import Base
class MyClass(Base):
b: 'B'
class B:
pass
>>> from typi
Simon Percivall added the comment:
Run this a couple of times (it fails for me the first time, but it's a race, so
YMMV):
```
import enum
from concurrent.futures import ThreadPoolExecutor
class MyEnum(enum.IntFlag):
one = 1
with ThreadPoolExecutor() as executor:
print(list
New submission from Simon Percivall:
When called by `_create_pseudo_member_()`, the dictionary iteration of
`_value2member_map` in `_decompose()` in enum.py may lead to a "RuntimeError:
dictionary changed size during iteration". For me, it happened in `re.compile`.
```
Traceback (m
Simon Percivall [EMAIL PROTECTED] added the comment:
It's still a problem, as the test case demonstrates.
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2074
__
___
Python-bugs
New submission from Simon Percivall:
_safe_repr() tries to handle the case where two objects are unorderable by
ordering on (str(type(key)), key, value), but this fails when
str(type(key)) is equal for two objects, but key is different and
unorderable. Easy fix: order just on the string
Simon Percivall added the comment:
It has to do with the MACOSX_DEPLOYMENT_TARGET. If it's set to 10.4, the
legacy version of setpgrp is used (with args), it it's 10.5, setpgrp
expects no arguments. It seems configure won't detect the difference.
--
nosy: +percivall
On Jul 12, 11:47 am, Sanjay [EMAIL PROTECTED] wrote:
Hi All,
Using pytz, I am facing a problem with Asia/Calcutta, described below.
Asia/Calcutta is actually IST, which is GMT + 5:30. But while using
pytz, it was recognized as HMT (GMT + 5:53). While I digged into the
oslan database, I see
On Jul 12, 2:35 am, [EMAIL PROTECTED] wrote:
On Jul 11, 7:32 pm, [EMAIL PROTECTED] wrote:
I have just started working in network programming using python.
written code for socket connection between client and server. Client
sent data to server for server processing (also server echoing
alf wrote:
Hi,
I can not find out where the extra space comes from. Run following:
import os,sys
while 1:
print 'Question [Y/[N]]?',
if sys.stdin.readline().strip() in ('Y','y'):
#do something
pass
$ python q.py
Question [Y/[N]]?y
Question [Y/[N]]?y
[EMAIL PROTECTED] wrote:
Hello.
I'm writing a proxy class, i.e: a class whose methods mostly delegate
their functionality to other class object. Most of the methods (which
are quite a lot) defined in the class would end up being:
def thisIsTheMethodName(self):
Ritesh Raj Sarraf wrote:
Ritesh Raj Sarraf wrote:
I just noticed that the args variable is holding values b and c.
the args variables comes from:
(options, args) = parser.parse_args()
I guess I only need to figure out now is why args isn't storing
argument a also...
Ritesh
I
Bryan wrote:
hi,
what is the difference among numeric, numpy and numarray? i'm going to start
using matplotlib soon and i'm not sure which one i should use.
this page says, Numarray is a re-implementation of an older Python array
module
called Numeric
Actually, you're wrong on all levels.
First: It's perfectly simple in Java to create a binary sort that sorts
all arrays that contain objects; so wrong there.
Secondly: The bug has nothing to do with static typing (I'm guessing
that's what you meant. Both Python and Java are strongly typed). The
You can gain substantial speed-ups in very certain cases, but the main
point of Pyrex is ease of wrapping, not of speeding-up.
Depending on what you're doing, rewriting in Pyrex or even in C, using
the Python/C API directly, might not gain you much.
--
Well, it seems you can do:
parser = elementtidy.TidyHTMLTreeBuilder.TidyHTMLTreeBuilder()
parser.feed(your_str)
tree = elementtree.ElementTree.ElementTree(element=parser.close())
Look at the parse() method in the ElementTree class.
--
http://mail.python.org/mailman/listinfo/python-list
It doesn't think you're on an intel box, it thinks you want to compile
universal libraries, since you installed a universal python.
The problem is likely to be that you haven't installed SDK's for intel
as well as powerpc when you installed Apple's Developer Tools. Do that,
and it should work ...
Read this: http://users.rcn.com/python/download/Descriptor.htm
Long story short: The type of the instance is passed along together
with the instance itself.
--
http://mail.python.org/mailman/listinfo/python-list
The error you're seeing is because you've rebound 'list' to something
else. Try putting list = type([]) somewhere above your code.
--
http://mail.python.org/mailman/listinfo/python-list
Don't use self.__class__, use the name of the class.
--
http://mail.python.org/mailman/listinfo/python-list
Before that can happen we'll need some better management of co-existing
different versions of a package. You'll want to be able to use newer
versions of external packages without breakage in the standard library.
--
http://mail.python.org/mailman/listinfo/python-list
You're calling the grid() method on the Entry object you're
instanciating. Are you sure that the grid() method returns the Entry
object so that you're actually binding it to self.myAddress?
--
http://mail.python.org/mailman/listinfo/python-list
If you find that you want to iterate over an iterable multiple times,
have a look at the solution that the tee() function in the itertools
module provides (http://docs.python.org/lib/itertools-functions.html).
(Have a look at the rest of the itertools module as well, for that
matter.)
--
Why would it be a bug? You've made it so that every instance of OBJ is
equal to every other instance of OBJ. The behaviour is as expected.
--
http://mail.python.org/mailman/listinfo/python-list
It might be that I'm complicating something easy here, but I
immediately thought of
import sys
class A:
X = 2
def F():
f = sys._getframe().f_back
print f.f_locals[X]
F()
--
http://mail.python.org/mailman/listinfo/python-list
Why do you check if the module threading is less than 50? (this is why
nothing happens, it's always false).
From where do you get port_counter in method run() of scanThread? (this
would make every call to run() raise an exception.
--
http://mail.python.org/mailman/listinfo/python-list
If you have read the document I referred you to, did you also read the
example where classes M1, M2, M3 and M4 were defined?
A quote from the discussion of that example:
For class D, the explicit metaclass M1 is not a subclass of the base
metaclasses (M2, M3), but choosing M3 satisfies the
I definitely think that it's the intended behaviour: the example shows
how and why it works; and I definitely agree that it should be
documented better.
--
http://mail.python.org/mailman/listinfo/python-list
Have you read the Metaclasses part of Unifying types and classes in
Python 2.2? (http://www.python.org/2.2.3/descrintro.html#metaclasses)
It discusses and explains the issues you seem to have.
--
http://mail.python.org/mailman/listinfo/python-list
Take a look at the struct module
(http://docs.python.org/lib/module-struct.html), it does what you want.
--
http://mail.python.org/mailman/listinfo/python-list
Yeha, sure. The Royal Institute of Technology in Stockholm, Sweden
teaches Python for some of its introductory programming and algorithm
courses.
--
http://mail.python.org/mailman/listinfo/python-list
Most have already been said, but have a look at
http://docs.python.org/ref/slots.html for authoritative documentation.
--
http://mail.python.org/mailman/listinfo/python-list
After entering the interpreter, you could do an execfile on the
.pythonrc file.
--
http://mail.python.org/mailman/listinfo/python-list
Look at http://docs.python.org/ref/callable-types.html
class Test(object):
... def __call__(self):
... print the instance was called
...
t = Test()
t()
the instance was called
Is this what you wanted?
--
http://mail.python.org/mailman/listinfo/python-list
I don't know if the binary editions include the Misc directory, but if
you download the Python source you'll find a directory called Misc. In
it, there's a vimrc file.
--
http://mail.python.org/mailman/listinfo/python-list
Okay, so the reason what you're trying to do doesn't work is that the
readahead buffer used by the file iterator is 8192 bytes, which clearly
might be too much. It also might be because the output from the
application you're running is buffered, so you might have to do
something about that as
How much you gain by starting threads is also determined by what you're
doing in those threads. Remember (or learn): In CPython only one thread
at a time can execute python code, so depending on your task threading
might gain you little. If you're doing I/O or calling functions written
in C (and
Jp Calderone wrote:
Or, doing the same thing, but with less code:
Hmm ... What have I been smoking?
--
http://mail.python.org/mailman/listinfo/python-list
Take a look at readline.get_completer_delims() and
readline.set_completer_delims().
--
http://mail.python.org/mailman/listinfo/python-list
Take a look at Platypus at http://sveinbjorn.sytes.net/platypus. It
will make it easier for you.
--
http://mail.python.org/mailman/listinfo/python-list
You should take a look at
http://www.zope.org/Wikis/ZODB/FrontPage/guide/index.html
--
http://mail.python.org/mailman/listinfo/python-list
You can always unpack a tuple that way, like in:
. import sys
. for (index, (key, value)) in enumerate(sys.modules.iteritems()):
pass
--
http://mail.python.org/mailman/listinfo/python-list
Start the attribute name with _ and don't document it. If clients
mess with it, they're to blame.
--
http://mail.python.org/mailman/listinfo/python-list
Stuffit Expander can handle zip, rar, tar, gz, etc, etc, etc. Don't
worry.
--
http://mail.python.org/mailman/listinfo/python-list
Well, they're not synonymous. At least not in that context. If you
haven't already tried it, what you're doing will fail for instances as
well. Look in typeobject.c to see why. The gist of it is that the
special methods are looked up on the type rather than the instance (on
the metaclass rather
Well, the source code is pretty well documented if you want to get to
know the implementation. Read the Extending and Embedding tutorial
and the Python/C API reference, then start digging through the code.
Performance comparisons are broadly available, and always suspect.
--
Class decoration was discussed back when (you can search for the thread
in python-dev); not as an alias to metaclasses but discussed as having
exactly the same semantics as function decoration. Maybe the idea has
more merit as being another way of setting the __metaclass__ attribute;
on the other
That shouldn't happen AFAICT. Check line 108 in keysyms.py and make
sure it says vk = VkKeyScan(ord(char)).
--
http://mail.python.org/mailman/listinfo/python-list
Possibly. Is the ` sign available as an unmodified key?
--
http://mail.python.org/mailman/listinfo/python-list
Well, just modify the source in that case.
--
http://mail.python.org/mailman/listinfo/python-list
Actually, lambda forms are quite precisely documented at
http://docs.python.org/ref/lambdas.html if you feel than reading
the tutorial (specifically http://docs.python.org/tut/node6.html
section 4.7.5) is too base for you.
--
http://mail.python.org/mailman/listinfo/python-list
You might also want to take a peek at the getattr() function:
http://docs.python.org/lib/built-in-funcs.html#l2h-31
--
http://mail.python.org/mailman/listinfo/python-list
53 matches
Mail list logo