[issue32656] writing to stdout prints extraneous size character

2018-01-24 Thread David Albert Torpey
New submission from David Albert Torpey <dt...@users.sourceforge.net>: $ python3.5 Python 3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 08:49:46) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "lice

[issue11967] Left shift and Right shift for floats

2011-04-30 Thread David Albert Torpey
New submission from David Albert Torpey dt...@users.sourceforge.net: I would like to left and right shift floats as a fast way to multiply or divide by a power of 2 without rounding error. The only way to do that now is t=frexp(x) and y=ldexp(t[0],t[1]+2). But would be better to type y=x2

[issue11756] bytes.hex()

2011-04-03 Thread David Albert Torpey
New submission from David Albert Torpey dt...@users.sourceforge.net: Floats have fromhex() and hex() to round-trip from and to hexadecimal, but bytes only have fromhex(), so it's hard to reliably round-trip. -- messages: 132892 nosy: dtorp priority: normal severity: normal status: open

[issue9685] tuples should remember their hash value

2010-08-25 Thread David Albert Torpey
New submission from David Albert Torpey dt...@users.sourceforge.net: Dictionary keys are commonly numbers, strings, or tuples. Python has optimized numbers and strings to remember their hash values on successive calls. Tuples should do this too since their recursive hash function can take

[issue8551] Start argument for str.rfind used incorrectly

2010-04-27 Thread David Albert Torpey
New submission from David Albert Torpey dt...@users.sourceforge.net: The purpose of the start argument in str.find() and str.rfind() is to allow for repeated searches. def find_third_occurrence(s, value): ... p = s.find(value) ... p = s.find(value, p+1) ... return s.find(value

[issue1771] Remove cmp parameter to list.sort() and builtin.sorted()

2010-03-31 Thread David Albert Torpey
David Albert Torpey dt...@users.sourceforge.net added the comment: sorted(tree, cmp=lambda x, y: 1 if x in tree[y] else -1 if y in tree[x] else 0) and it gets ['A', 'C', 'B', 'E', 'D']. That cmp function is nonsense and isn't even close to being correct: from random import shuffle for i

[issue2138] Factorial

2008-02-19 Thread David Albert Torpey
David Albert Torpey added the comment: Mr. Dickinson thank you for doing this. I do not know how to help with a patch. If it helps, here is the code I use in python: def factorial(n, _known=[1]): assert isinstance(n, int), Need an integer. This isn't a gamma assert n = 0, Sorry

[issue2138] Factorial

2008-02-18 Thread David Albert Torpey
New submission from David Albert Torpey: Add a factorial method. Everybody understands what it means before they are out of high school and it comes up all the time in statistics and combinatorics. Ruby has a factorial method and heck even basic calculators have a factorial key. print