[issue14927] add "Do not supply 'int' argument" to random.shuffle docstring

2013-10-05 Thread Christopher Smith

Christopher Smith added the comment:

On Sun, Oct 6, 2013 at 12:14 AM, Raymond Hettinger
wrote:

>
> Raymond Hettinger added the comment:
>
> Christopher, this tracker item needs to die.  It is wasting everyone's
> time (and churning code) over nothing.
>
>
but it's not quite dead yet...

> FYI, I moved the _int=int for shuffle inside the function because the
> assignment was outside of the inner loop, so we weren't getting any real
> benefit.
>

but cf Tim's comment regarding the advantage of leaving it in the arg list
so that the lookup is fast:

[Senthil Kumaran]
> I am unaware of the optimization technique you refer to as
> well, it will helpful if you could point to any resource.

It's an old trick since the very first Pythons:  global lookups are
much slower than local lookups (the difference between the LOAD_GLOBAL
and LOAD_FAST opcodes in CPython).  Putting:

 ..., _fast=slow, ...

in an argument list means we endure the slow lookup (of `slow`) only
once, when the function is first defined.  When the function is
_called_, that binding is available via the local (much faster lookup)
variable `_fast`.

Purely a speed trick, but can make a real difference in very heavily
used functions.

--

So by removing it from the arg list you have perhaps caused a regression in
performance of shuffle. Other than that, everything looks fine to me.

Thanks,
 Chris

--

___
Python tracker 
<http://bugs.python.org/issue14927>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14927] add "Do not supply 'int' argument" to random.shuffle docstring

2013-10-05 Thread Christopher Smith

Christopher Smith added the comment:

In 3.3 and 3.4 I would just change the shuffle arg from `int=int` to
`_int=int` and delete the comment in docstring regarding not supplying the
value. (In both you *removed* the argument and internally added `_int=int`.)

Note that (as far as I can see) in 3.3 you didn't remove the comment in the
docstring of shuffle like you did in 3.4

/c

On Sat, Oct 5, 2013 at 11:54 PM, Raymond Hettinger
wrote:

>
> Raymond Hettinger added the comment:
>
> Py3.3: http://hg.python.org/cpython/rev/0899960835f5
> Py3.4: http://hg.python.org/cpython/rev/8494d2c8ef54
>
> --
>
> ___
> Python tracker 
> <http://bugs.python.org/issue14927>
> ___
>

--

___
Python tracker 
<http://bugs.python.org/issue14927>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14927] add "Do not supply 'int' argument" to random.shuffle docstring

2013-10-05 Thread Christopher Smith

Christopher Smith added the comment:

I probably wouldn't have noticed it except I was working more intensely
with the different random methods and saw that randrange had the note about
not supplying the 'int' argument and shuffle (though it had the same sort
of argument) did *not* have the comment. So that raised the issue for me.
Proabably the best thing would be do remove the comment from randrange and
make sure that the not-to-mess-with args are made private with the
underscore.

/c

--

___
Python tracker 
<http://bugs.python.org/issue14927>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14927] add "Do not supply 'int' argument" to random.shuffle docstring

2012-06-11 Thread Christopher Smith

Christopher Smith  added the comment:

On Tue, Jun 12, 2012 at 1:34 AM, Michael Driscoll
 wrote:
>
> Michael Driscoll  added the comment:
>
> I added the extra information to the docstring for the shuffle method and 
> attached a patch.

Thanks Michael (and Python team)!

Chris

--

___
Python tracker 
<http://bugs.python.org/issue14927>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14926] random.seed docstring needs edit of "*a *is"

2012-06-01 Thread Christopher Smith

Christopher Smith  added the comment:

On Fri, Jun 1, 2012 at 11:47 PM, Éric Araujo  wrote:
>
> Éric Araujo  added the comment:
>
> Thanks.  Have you noticed similar typos in the rest of the module, or the 
> reST docs?

I grepped for orphaned asterisks, as I recall, and didn't find any others.

/c

--

___
Python tracker 
<http://bugs.python.org/issue14926>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14927] add "Do not supply int argument" to random.shuffle docstring

2012-05-28 Thread Christopher Smith

Christopher Smith  added the comment:


> nosy: +rhettinger
> title: add not about int to shuffle -> add "Do not supply int argument" to 
> random.shuffle docstring
> versions: +Python 2.7, Python 3.3
>

Thanks. I couldn't even figure out what my own subject meant! (I see
that the "e" was missing from "note"; yours is much better.

Chris

--

___
Python tracker 
<http://bugs.python.org/issue14927>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14927] add not about int to shuffle

2012-05-27 Thread Christopher Smith

New submission from Christopher Smith :

In randrange there is the note, "Do not supply the 'int' argument." That could 
probably be added to shuffle, too.

--
components: Library (Lib)
messages: 161710
nosy: smichr
priority: normal
severity: normal
status: open
title: add not about int to shuffle
versions: Python 3.2

___
Python tracker 
<http://bugs.python.org/issue14927>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14926] random.seed docstring needs edit of "*a *is"

2012-05-27 Thread Christopher Smith

New submission from Christopher Smith :

In the following, the asterisk and space should change places so

  bits are used if *a *is a str,

would appear as 

  bits are used if *a* is a str,

--
components: Library (Lib)
messages: 161709
nosy: smichr
priority: normal
severity: normal
status: open
title: random.seed docstring needs edit of "*a *is"
versions: Python 3.2

___
Python tracker 
<http://bugs.python.org/issue14926>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13439] turtle: Errors in docstrings of onkey and onkeypress

2011-12-03 Thread Christopher Smith

Christopher Smith  added the comment:

> resolution:  -> fixed
> stage: needs patch -> committed/rejected
> status: open -> closed
>

Nice to see a good thing get even better. Thanks for you work.

Chris Smith

--

___
Python tracker 
<http://bugs.python.org/issue13439>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13439] turtle docstring for onkeyrelease references onkey, not onkeyrelease

2011-11-23 Thread Christopher Smith

Christopher Smith  added the comment:

Sorry for the misdirection:

The docstring example for onkeypress is written using onkey instead of 
onkeypress. (There is no problem for onkey and onkeyrelease.)

--
resolution: wont fix -> 
status: closed -> open

___
Python tracker 
<http://bugs.python.org/issue13439>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13439] turtle docstring for onkeyrelease references onkey, not onkeyrelease

2011-11-20 Thread Christopher Smith

New submission from Christopher Smith :

The docstring example is written using onkey instead of onkeyrelease.

--
components: Library (Lib)
messages: 147995
nosy: smichr
priority: normal
severity: normal
status: open
title: turtle docstring for onkeyrelease references onkey, not onkeyrelease
versions: Python 3.2

___
Python tracker 
<http://bugs.python.org/issue13439>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com