Is it possible to have a default dictionary where the default is dependant
on the key?
I was hoping something like this might work:
m = defaultdict(lambda key: key+1)
But it obviously doesn't:
m[3]
Traceback (most recent call last):
File stdin, line 1, in module
TypeError: lambda() takes
On Mon, Nov 3, 2014 at 10:04 PM, Antoon Pardon
antoon.par...@rece.vub.ac.be wrote:
Is it possible to have a default dictionary where the default is dependant
on the key?
I was hoping something like this might work:
m = defaultdict(lambda key: key+1)
But it obviously doesn't:
m[3]
- Original Message -
From: Gregory Ewing greg.ew...@canterbury.ac.nz
Steven D'Aprano wrote:
Like all good Pythonistas[1], we hate Java and think that
getter/setter
methods are pointless. But come on, they're not *wrong*,
What's wrong is the statement that getters and setters
In the boost::python library there is a function
boost::python::long_
and this function return a boost::python::object variable
I'm trying to wrap a double variale but I can't find
something just like
boost::python::double_
can someone help me to build a double object
PS.
I know there
On Mon, Nov 3, 2014 at 7:53 AM, Joseph Shen joseph.sm...@gmail.com wrote:
In the boost::python library there is a function
boost::python::long_
and this function return a boost::python::object variable
I'm trying to wrap a double variable but I can't find
something just like
On Monday, November 3, 2014 10:11:01 PM UTC+8, Skip Montanaro wrote:
On Mon, Nov 3, 2014 at 7:53 AM, Joseph Shen joseph...@gmail.com wrote:
In the boost::python library there is a function
boost::python::long_
and this function return a boost::python::object variable
I'm
On Nov 2, 2014 5:31 AM, Denis McMahon denismfmcma...@gmail.com wrote:
And perhaps that also addresses the square - rectangle (or circle -
ellipse) issue - square, rectangle and rhombus are all forms of
quadrilateral, and perhaps should all inherit a base class Quadrilateral,
rather than trying
On 03/11/2014 13:53, Joseph Shen wrote:
In the boost::python library there is a function
boost::python::long_
and this function return a boost::python::object variable
I'm trying to wrap a double variale but I can't find
something just like
boost::python::double_
can someone help me
On Tue, Nov 4, 2014 at 12:50 AM, Dennis Lee Bieber
wlfr...@ix.netcom.com wrote:
On Mon, 3 Nov 2014 03:12:32 + (UTC), Denis McMahon
denismfmcma...@gmail.com declaimed the following:
So:
Quadrilateral
Parallelogram
Square
Rectangle
Rhombus
Diamond (4 sides
I input 'pip install html5lib' to the Python 2.7 console and got :
pip install html5lib
File stdin, line 1
pip install html5lib
^
SyntaxError: invalid syntax
I am not sure what you mean about 'single line paragraphs'. I put my text
into double line spacing in my last
On Tue, Nov 4, 2014 at 3:27 AM, Simon Evans musicalhack...@yahoo.co.uk wrote:
I input 'pip install html5lib' to the Python 2.7 console and got :
pip install html5lib
File stdin, line 1
pip install html5lib
^
SyntaxError: invalid syntax
This should be run from your
json_split = {}
value = {Status: Submitted, m_Controller: Python}
a = range(31)
del a[0]
for i in a:
json_split[i] = value
keys = json_split.keys()
order = list(keys)
q1 = int(round(len(keys)*0.2))
q2 = int(round(len(keys)*0.3))
q3 = int(round(len(keys)*0.5))
b = [q1,q2,q3]
n=0
threedicts = []
I input to the cmd console 'pip install html5lib' but again got an error
return. I thought one of the participants was unhappy about single line spacing
(re: single line paragraphs') Okay I will go back to single line spacing, I
don't think it is all that important, really.
Anyway this is my
On 03/11/2014 21:28, Simon Evans wrote:
I input to the cmd console 'pip install html5lib' but again got an error
return. I thought one of the participants was unhappy about single line spacing
(re: single line paragraphs') Okay I will go back to single line spacing, I
don't think it is all
Jean-Michel Pichavant wrote:
I agree with Steven on that one, while getters/setters are not the preferred
way, they are not utterly wrong.
I'm not saying that they're wrong in general, only that
they're wrong for *Python*.
This matters, because the course in question is purportedly
teaching
In article mailman.15076.1413990100.18130.python-l...@python.org,
Ned Batchelder n...@nedbatchelder.com wrote:
On 10/22/14 5:27 AM, ast wrote:
Chris Angelico ros...@gmail.com a écrit dans le message de
news:mailman.15058.1413968065.18130.python-l...@python.org...
On Wed, Oct 22, 2014 at 7:27
On Mon, 03 Nov 2014 06:29:39 +, Dan Sommers wrote:
On Mon, 03 Nov 2014 03:12:32 +, Denis McMahon wrote:
Quadrilateral
Parallelogram
Square Rectangle Rhombus Diamond (4 sides eq)
Trapezoid
Arrowhead
What's the difference between a Diamond and a Rhombus?
Denis McMahon wrote:
On Mon, 03 Nov 2014 06:29:39 +, Dan Sommers wrote:
What's the difference between a Diamond and a Rhombus?
Oops, I was thinking a rhombus was a general parallelogram, my mistake.
Some diamonds are neither rhombuses nor parallelograms:
Jean-Michel Pichavant wrote:
Python uses the descriptor protocol which is
basically getters and setters. It's is just hidden by a strange decorator
syntax.
This is about the interface, not the implementation.
Getters and setters in this context means designing
the API of your class to have
Changes by Robert Collins robe...@robertcollins.net:
Added file: http://bugs.python.org/file37118/issue22457.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22457
___
Antoine Pitrou added the comment:
The problem is the default value for `purpose` in the function declaration (the
signature mocks the ssl.create_default_context() function, so I don't think
it's ok to change the default parameter value here).
--
Georg Brandl added the comment:
Nice! How do you plan to organize its setup?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22650
___
___
Changes by Yongzhi Pan panyong...@gmail.com:
--
nosy: +fossilet
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8350
___
___
Python-bugs-list
Changes by Berker Peksag berker.pek...@gmail.com:
Added file: http://bugs.python.org/file37119/issue21650_v4.diff
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21650
___
Ethan Furman added the comment:
I don't want to change the kind of exception being raised (an API change from
AttributeError to TypeError) without a really good reason.
Subclasses cannot work with the current implementation.
In general, in-place methods are not required to return
Changes by Nir Soffer nir...@gmail.com:
--
nosy: +nirs
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6721
___
___
Python-bugs-list mailing list
Håkan Lövdahl added the comment:
Yes, I can confirm that changing 'URL' to be 'http://127.0.0.1' works. I think
that would be a solution to this.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22753
R. David Murray added the comment:
Why a separate domain rather than a subdomain? I'm not objecting, but I am
curious.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22650
___
R. David Murray added the comment:
On Mon, 03 Nov 2014 10:53:09 +, Ethan Furman rep...@bugs.python.org wrote:
Ethan Furman added the comment:
I don't want to change the kind of exception being raised (an API change
from
AttributeError to TypeError) without a really good reason.
Wichert Akkerman added the comment:
Bump.
Python 3 is still not on my radar, but I'll happily do a backport for Py2 and
drop that on PyPI once this gets resolved.
--
versions: +Python 3.3, Python 3.4, Python 3.5, Python 3.6
___
Python tracker
Changes by Éric Araujo mer...@netwok.org:
--
stage: patch review - needs patch
versions: -Python 3.2, Python 3.3, Python 3.4, Python 3.6
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2504
Donald Stufft added the comment:
It is configured using salt, see
https://github.com/python/psf-salt/blob/master/salt/pythontest/init.sls.
A separate domain just makes it easier to do whatever we need with it without
needing to worry about getting confused between live sites and test sites.
New submission from Till Maas:
https://github.com/python/cpython/commit/71a4ee3ea2c6847b9fc4b33cbc8d565a7bf2424a
introduces a regression in ssl.SSLContext.load_cert_chain()
https://github.com/python/cpython/blob/2.7/Modules/_ssl.c#L2462
With this change it is not possible to specify None as
Till Maas added the comment:
sorry, it should be:
requests.get(https://example.com;, cert=keycert.pem)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22787
___
Changes by Alex Gaynor alex.gay...@gmail.com:
--
nosy: +alex, christian.heimes, dstufft, giampaolo.rodola, janssen, pitrou
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22787
___
Benjamin Peterson added the comment:
% ./python Lib/test/regrtest.py -v test_urllib2_localnet
== CPython 3.4.2+ (3.4:7be6ef737aaf+, Nov 3 2014, 10:03:11) [GCC 4.8.3]
==
Linux-3.16.5-gentoo-x86_64-Intel-R-_Core-TM-_i7-2860QM_CPU_@_2.50GHz-with-gentoo-2.2
little-endian
== hash algorithm:
Changes by Alex Gaynor alex.gay...@gmail.com:
--
keywords: +patch
Added file: http://bugs.python.org/file37121/issue22787.diff
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22787
___
Alex Gaynor added the comment:
Latest patch fixes the urllib2_localnet tests.
--
Added file: http://bugs.python.org/file37122/issue22417.diff
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22417
Changes by Alex Gaynor alex.gay...@gmail.com:
--
keywords: +needs review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22787
___
___
Guido van Rossum added the comment:
OK, them LGTM.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22784
___
___
Python-bugs-list mailing list
Jim Jewett added the comment:
If I know that a Counter (or any class X) can be updated in place, I will be
surprised to find out that I'm using a different instance after a successful
in-place operation.
I would even consider that (replacement of the original instance) a security
risk,
Steve Dower added the comment:
The fix for this now uses module without initializing it, which could lead to a
crash if get_dotted_path() tries to raise an exception (it puts module into the
error string with %R). See Modules/_pickle.c#l1656 and Modules/_pickle.c#l1538.
I think the fix is to
Steve Dower added the comment:
(Looks like I was outsmarted by the tracker when trying to put line numbers in
my links... is there a way to do that?)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22676
Ethan Furman added the comment:
Ethan stated:
The only problem with the design is that it does not play well with others.
For
duck-typeable just do a check on 'other' to see if it has an .items()
method, and
return NotImplemented if it does not. Oh, and check that 'self' is Counter,
Alex Gaynor added the comment:
Fix for the failing test_ssl testes.
--
Added file: http://bugs.python.org/file37123/issue22417.diff
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22417
___
New submission from Benjamin Peterson:
It would be nice if HTTPHandler could take an SSLContext as a parameter, which
would be passed to HTTPSConnection to configure the security of the connection.
--
components: Library (Lib)
messages: 230549
nosy: benjamin.peterson, vinay.sajip
Silvio Ricardo Cordeiro added the comment:
BufferedReader assumes that readinto is defined, but that's not the case for
StringIO's. In the end, this cripples StringIO objects, because their data can
never be peek()'ed as with all other file objects.
--
components: +IO -Library (Lib)
Alex Gaynor added the comment:
I'm not sure I follow, where does HTTPHandler ever construct an HTTPSConnection?
--
nosy: +alex
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22788
___
Benjamin Peterson added the comment:
emit()
On Mon, Nov 3, 2014, at 15:33, Alex Gaynor wrote:
Alex Gaynor added the comment:
I'm not sure I follow, where does HTTPHandler ever construct an
HTTPSConnection?
--
nosy: +alex
___
Python
Alex Gaynor added the comment:
Hah! I didn't realize you meant *logging.handlers.HTTPHandler*, I thought you
meant *urllib.request.HTTPHandler*.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22788
Benjamin Peterson added the comment:
Right then...
--
title: allow HTTPHandler to take an SSLContext - allow
logging.handlers.HTTPHandler to take an SSLContext
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22788
Roundup Robot added the comment:
New changeset 2afe5413d7af by Benjamin Peterson in branch '3.4':
PEP 476: enable HTTPS certificate verification by default (#22417)
https://hg.python.org/cpython/rev/2afe5413d7af
New changeset 731375f83406 by Benjamin Peterson in branch 'default':
merge 3.4
Benjamin Peterson added the comment:
Okay, 3.4/3.5 have been dealt with. I had to hack up test_logging a bit.
(#22788 would make that better). 2.7 now needs a backport.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22417
Domen Kožar added the comment:
Could we backport this one to 3.x and 2.7? It's leads to really bad UX.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7559
___
Alex Gaynor added the comment:
Quick pass at a patch. No docs, and it should proabbly be an error to pass
context with secure=False.
--
keywords: +needs review, patch
Added file: http://bugs.python.org/file37124/issue22788.diff
___
Python tracker
Ethan Furman added the comment:
Okay, the python-dev ruling is in, and raising an exception in the __ixxx__
methods is allowed, and even a good idea in the cases of mutable containers.
However, doing the check on 'other' and raising a TypeError with an appropriate
message would still be
Benjamin Peterson added the comment:
Thank you for the patchset. I wonder if we should just forbid most reentrancy
i.e. set a flag on the type when it's being constructed and not let
type_set_bases be called then. Setting __bases__ from within mro() doesn't seem
very useful outside of
Ethan Furman added the comment:
+ Special value which should be returned by the special methods
+ (:meth:`__eq__`, :meth:`__lt__`, :meth:`__add__`, etc.) to indicate
+ that the operation is not implemented with respect to the other type.
After a discussion on python-dev, I think this
Arfrever Frehtes Taifersar Arahesis added the comment:
Please update versionchanged to 3.4.3 on default branch.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22366
___
Serhiy Storchaka added the comment:
LGTM.
--
stage: patch review - commit review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21650
___
___
R. David Murray added the comment:
Sounds OK to me. There should already be a discussion of the consequences of
returning it (I don't remember where, though), and it would be nice to link to
that discussion.
Note that any doc change should be applied to 3.4 first, and then merged to 3.5.
R. David Murray added the comment:
I would love that, but I think the fix depends on a feature. Robert will know
for sure.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7559
___
Ethan Furman added the comment:
I found these items:
Doc/c-api/object.rst
.. c:var:: PyObject* Py_NotImplemented
The ``NotImplemented`` singleton, used to signal that an operation is
not implemented for the given type combination.
Doc/extending/newtypes.rst
R. David Murray added the comment:
I was actually thinking of the Implementing the arithmetic operations section.
Maybe we should copy the parenthetical from the datamodel description into the
text you are modifying, and then link to the implementing section.
--
Benjamin Peterson added the comment:
Somehow the Windows bots are failing to verify python.org
http://buildbot.python.org/all/builders/x86%20XP-4%203.x/builds/11179/steps/test/logs/stdio
--
___
Python tracker rep...@bugs.python.org
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:
--
nosy: +Arfrever
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22788
___
Antoine Pitrou added the comment:
Not to mention possible cookie tests, I suppose.
(I would personally have preferred something like comfychair.net, but I guess
pythontest.net is ok too :-))
--
nosy: +pitrou
___
Python tracker rep...@bugs.python.org
Tim Graham added the comment:
Cookie pickling issue should be fixed in #22775.
--
nosy: +Tim.Graham
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue826897
___
Roundup Robot added the comment:
New changeset e54d0b197c82 by Benjamin Peterson in branch '2.7':
allow keyfile argument to be None (closes #22787)
https://hg.python.org/cpython/rev/e54d0b197c82
--
nosy: +python-dev
resolution: - fixed
stage: - resolved
status: open - closed
Tim Graham added the comment:
Georg, how do want to proceed with this issue? Should we backport #16611
(support for parsing secure/httponly flag) to 3.2 to fix this regression and
then create a separate issue to fix the lax parsing issue on all versions?
--
Steve Dower added the comment:
Patch looks good to me, but given this issue, #11835, #22733, and probably
more, should we be integrating from libffi (which apparently has fixes for some
of these) more often? I know nothing about how we move code between that and
ctypes.
--
nosy:
Zachary Ware added the comment:
Good point, David. Jeremy, Trent, you're the only other Windows buildbot
operators as far as I know; feel free to clean up the old externals locations
as you like.
Also, sorry to make it a bit hairier to operate, but I think this is a big
enough improvement
Tshepang Lekhonkhobe added the comment:
@raymond
Why do you say that 'sequence' is a keyword?
enumerate()
Traceback (most recent call last):
File stdin, line 1, in module
TypeError: Required argument 'sequence' (pos 1) not found
That means that 'sequence' can be changed to 'iterable'
New submission from Raymond Hettinger:
Save space and reduce I/O time (reading and writing) by compressing the
marshaled code in files.
In my code tree for Python 3, there was a nice space savings 19M to 7M. Here's
some of the output from my test:
8792 - 4629
Zachary Ware added the comment:
Aaron, what version of Python are you using on what version of Windows? Also,
32 or 64 bit on both?
I can't reproduce this with any Python 3.3.6 or newer on 64-bit Windows 8.1.
--
___
Python tracker
Raymond Hettinger added the comment:
static PyObject *
Why do you say that 'sequence' is a keyword?
It is a keyword argument to enumerate(). Here's the relevant section of code:
enum_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
enumobject *en;
PyObject *seq = NULL;
Raymond Hettinger added the comment:
FWIW, I think doc changes like this need to be made by the people most familiar
with the implementation details and with the original design intent (i.e. the
authors of PEP 207).
The knowledge here is fragile and it would be easy to accidentally make-up
Changes by Raymond Hettinger raymond.hettin...@gmail.com:
--
Removed message: http://bugs.python.org/msg230579
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22780
___
Raymond Hettinger added the comment:
Looking into this further, I suspect that the cleanest way to implement this
would be to add a marshal version 4 that compresses and decompresses using zlib.
--
components: +Interpreter Core
nosy: +brett.cannon, pitrou
Raymond Hettinger added the comment:
Looking into this further, I suspect that the cleanest way to implement this
would be to add a zlib compression and decompression using to the marshal.c
(bumping the version number to 5).
--
___
Python tracker
Changes by Raymond Hettinger raymond.hettin...@gmail.com:
--
Removed message: http://bugs.python.org/msg230580
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22789
___
Ethan Furman added the comment:
Thank you, Raymond, both for your concern and your discretion.
My interest in changing the can or may to should is that, whatever the
original intent of the PEP, the way Python works /now/ is that any class that
doesn't return NotImplemented when it /should/ is
Martin v. Löwis added the comment:
I haven't had any time to work on Python in the last year, so it may take some
more time for me to look into this.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21931
Ethan Furman added the comment:
How about:
Special value which should be returned by the binary special methods
(e.g. :meth:`__eq__`, :meth:`__lt__`, :meth:`__add__`, :meth:`__rsub__`,
etc.) to indicate that the operation is not implemented with respect to
the other type; may be
Georg Brandl added the comment:
You add a label before that section and then reference it with :ref:.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22780
___
Georg Brandl added the comment:
Thanks!
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22775
___
___
Python-bugs-list mailing list
Unsubscribe:
Georg Brandl added the comment:
That seems like the best course of action.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22758
___
___
Georg Brandl added the comment:
LGTM.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22695
___
___
Python-bugs-list mailing list
Unsubscribe:
88 matches
Mail list logo