Kushal Das added the comment:
It is a typing mistake many people make. We just want to catch those as
otherwise mock will silently pass those.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21238
On Sun, Jul 12, 2015 at 8:20 AM, Ian Burnette ian.burne...@gmail.com wrote:
I've recently been playing around with Clojure, and I really like the way
they've overcome the JVM not supporting TRE. The way Clojure solves this
problem is to have a built in recur function that signals to the
On Mon, Jul 13, 2015 at 9:22 PM, Jussi Piitulainen
jpiit...@ling.helsinki.fi wrote:
That's oddly restricted to self-calls. To get the real thing, recur
should replace return - I'm tempted to spell it recurn - so the
definition would look like this:
def factorial(n, acc=1):
if n == 0:
On 07/13/2015 01:28 PM, Chris Angelico wrote:
On Sun, Jul 12, 2015 at 8:20 AM, Ian Burnette ian.burne...@gmail.com wrote:
[ About tail recursion ]
When a function is purely tail-recursive like this, it's trivial to
convert it at the source code level:
def factorial(n):
acc = 1
On Mon, Jul 13, 2015 at 10:00 PM, Antoon Pardon
antoon.par...@rece.vub.ac.be wrote:
On 07/13/2015 01:28 PM, Chris Angelico wrote:
On Sun, Jul 12, 2015 at 8:20 AM, Ian Burnette ian.burne...@gmail.com wrote:
[ About tail recursion ]
When a function is purely tail-recursive like this, it's
Ian Burnette writes:
I've recently been playing around with Clojure, and I really like the
way they've overcome the JVM not supporting TRE. The way Clojure
solves this problem is to have a built in recur function that
signals to the Clojure compiler to convert the code to a loop in the
JVM.
Repo:
https://github.com/donnemartin/interactive-coding-challenges
Shortlink:
https://bit.ly/git-code
Hi Everyone,
I created a number of interactive, test-driven coding challenges. I will
continue to add to the repo on a regular basis. I'm hoping you find it useful
as a fun, hands-on way to
Dima Tisnek added the comment:
What is this **assret** spelling?
I can't a reference to this spelling anywhere else in the codebase, let alone
any docs other that this special kwarg.
It seems intentional.
Was that a joke?
Or something I should know?
--
nosy: +Dima.Tisnek
Hi there,
First, please forgive me if this is the wrong venue to be suggesting this
idea-- I'm just following the PEP workflow page
https://www.python.org/dev/peps/pep-0001/#pep-workflow.
I've recently been playing around with Clojure, and I really like the way
they've overcome the JVM not
Changes by Jerry Elmore jerry.r.elm...@gmail.com:
--
nosy: +Jerry Elmore
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19475
___
___
On Mon, Jul 13, 2015 at 9:23 PM, Steven D'Aprano st...@pearwood.info wrote:
On Tue, 14 Jul 2015 01:12 pm, Ian Kelly wrote:
On Mon, Jul 13, 2015 at 10:56 AM, Roel Schroeven r...@roelschroeven.net
wrote:
Hi,
Quick question: why does str have both index() and find(), while list
only has
On Tue, Jul 14, 2015 at 3:15 PM, Paul Rubin no.email@nospam.invalid wrote:
Chris Angelico ros...@gmail.com writes:
I'm not sure why the transition to another state has to be recursive.
It's not recursive: it's more like a goto with arguments, and a tail
call expresses it nicely.
Hmm, maybe,
On Mon, Jul 13, 2015 at 11:25 PM, Chris Angelico ros...@gmail.com wrote:
(Also, side point: Python can't actually optimize the above function,
because it actually means call quicksort, then discard its return
value and return None. A true tail call has to return the result of
the recursive
On Tuesday 14 July 2015 14:45, Ben Finney wrote:
Howdy all,
The Python reference says of a class ‘__new__’ method::
object.__new__(cls[, ...])
Called to create a new instance of class cls. __new__() is a static
method (special-cased so you need not declare it as such) that
Chris Angelico ros...@gmail.com writes:
I'm not sure why the transition to another state has to be recursive.
It's not recursive: it's more like a goto with arguments, and a tail
call expresses it nicely.
Maybe this is something where previous experience makes you more
comfortable with a
On Tue, 14 Jul 2015 12:05 am, Chris Angelico wrote:
If you want to make an assertion that iterative
code requires equivalent warping to tail-recursive code, I want to see
an example of it. Is that difficult?
Of course it is. If it wasn't difficult, people would post examples instead
of
On Tue, 14 Jul 2015 01:12 pm, Ian Kelly wrote:
On Mon, Jul 13, 2015 at 10:56 AM, Roel Schroeven r...@roelschroeven.net
wrote:
Hi,
Quick question: why does str have both index() and find(), while list
only has index()? Is there a reason for that, or is it just an historical
accident?
On 7/13/2015 3:07 PM, Marko Rauhamaa wrote:
Or, translated into (non-idiomatic) Python code:
def common_prefix_length(bytes_a, bytes_b):
def loop(list_a, list_b, common_length):
if not list_a:
Chris Angelico ros...@gmail.com:
def quicksort(array, start, end):
midp = partition(array, start, end)
if midp = (start+end)//2:
quicksort(array, start, midp)
quicksort(array, midp+1, end)
else:
quicksort(array, midp+1, end)
Chris Angelico ros...@gmail.com writes:
That's a prime example of recursion... but not of recursion that can
be tail-call optimized into iteration. It's an example of forking
recursion, where one call can result in multiple calls (same with tree
traversal); it calls itself to sort the first
On Mon, Jul 13, 2015 at 10:56 AM, Roel Schroeven r...@roelschroeven.net wrote:
Hi,
Quick question: why does str have both index() and find(), while list only
has index()? Is there a reason for that, or is it just an historical
accident?
Historical accident, I think. If it were to be redone,
Serhiy Storchaka added the comment:
Can you allow me to commit the patch or will commit it yourself Raymond?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24483
___
Howdy all,
The Python reference says of a class ‘__new__’ method::
object.__new__(cls[, ...])
Called to create a new instance of class cls. __new__() is a static
method (special-cased so you need not declare it as such) that takes
the class of which an instance was requested as
Roundup Robot added the comment:
New changeset 7021d46c490e by Robert Collins in branch '3.5':
Issue #23661: unittest.mock side_effects can now be exceptions again.
https://hg.python.org/cpython/rev/7021d46c490e
New changeset 231bf0840f8f by Robert Collins in branch 'default':
Issue 23661:
On Tue, Jul 14, 2015 at 3:15 PM, Paul Rubin no.email@nospam.invalid wrote:
It's difficult given how subjective the concept of warping is. What's
straightforward to someone else sounds likely to look warped to you and
vice versa. But how does this look:
def quicksort(array, start, end):
Alessandro Rosa added the comment:
Hi Terry,
I will try my best to answer your questions.
To update you, I decided to completely uninstall the ActiveState frameworks
from my Mac. This brought me back to the dreaded Apple version of Tcl/Tk 8.5.9
with the IDLE warning about it. At this point
Serhiy Storchaka added the comment:
Can't reproduce the crash with current sources. In both examples the result is
an exception:
_pickle.UnpicklingError: NEWOBJ_EX class argument must be a type, not float
How an ob_type field of cls can be set to 0?
--
nosy: +alexandre.vassalotti,
On Tuesday 14 July 2015 14:07, Ian Kelly wrote:
On Mon, Jul 13, 2015 at 9:23 PM, Steven D'Aprano st...@pearwood.info
wrote:
On Tue, 14 Jul 2015 01:12 pm, Ian Kelly wrote:
On Mon, Jul 13, 2015 at 10:56 AM, Roel Schroeven
r...@roelschroeven.net wrote:
Hi,
Quick question: why does str have
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes:
py class Spam(object):
... def __new__(cls):
... print cls
...
py Spam.__new__() # implicit first arg?
Traceback (most recent call last):
File stdin, line 1, in module
TypeError: __new__() takes exactly 1
On Mon, Jul 13, 2015 at 11:55 PM, Antoon Pardon
antoon.par...@rece.vub.ac.be wrote:
On 07/13/2015 02:34 PM, Chris Angelico wrote:
Warping your code around a recursive solution
to make it into a perfect tail call usually means making it look a lot
less impressive; for instance,
And sometimes
On Mon, Jul 13, 2015 at 6:34 AM, Chris Angelico ros...@gmail.com wrote:
On Mon, Jul 13, 2015 at 10:00 PM, Antoon Pardon
antoon.par...@rece.vub.ac.be wrote:
On 07/13/2015 01:28 PM, Chris Angelico wrote:
Why is it worth writing your code recursively, only to have it be
implemented iteratively?
On 07/13/2015 04:05 PM, Chris Angelico wrote:
On Mon, Jul 13, 2015 at 11:55 PM, Antoon Pardon
antoon.par...@rece.vub.ac.be wrote:
On 07/13/2015 02:34 PM, Chris Angelico wrote:
Warping your code around a recursive solution
to make it into a perfect tail call usually means making it look a lot
On 2015-07-11, Chris Angelico ros...@gmail.com wrote:
On Sat, Jul 11, 2015 at 7:28 PM, Ulli Horlacher
frams...@rus.uni-stuttgart.de wrote:
I want to start a project with python.
The program must have a (simple) GUI and must run on Linux and Windows.
The last one as standalone executable,
On 07/13/2015 02:34 PM, Chris Angelico wrote:
Warping your code around a recursive solution
to make it into a perfect tail call usually means making it look a lot
less impressive; for instance,
And sometimes your problem is very easily solved by a number of functions
that tail call each
chris laws added the comment:
I encountered this issue too. I needed it resolved ASAP for my work so I
created a loop patch that partially implements the suggestion solution by
overriding the create_datagram_endpoint method. Perhaps this might be of some
use to the eventual ticket resolver.
On Mon, Jul 13, 2015 at 11:46 PM, Ian Kelly ian.g.ke...@gmail.com wrote:
On Mon, Jul 13, 2015 at 6:34 AM, Chris Angelico ros...@gmail.com wrote:
On Mon, Jul 13, 2015 at 10:00 PM, Antoon Pardon
antoon.par...@rece.vub.ac.be wrote:
On 07/13/2015 01:28 PM, Chris Angelico wrote:
Why is it worth
On Tue, Jul 14, 2015 at 2:58 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
On Tuesday 14 July 2015 14:07, Ian Kelly wrote:
On Mon, Jul 13, 2015 at 9:23 PM, Steven D'Aprano st...@pearwood.info
wrote:
Correct. But rather than removing it, it would be better to take a leaf
out
Roundup Robot added the comment:
New changeset db825807ab04 by Robert Collins in branch 'default':
Issue #23661: unittest.mock side_effects can now be exceptions again.
https://hg.python.org/cpython/rev/db825807ab04
--
nosy: +python-dev
___
Python
New submission from Brad Larsen:
`load_newobj_ex` in can crash with a null pointer dereference.
File Modules/_pickle.c:
static int
load_newobj_ex(UnpicklerObject *self)
{
PyObject *cls, *args, *kwargs;
PyObject *obj;
PickleState *st =
On 07/13/2015 08:42 AM, Grant Edwards wrote:
If it didn't have to run on Windows, I'd pick pygtk over wx. I've
never tried qt.
PyQt is very nice to work with. In some respects it's not as Pythonic
as PyGTK. It feels a lot like transliterated C++ code, which it is.
But it's a powerful toolkit
Brad Larsen added the comment:
Seems to be similar to #24552, but not the same problem.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24630
___
Brad Larsen added the comment:
Also, it appears that the `ob_type` field of `cls` need not be NULL; it can be
an arbitrary value treated as a memory location.
Attached another POC that triggers this case.
--
Added file: http://bugs.python.org/file39922/bug-nonnull.py
Ethan Furman et...@stoneleaf.us:
I would love to see good functional examples as it is definitely a
weak spot for me.
Oh, if you want to go functional, you should look at idiomatic Scheme
code:
(define
Grégory Starck added the comment:
Have also been confronted to this bug (imo) and this happen from time to time
to me :
I often like to ends my (big) functions defs and calls (those that span over
multiple lines thus..) with that extra comma,
so that when/if I add another argument (on a
Grégory Starck added the comment:
unneeded consistency
unneeded consistency !:?
I'd say that either there is a full or complete consistency on the mentionned
point/element of syntax, or there is none .. but an unneeded one.. or an
half-one, isn't consistent consistency by then ;)
Meador Inge added the comment:
On Mon, Jul 13, 2015 at 12:04 PM, Stefan Krah rep...@bugs.python.org wrote:
I think with the ASYNC/AWAIT changes any code using tokenize.py
will have to be updated anyway in 3.5 and in 3.7 (when ASYNC/AWAIT
will finally be real keywords).
Agreed.
So this is
Antoon,
I think Chris is arguing in good faith; certainly asking for examples should be
a reasonable request.
Even if he is not, we would have better discussions and other participants
would learn more if you act like he is. I would love to see good functional
examples as it is definitely a
Stefan Krah added the comment:
+1 for python -m test.subinterpretertest. Based on my experiments,
most tests will either fail or leak memory at the very least.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24553
Hi, after having spent much time thinking about tail-call elimination
in Python (see for instance http://baruchel.github.io/blog/ ), I finally
decided to write a module for that. You may find it at:
https://github.com/baruchel/tco
Tail-call elimination is done for tail-recursion as well as for
Hi,
Quick question: why does str have both index() and find(), while list
only has index()? Is there a reason for that, or is it just an
historical accident?
Best regards,
Roel
--
The saddest aspect of life right now is that science gathers knowledge
faster than society gathers wisdom.
Meador Inge added the comment:
This looks good to me. A few questions.
The patch is fixing an obvious bug, but there could be code that
depends on the current broken behavior (the table has been incorrect
since Python 3.3). How do we feel about such breaking changes?
I am OK with this one.
Stefan Krah added the comment:
I think with the ASYNC/AWAIT changes any code using tokenize.py
will have to be updated anyway in 3.5 and in 3.7 (when ASYNC/AWAIT
will finally be real keywords).
So this is probably an ideal time for the change. I'll add tests.
--
Berker Peksag added the comment:
It would be nice to backport the patch to the 3.4 and 3.5 branches.
--
nosy: +berker.peksag
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23530
___
Roundup Robot added the comment:
New changeset b9e3838e9664 by Charles-François Natali in branch 'default':
Issue #23530: Improve os.cpu_count() description.
https://hg.python.org/cpython/rev/b9e3838e9664
--
nosy: +python-dev
___
Python tracker
Charles-François Natali added the comment:
Committed.
Julian, thanks for the patch!
--
resolution: - fixed
stage: - resolved
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23530
Changes by Berker Peksag berker.pek...@gmail.com:
--
nosy: +berker.peksag
stage: needs patch - patch review
versions: +Python 3.6
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24136
___
Changes by Robert Collins robe...@robertcollins.net:
--
type: - enhancement
versions: +Python 3.6
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24629
___
New submission from Robert Collins:
this is a bad practice - it interferes with test discovery and with the use of
mock (see https://github.com/testing-cabal/mock/issues/250).
We could move main.py to mainmod.py or something
--
messages: 246704
nosy: rbcollins
priority: normal
On 7/13/2015 7:22 AM, Jussi Piitulainen wrote:
Ian Burnette writes:
A post I did not receive, but want to comment on.
I've recently been playing around with Clojure, and I really like the
way they've overcome the JVM not supporting TRE. The way Clojure
solves this problem is to have a built
Hi all,
I want to display/update several metrics in a normal page (not in a webpy
form). These metrics got updated every minute and were stored in a log file. I
prepared a function to open that log file then analyze the last several lines
to collect them. I want these metrics got updated in
Robert Collins added the comment:
Setting some basic design parameters here.
Its ok for a test to know if it itself has decided on some status. See e.g.
testtools.expectThat for a related design thing.
Making some official API within the test itself so code after the failure can
take
New submission from Travis:
This code works fine with all my workbooks except the one with a heavier amount
of data. Please let me know if you want the excel file I am trying to open with
this code.
--
components: IDLE, IO, Installation, Interpreter Core, Library (Lib), Macintosh
Berker Peksag added the comment:
Thanks for the report, but openpyxl is not part of the Python standard library.
Please create an issue at https://bitbucket.org/openpyxl/openpyxl/issues
--
nosy: +berker.peksag
resolution: - third party
stage: - resolved
status: open - closed
On Tue, Jul 14, 2015 at 9:13 AM, yongzhi.c...@gmail.com wrote:
#in my application.py:
def checknow():
...
return TN_str
render = web.template.render('templates/',globals={'stat':checknow})
#in the template:
$def with(checknow)
... ...
h1divTest: $stat(checknow)/div/h1
You've
R. David Murray added the comment:
I think you forgot about issue 22858.
--
nosy: +r.david.murray
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24629
___
Changes by Robert Collins robe...@robertcollins.net:
--
resolution: - duplicate
superseder: - unittest.__init__:main shadows unittest.main
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24629
Robert Collins added the comment:
See also https://github.com/testing-cabal/mock/issues/250
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22858
___
Robert Collins added the comment:
This looks fine to me, I'm going to apply it.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23661
___
___
Robert Collins added the comment:
Also reported in the mock project as
https://github.com/testing-cabal/mock/issues/264
--
nosy: +rbcollins
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23661
Changes by Serhiy Storchaka storch...@gmail.com:
--
components: +Macintosh
nosy: +ned.deily, ronaldoussoren
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24627
___
eryksun added the comment:
To support cross-platform shebangs, the launcher special-cases the following
virtual commands [1]:
/usr/bin/env python
/usr/bin/python
/usr/local/bin/python
python
The env virtual command searches the PATH environment variable. Note that
it's
Neil Girdhar added the comment:
Ah, good point.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24624
___
___
Python-bugs-list mailing list
Ned Deily added the comment:
You are using a third-party build of Python from the homebrew package manager.
You probably need to install additional brew packages to provide bsddb support
so you should ask somewhere else for help with that, perhaps stackoverflow.com.
--
resolution: -
Tim Smith added the comment:
Hi; I'm a Homebrew maintainer. Please open an issue at
https://github.com/Homebrew/homebrew.
--
nosy: +tdsmith
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24627
Ned Deily added the comment:
As far as I can tell the sample program works as expected on OS X with either
Cocoa Tk or X11 Tk, in both cases (as long as the event is changed to
Button-1). I agree it's most likely a platform difference or platform bug in
Tk behavior, rather than a Python
Paul Moore added the comment:
As noted, this behaviour is as documented, and is deliberately designed to
execute the shebang line as either an executable (which calc is) or one of a
specific set of virtual entries (which does not include /bin/env).
--
resolution: - not a bug
status:
76 matches
Mail list logo