[issue11992] sys.settrace doesn't disable tracing if a local trace function returns None

2017-01-18 Thread Armin Rigo
Armin Rigo added the comment: Confirmed. More interestingly, nowadays (at least in 3.5) test_pdb.py depends on this bug. If we really clear f->f_trace when the trace function returns None, then test_pdb_until_command_for_generator() fails. This is because pdb.py incorrectly thi

Re: Inplace shuffle function returns none

2016-10-19 Thread Sayth Renshaw
Hi Chris I read this last night and thought i may have woken with a frightfully witty response. I didnt however. Thanks :-) -- https://mail.python.org/mailman/listinfo/python-list

Re: Inplace shuffle function returns none

2016-10-19 Thread Chris Angelico
On Wed, Oct 19, 2016 at 6:01 PM, Sayth Renshaw wrote: > Ok i think i do understand it. I searched the python document for in-place > functions but couldn't find a specific reference. > > Is there a particular part in docs or blog that covers it? Or is it > fundamental to

Re: Inplace shuffle function returns none

2016-10-19 Thread Ben Finney
Sayth Renshaw writes: > Ok i think i do understand it. I searched the python document for > in-place functions but couldn't find a specific reference. They aren't a separate kind of function. A function can do anything Python code can do; indeed, most Python programs

Re: Inplace shuffle function returns none

2016-10-19 Thread Peter Otten
Steve D'Aprano wrote: > On Wed, 19 Oct 2016 07:25 am, Sayth Renshaw wrote: > >> So why can't i assign the result slice to a variable b? >> >> It just keeps getting none. > > Of course you can assign the result slice to b. You just have to do it the > right way. > > You keep getting None

Re: Inplace shuffle function returns none

2016-10-19 Thread Sayth Renshaw
Ok i think i do understand it. I searched the python document for in-place functions but couldn't find a specific reference. Is there a particular part in docs or blog that covers it? Or is it fundamental to all so not explicitly treated in one particular page? Thanks Sayth --

Re: Inplace shuffle function returns none

2016-10-18 Thread Steve D'Aprano
On Wed, 19 Oct 2016 07:25 am, Sayth Renshaw wrote: > So why can't i assign the result slice to a variable b? > > It just keeps getting none. Of course you can assign the result slice to b. You just have to do it the right way. You keep getting None because you do it the wrong way.

Re: Inplace shuffle function returns none

2016-10-18 Thread John Gordon
In <9d24f23c-b578-4029-ab80-f117599e2...@googlegroups.com> Sayth Renshaw writes: > So why can't i assign the result slice to a variable b? Because shuffle() modifies the list directly, and returns None. It does NOT return the shuffled list. -- John Gordon

Re: Inplace shuffle function returns none

2016-10-18 Thread breamoreboy
On Tuesday, October 18, 2016 at 9:25:19 PM UTC+1, Sayth Renshaw wrote: > So why can't i assign the result slice to a variable b? > > It just keeps getting none. > > Sayth You are misunderstanding something that is fundamental in Python, namely that anything that is done inplace *ALWAYS*

Re: Inplace shuffle function returns none

2016-10-18 Thread Ian Kelly
On Tue, Oct 18, 2016 at 2:25 PM, Sayth Renshaw wrote: > So why can't i assign the result slice to a variable b? > > It just keeps getting none. Because shuffle returns none. If you want to keep both the original list and the shuffled list, then do something like: b =

Re: Inplace shuffle function returns none

2016-10-18 Thread Sayth Renshaw
So why can't i assign the result slice to a variable b? It just keeps getting none. Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Inplace shuffle function returns none

2016-10-18 Thread John Gordon
In Sayth Renshaw writes: > If shuffle is an "in place" function and returns none how do i obtain > the values from it. The values are still in the original object -- variable "a" in your example. > from random

Re: Inplace shuffle function returns none

2016-10-18 Thread Chris Angelico
On Wed, Oct 19, 2016 at 1:48 AM, Sayth Renshaw wrote: > If shuffle is an "in place" function and returns none how do i obtain the > values from it. > > from random import shuffle > > a = [1,2,3,4,5] > b = shuffle(a) > print(b[:3]) > > For example here i just want to slice

Inplace shuffle function returns none

2016-10-18 Thread Sayth Renshaw
If shuffle is an "in place" function and returns none how do i obtain the values from it. from random import shuffle a = [1,2,3,4,5] b = shuffle(a) print(b[:3]) For example here i just want to slice the first 3 numbers which should be shuffled. However you can't slice a noneType object that b

[issue20040] Tracing not disabled in generator when the system trace function returns None.

2013-12-21 Thread Xavier de Gaye
when the system trace function returns None. type: behavior versions: Python 3.4 Added file: http://bugs.python.org/file33244/tracer.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20040

[issue20040] Tracing not disabled in generator when the system trace function returns None.

2013-12-21 Thread Xavier de Gaye
Xavier de Gaye added the comment: A patch is proposed in issue 20041. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20040 ___ ___

[issue11992] sys.settrace doesn't disable tracing if a local trace function returns None

2013-12-21 Thread Xavier de Gaye
Xavier de Gaye added the comment: See also issue 20040. -- nosy: +xdegaye ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11992 ___ ___

[issue20040] Tracing not disabled in generator when the system trace function returns None.

2013-12-21 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +nedbat ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20040 ___ ___ Python-bugs-list

[issue20040] Tracing not disabled in generator when the system trace function returns None.

2013-12-21 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +pitrou, serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20040 ___ ___

[issue11992] sys.settrace doesn't disable tracing if a local trace function returns None

2011-05-03 Thread Ned Batchelder
(Lib) messages: 135089 nosy: nedbat priority: normal severity: normal status: open title: sys.settrace doesn't disable tracing if a local trace function returns None type: behavior versions: Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http

[issue11992] sys.settrace doesn't disable tracing if a local trace function returns None

2011-05-03 Thread Ned Batchelder
Changes by Ned Batchelder ned...@users.sourceforge.net: -- assignee: - nedbat ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11992 ___ ___

Function returns none

2005-10-31 Thread noahlt
I'm trying to write a website updating script, but when I run the script, my function to search the DOM tree returns None instead of what it should. I have this program: import sys from xml.dom.minidom import parse # search the tree for an element with a particular class def

Re: Function returns none

2005-10-31 Thread Carsten Haese
On Mon, 2005-10-31 at 14:12, [EMAIL PROTECTED] wrote: I'm trying to write a website updating script, but when I run the script, my function to search the DOM tree returns None instead of what it should. I have this program: import sys from xml.dom.minidom import parse #

Re: Function returns none

2005-10-31 Thread Kent Johnson
[EMAIL PROTECTED] wrote: I'm trying to write a website updating script, but when I run the script, my function to search the DOM tree returns None instead of what it should. When you call findelement() recursively you have to return the value from the recursive call to the next caller up. See

Re: Function returns none

2005-10-31 Thread noahlt
Thanks, that worked! -- http://mail.python.org/mailman/listinfo/python-list