On 18/03/14 07:52, Maciej Fijalkowski wrote:
Hi
I have a question about calling __eq__ in some cases.
We're thinking about doing an optimization where say:
if x in d:
return d[x]
where d is a dict would result in only one dict lookup (the second one
being constant folded away). The
On Tue, Mar 18, 2014 at 11:19 PM, Paul Moore p.f.mo...@gmail.com wrote:
On 18 March 2014 19:46, Maciej Fijalkowski fij...@gmail.com wrote:
A question: how far away will this optimization apply?
if x in d:
do_this()
do_that()
do_something_else()
spam =
On Tue, 18 Mar 2014 09:52:05 +0200
Maciej Fijalkowski fij...@gmail.com wrote:
We're thinking about doing an optimization where say:
if x in d:
return d[x]
where d is a dict would result in only one dict lookup (the second one
being constant folded away). The question is whether it's
On Wed, Mar 19, 2014 at 2:42 PM, Antoine Pitrou solip...@pitrou.net wrote:
On Tue, 18 Mar 2014 09:52:05 +0200
Maciej Fijalkowski fij...@gmail.com wrote:
We're thinking about doing an optimization where say:
if x in d:
return d[x]
where d is a dict would result in only one dict lookup
On 03/18/2014 10:19 PM, Paul Moore wrote:
Surely in the presence of threads the optimisation is invalid anyway
Why? As written, the code uses no synchronization primitives to ensure
that the modifications to the dict are propagated at a particular point.
As a consequence, it cannot rely on
On Wed, 19 Mar 2014 15:09:04 +0200
Maciej Fijalkowski fij...@gmail.com wrote:
I would like to point out that instructing people does not really
work. Besides, other examples like this:
if d[x] = 3:
d[x] += 1 don't really work.
That's a good point. But then, perhaps PyPy should analyze
On Wed, Mar 19, 2014 at 3:17 PM, Antoine Pitrou solip...@pitrou.net wrote:
On Wed, 19 Mar 2014 15:09:04 +0200
Maciej Fijalkowski fij...@gmail.com wrote:
I would like to point out that instructing people does not really
work. Besides, other examples like this:
if d[x] = 3:
d[x] += 1
On Wed, Mar 19, 2014 at 6:26 AM, Antoine Pitrou solip...@pitrou.net wrote:
On Wed, 19 Mar 2014 15:21:16 +0200
Maciej Fijalkowski fij...@gmail.com wrote:
On Wed, Mar 19, 2014 at 3:17 PM, Antoine Pitrou solip...@pitrou.net
wrote:
On Wed, 19 Mar 2014 15:09:04 +0200
Maciej Fijalkowski
This mailing list is for the development *of* Python, the the *use* of
Python. Your best option for getting an answer is to ask on python-list or
python-help.
On Tue, Mar 18, 2014 at 9:50 PM, 北冰洋 wtz...@foxmail.com wrote:
Dear,
I just wrote a sample like this:
testPy/
__init__.py
On Wed, 19 Mar 2014 07:09:23 -0700
Thomas Wouters tho...@python.org wrote:
He means you're being unrealistically pedantic :) The number of calls to
__eq__ is _already_ unpredictable, since (as Mark Shannon said) it depends
among other things on the hashing algorithm and the size of the dict.
The docs don't seem to make any guarantee about calling __eq__ or __hash__:
d[key]
Return the item of d with key key. Raises a KeyError if key is not in the
map.
which seems to indicate that this kind of optimization should be fine.
In fact I would very much like messing with the semantics of
Am 17.03.14 22:10, schrieb Jurko Gospodnetić:
Fixing
this required manually cleaning up leftover CPython 3.4.0rc3 windows
installer registry entries. Note that the issue could not be fixed by
using the CPython 3.4.0rc3 installer as it failed due to the same problem.
Did you try the 3.4.0rc3
Sorry, I definitely didn't mean to imply that this kind of optimization is
valid on arbitrary subscript expressions; I thought we had restricted
ourselves to talking about builtin dicts. If we do, I think this becomes a
discussion about what subset of the semantics of CPython's builtins are
Hi.
On 19.3.2014. 16:38, Martin v. Löwis wrote:
Am 17.03.14 22:10, schrieb Jurko Gospodnetić:
Fixing
this required manually cleaning up leftover CPython 3.4.0rc3 windows
installer registry entries. Note that the issue could not be fixed
by using the CPython 3.4.0rc3 installer as it failed
On Wed, Mar 19, 2014 at 3:26 PM, Antoine Pitrou solip...@pitrou.net wrote:
On Wed, 19 Mar 2014 15:21:16 +0200
Maciej Fijalkowski fij...@gmail.com wrote:
On Wed, Mar 19, 2014 at 3:17 PM, Antoine Pitrou solip...@pitrou.net wrote:
On Wed, 19 Mar 2014 15:09:04 +0200
Maciej Fijalkowski
On Wed, Mar 19, 2014 at 8:38 AM, Kevin Modzelewski k...@dropbox.com wrote:
Sorry, I definitely didn't mean to imply that this kind of optimization is
valid on arbitrary subscript expressions; I thought we had restricted
ourselves to talking about builtin dicts. If we do, I think this becomes a
Kevin Modzelewski writes:
Sorry, I definitely didn't mean to imply that this kind of
optimization is valid on arbitrary subscript expressions; I thought
we had restricted ourselves to talking about builtin dicts.
Ah, maybe so -- Maciej made that clear later for PyPy. My bad. (With
the
Hi.
Did you try the 3.4.0rc3 repair installation? That should have
undeleted (repaired) the files that you had manually deleted.
Just tested this out and repairing the same matching installation
does revert the removed files. It does not reinstall pip and setuptools
packages but that
Hi.
On 19.3.2014. 16:38, Martin v. Löwis wrote:
Am 17.03.14 22:10, schrieb Jurko Gospodnetić:
Fixing
this required manually cleaning up leftover CPython 3.4.0rc3 windows
installer registry entries. Note that the issue could not be fixed by
using the CPython 3.4.0rc3 installer as it failed
Code below has been written with the intension of acquiring ONLY one lock.
There are two issues:
1- Sometimes it returns more than one lock in done.
2- Sometimes, even if wait exits with zero or one locks, it seems
there are other locks are acquired too. Though, I couldn't isolate
the exact case
Hi Imran,
The python-dev list is not the place to ask questions about the usage of
Python modules or features. However, since you are asking an
asyncio-related question, you should be welcome at the python-tulip list:
https://groups.google.com/forum/?fromgroups#!forum/python-tulip
--Guido
On
Hi.
Should I open a 'Add/Remove Programs' dialog related issue in the
CPython issue tracker?
Please do. It would also good if somebody volunteered to reproduce
the issue.
Opened issue #20984.
http://bugs.python.org/issue20984
Anyone have Windows 8 x64 available to try this out
Hello,
It is known to be cumbersome to write a proxy type that will correctly
proxy all special methods (this has to be done manually on the type,
since special methods are not looked up on the instance: a __getattr__
method would not work).
Recently we've had reports of two stdlib types that
On Wed, 19 Mar 2014 10:53:31 -0700
Ethan Furman et...@stoneleaf.us wrote:
I just made a change to some error messages [1] (really, just one):
old behavior:
'%o' % 3.14
'float' object cannot be interpreted as an integer
new behavior:
'%o' % 3.14
%o format: an integer is
I just made a change to some error messages [1] (really, just one):
old behavior:
'%o' % 3.14
'float' object cannot be interpreted as an integer
new behavior:
'%o' % 3.14
%o format: an integer is required, not float
Would we normally add a test for that?
--
~Ethan~
[1] Issue 19995:
Sure, I'll check it this evening.
Jurko Gospodnetić jurko.gospodne...@pke.hr wrote on 03/19/2014 01:41:19
PM:
Hi.
Should I open a 'Add/Remove Programs' dialog related issue in the
CPython issue tracker?
Please do. It would also good if somebody volunteered to reproduce
the
Am 19.03.2014 19:55, schrieb Antoine Pitrou:
On Wed, 19 Mar 2014 10:53:31 -0700
Ethan Furman et...@stoneleaf.us wrote:
I just made a change to some error messages [1] (really, just one):
old behavior:
'%o' % 3.14
'float' object cannot be interpreted as an integer
new behavior:
On Wed Mar 19 2014 at 2:46:48 PM, Antoine Pitrou solip...@pitrou.net
wrote:
Hello,
It is known to be cumbersome to write a proxy type that will correctly
proxy all special methods (this has to be done manually on the type,
since special methods are not looked up on the instance: a
On 19 March 2014 18:46, Antoine Pitrou solip...@pitrou.net wrote:
In http://bugs.python.org/issue19359#msg213530 I proposed to introduce a
proxy
protocol (__proxy__ / tp_proxy) that would be used as a fallback by
_PyObject_LookupSpecial to fetch the lookup target, i.e.:
def
On Wed, 19 Mar 2014 19:32:50 +
Brett Cannon bcan...@gmail.com wrote:
In http://bugs.python.org/issue19359#msg213530 I proposed to introduce a
proxy
protocol (__proxy__ / tp_proxy) that would be used as a fallback by
_PyObject_LookupSpecial to fetch the lookup target, i.e.:
def
On Wed, 19 Mar 2014 20:15:15 +
Paul Moore p.f.mo...@gmail.com wrote:
On 19 March 2014 18:46, Antoine Pitrou solip...@pitrou.net wrote:
In http://bugs.python.org/issue19359#msg213530 I proposed to introduce a
proxy
protocol (__proxy__ / tp_proxy) that would be used as a fallback by
On 20 Mar 2014 02:37, Stephen J. Turnbull step...@xemacs.org wrote:
Kevin Modzelewski writes:
Sorry, I definitely didn't mean to imply that this kind of
optimization is valid on arbitrary subscript expressions; I thought
we had restricted ourselves to talking about builtin dicts.
Ah,
On 20 Mar 2014 07:38, Nick Coghlan ncogh...@gmail.com wrote:
Correct, but I think this discussion has established that how many times
dict lookup calls __eq__ on the key is one such thing. In CPython, it
already varies based on:
- dict contents (due to the identity check and the distribution
On 20 Mar 2014 06:24, Antoine Pitrou solip...@pitrou.net wrote:
On Wed, 19 Mar 2014 19:32:50 +
Brett Cannon bcan...@gmail.com wrote:
In http://bugs.python.org/issue19359#msg213530 I proposed to
introduce a
proxy
protocol (__proxy__ / tp_proxy) that would be used as a fallback by
On Thu, 20 Mar 2014 07:54:39 +1000
Nick Coghlan ncogh...@gmail.com wrote:
Graeme Dumpleton has also subsequently written a library to handle easier
creation of correct proxy types: https://pypi.python.org/pypi/wrapt
(is Graeme another spelling for Graham?)
It isn't as simple as changing one
Here's the code in question:
class PsuedoFloat:
def __init__(self, value):
self.value = float(value)
def __int__(self):
return int(self.value)
pi = PsuedoFloat(3.1415)
self.assertRaisesRegex(TypeError, '%x format:
On Wed, 19 Mar 2014 14:37:42 -0700
Ethan Furman et...@stoneleaf.us wrote:
Here's the code in question:
class PsuedoFloat:
def __init__(self, value):
self.value = float(value)
def __int__(self):
return int(self.value)
On 03/19/2014 03:13 PM, Antoine Pitrou wrote:
On Wed, 19 Mar 2014 14:37:42 -0700
Ethan Furman et...@stoneleaf.us wrote:
Here's the code in question:
class PsuedoFloat:
def __init__(self, value):
self.value = float(value)
def
On Wed, 19 Mar 2014 15:17:53 -0700
Ethan Furman et...@stoneleaf.us wrote:
On 03/19/2014 03:13 PM, Antoine Pitrou wrote:
On Wed, 19 Mar 2014 14:37:42 -0700
Ethan Furman et...@stoneleaf.us wrote:
Here's the code in question:
class PsuedoFloat:
def __init__(self,
On 03/19/2014 03:57 PM, Antoine Pitrou wrote:
On Wed, 19 Mar 2014 15:17:53 -0700
Ethan Furman et...@stoneleaf.us wrote:
On 03/19/2014 03:13 PM, Antoine Pitrou wrote:
On Wed, 19 Mar 2014 14:37:42 -0700
Ethan Furman et...@stoneleaf.us wrote:
Here's the code in question:
class
On Wed, Mar 19, 2014 at 4:13 PM, Ethan Furman et...@stoneleaf.us wrote:
On 03/19/2014 03:57 PM, Antoine Pitrou wrote:
On Wed, 19 Mar 2014 15:17:53 -0700
Ethan Furman et...@stoneleaf.us wrote:
On 03/19/2014 03:13 PM, Antoine Pitrou wrote:
On Wed, 19 Mar 2014 14:37:42 -0700
Ethan Furman
On Wed, 19 Mar 2014 20:32:38 +0100, Georg Brandl g.bra...@gmx.net wrote:
Am 19.03.2014 19:55, schrieb Antoine Pitrou:
On Wed, 19 Mar 2014 10:53:31 -0700
Ethan Furman et...@stoneleaf.us wrote:
I just made a change to some error messages [1] (really, just one):
old behavior:
On Wed, Mar 19, 2014 at 11:01:39PM +0100, Antoine Pitrou wrote:
On Thu, 20 Mar 2014 07:54:39 +1000
Nick Coghlan ncogh...@gmail.com wrote:
Graeme Dumpleton has also subsequently written a library to handle easier
creation of correct proxy types: https://pypi.python.org/pypi/wrapt
(is
On Wed, 19 Mar 2014 16:41:10 -0700, Thomas Wouters tho...@python.org wrote:
On Wed, Mar 19, 2014 at 4:13 PM, Ethan Furman et...@stoneleaf.us wrote:
On 03/19/2014 03:57 PM, Antoine Pitrou wrote:
On Wed, 19 Mar 2014 15:17:53 -0700
Ethan Furman et...@stoneleaf.us wrote:
On 03/19/2014
On 03/19/2014 04:41 PM, Thomas Wouters wrote:
What Antoine is trying to tell you is that the traceback you pasted shows this:
File /home/ethan/source/python/__issue19995/Lib/test/test___unicode.py,
line 1156, in test_formatting
self.assertRaisesRegex(__TypeError, '%c'.__mod__, pi),
On 20 Mar 2014 10:34, Steven D'Aprano st...@pearwood.info wrote:
On Wed, Mar 19, 2014 at 11:01:39PM +0100, Antoine Pitrou wrote:
On Thu, 20 Mar 2014 07:54:39 +1000
Nick Coghlan ncogh...@gmail.com wrote:
Graeme Dumpleton has also subsequently written a library to handle
easier
46 matches
Mail list logo