[issue2151] no way to get http result status from urllib

2008-02-21 Thread paul rubin
New submission from paul rubin: I don't see any way in the docs to get the status of an http request, in particular I want to know whether it's a 404. It does show up in the guts of the library so maybe I can extract it somehow, but there should be a simple documented way. Also, the urllib doc

[issue2138] Factorial

2008-02-21 Thread paul rubin
paul rubin added the comment: I like the idea of having some integer math functions like this in the stdlib; whether in the math module or elsewhere doesn't matter much. In particular I remember having to implement xgcd on several separate occasions for unrelated applications, each time

[issue1742669] %d format handling for long values

2008-02-21 Thread paul rubin
paul rubin added the comment: I would prefer that %d signal an error 100% of the time if you give it a float. It should not accept 42.0. It is for printing integers. -- nosy: +phr _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1742669

[issue2138] Add a factorial function

2008-03-17 Thread paul rubin
paul rubin [EMAIL PROTECTED] added the comment: Rather than factorial how about a product function, so factorial(n) = product(xrange(1,n+1)). I do like the idea of an imath module whether or not it has factorial, and the topic of this rfe has drifted somewhat towards the desirability

[issue4123] random.shuffle slow on deque

2008-10-14 Thread paul rubin
New submission from paul rubin [EMAIL PROTECTED]: This is observed in Python 2.5.1, I haven't tried any later versions. d = collections.deque(xrange(10)) random.shuffle(d) is quite slow. Increasing the size to 200k, 300k, etc. shows that the runtime increases quadratically or worse. It's

[issue4123] random.shuffle slow on deque

2008-10-16 Thread paul rubin
paul rubin [EMAIL PROTECTED] added the comment: If it's not a bug, it is at least a surprising gotcha that should be documented in the manual. The collections module is described in the library docs as high performance container datatypes but I could not possibly consider the observed behavior

[issue2857] add coded for java modified utf-8

2008-05-14 Thread paul rubin
New submission from paul rubin [EMAIL PROTECTED]: For object serialization and some other purposes, Java encodes unicode strings with a modified version of utf-8: http://en.wikipedia.org/wiki/UTF-8#Java http://java.sun.com/javase/6/docs/api/java/io/DataInput.html#modified-utf-8 It is used

[issue2857] add codec for java modified utf-8

2008-05-15 Thread paul rubin
paul rubin [EMAIL PROTECTED] added the comment: Some java applications use it externally. The purpose seems to be to prevent NUL bytes from appearing inside encoded strings which can confuse C libraries that expect NUL's to terminate strings. My immediate application is parsing lucene indexes

[issue2857] add codec for java modified utf-8

2008-05-15 Thread paul rubin
paul rubin [EMAIL PROTECTED] added the comment: Also, according to wikipedia, tcl also uses that encoding. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2857 __ ___ Python-bugs

[issue2857] add codec for java modified utf-8

2008-05-15 Thread paul rubin
paul rubin [EMAIL PROTECTED] added the comment: I'm not sure what you mean by ditto for Lucene indexes. I wasn't planning to use C code. I was hoping to write Python code to parse those indexes, then found they use this weird encoding, and Python's codec set is fairly inclusive already, so

[issue7153] add start arg to max and min functions

2009-10-16 Thread paul rubin
New submission from paul rubin p...@users.sourceforge.net: Lots of times I want to find the largest element of a list or sequence, defaulting to 0 if the list or sequence is empty. max(seq) throws an exception if seq is empty, so I end up using reduce(max, seq, 0). That is a standard

[issue7153] add start arg to max and min functions

2009-10-16 Thread paul rubin
Changes by paul rubin p...@users.sourceforge.net: -- type: - feature request ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7153 ___ ___ Python

[issue7153] add start arg to max and min functions

2009-10-16 Thread paul rubin
paul rubin p...@users.sourceforge.net added the comment: David, I'm not on that mailing list so hadn't seen the earlier discussion. I sympathasize with Raymond's YAGNI argument because I'm comfortable with reduce(max,seq,0); but then I remember there was once a movement to remove the reduce

[issue7153] add start arg to max and min functions

2009-10-17 Thread paul rubin
paul rubin p...@users.sourceforge.net added the comment: 1. Yes, the idea is to figure out the best solution and go with it (or decide to do nothing). That many possibilities exist just points to the need for experience and wisdom in identifying the best choice (one and preferably only one

[issue1560032] confusing error msg from random.randint

2009-03-29 Thread paul rubin
paul rubin p...@users.sourceforge.net added the comment: ajaksu2, I don't understand why you want to close this bug if it isn't fixed. I can accept that it's not the highest priority issue in the world, but it's something that trips up users from time to time, and it ix obviously fixable

[issue1560032] confusing error msg from random.randint

2009-03-30 Thread paul rubin
paul rubin p...@users.sourceforge.net added the comment: Daniel, thanks--I didn't mean to jump on you, so I'm sorry if it came across that way. Maybe I'm a little oversensitized to this issue due to some unrelated incidents with other programs. I'll try to write a more detailed reply and maybe

[issue5784] raw deflate format and zlib module

2009-04-17 Thread paul rubin
New submission from paul rubin p...@users.sourceforge.net: The zlib module doesn't support raw deflate format, so it doesn't completely interoperate with php's gzdeflate function and fails to decompress some strings that web browsers can decompress. A workaround is to use a special zlib feature

[issue5784] raw deflate format and zlib module

2009-04-17 Thread paul rubin
Changes by paul rubin p...@users.sourceforge.net: -- components: +Library (Lib) type: - feature request versions: +Python 2.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5784

[issue5784] raw deflate format and zlib module

2009-04-17 Thread paul rubin
paul rubin p...@users.sourceforge.net added the comment: I should have mentioned, the docs do say When wbits is negative, the standard gzip header is suppressed; this is an undocumented feature of the zlib library, used for compatibility with unzip‘s compression file format but this wasn't

[issue5784] raw deflate format and zlib module

2015-04-26 Thread paul rubin
paul rubin added the comment: Hey, thanks for updating this. I still remember the nasty incident that got me filing this report in the first place. I'll look at the patch more closely when I get a chance, but the immediate comment I'd make is it's worth adding a sentence saying explicitly

[issue38333] add type signatures to library function docs

2019-09-30 Thread paul rubin
New submission from paul rubin : It would be nice if the library reference manual had type signatures for all the stdlib functions at some point. It might be possible to extract a lot of them automatically from typeshed and semi-automatically paste them into the doc files. It might also

[issue38333] add type signatures to library function docs

2019-10-02 Thread paul rubin
paul rubin added the comment: Yes, the suggestion was just for the docs, and since those are intended for human rather than machine consumption, it's fine if there are some blurry cases where there is no signature. Ideally in those cases, the issue should be explained in the doc text. I

[issue38333] add type signatures to library function docs

2019-10-02 Thread paul rubin
paul rubin added the comment: abs takes any value that understands the __abs__ method and returns something of the same type. In fact there is already a type protocol for it: https://mypy.readthedocs.io/en/stable/protocols.html#supportsabs-t So abs's signature would be (x : Abs[T]) ->

[issue38333] add type signatures to library function docs

2019-10-03 Thread paul rubin
paul rubin added the comment: At first glance, having a typeclass for each protocol (at least the widely used ones) seems fine. It's inherent in Haskell and a lot of libraries are organized around a common set of typeclasses--look up "Typeclassopedia" for descriptions of them.

[issue38333] add type signatures to library function docs

2019-10-03 Thread paul rubin
paul rubin added the comment: I don't think we're going to accomplish anything continuing the eternal static-vs-dynamic debate, which in Python's case has already been resolved by adding optional static typing. It's a done deal, and the issue here is just how to document it. Erlang (via

[issue40411] frozen collection.Counter

2020-04-27 Thread paul rubin
New submission from paul rubin : It would be nice to have frozen Counters analogous to frozensets, so they are usable as dictionary keys. One can of course create frozenset(counter.items()) but that means the set items are tuples rather than the original set elements, so it's no longer

[issue40334] PEP 617: new PEG-based parser

2020-04-27 Thread paul rubin
Change by paul rubin : -- nosy: -phr ___ Python tracker <https://bugs.python.org/issue40334> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue1726707] add itertools.ichain function and count.getvalue

2020-04-27 Thread paul rubin
paul rubin added the comment: Note, nowadays this is implement as itertools.chain.from_iterable . -- ___ Python tracker <https://bugs.python.org/issue1726

[issue40334] PEP 617: new PEG-based parser

2020-04-27 Thread paul rubin
paul rubin added the comment: I just saw this. Interesting. Sometimes I use ast.literal_eval to read big, deeply nested data objects. I can probably convert to JSON if necessary but it's another thing to watch out for. I might try to benchmark some of these. -- nosy: +phr

[issue40411] frozen collection.Counter

2020-04-27 Thread paul rubin
paul rubin added the comment: Kyle, thanks, I saw your comment after posting my own, and I looked at Raymond's mailing list post that you linked. I do think that "completing the grid" is a good thing in the cases where it's obvious how to do it (if there's one and one o

[issue40411] frozen collection.Counter

2020-04-27 Thread paul rubin
paul rubin added the comment: Totally tangential: Veky, your ordinal example would work ok in Haskell and you'd have omega work the same way as epsilon0. Take a look at Herman Ruge Jervell's book "Proof Theory" for a really nice tree-based ordinal notation that goes much h

[issue40411] frozen collection.Counter

2020-04-27 Thread paul rubin
paul rubin added the comment: Yes, the idea was for them to be hashable, to be used as dict keys. E.g. if you use frozensets to model graphs, you'd use frozen multisets for hypergraphs. My immediate use case involved word puzzles, e.g. treating words as bags of scrabble tiles with letters

[issue40411] frozen collection.Counter

2020-04-27 Thread paul rubin
paul rubin added the comment: Yeah I think the basic answer to this ticket is "Python doesn't really have multisets and a proposal to add them should go somewhere else". Fair enough-- consider the request withdrawn from here. Regarding minimalism vs completeness, regarding some

[issue40411] frozen collection.Counter

2020-04-27 Thread paul rubin
paul rubin added the comment: Oops I meant "*without* 100s of third party modules" in the case of ruby gems or npm. There are just a few pip modules that I really use all the time, most notably bs4. I continue to use urllib/urllib2 instead of requests because I'm used to them a

[issue40028] Math module method to find prime factors for non-negative int n

2020-05-14 Thread paul rubin
paul rubin added the comment: I don't think the interface needs much bikeshedding, as long as the implementer chooses something reasonable. E.g. factor(30) gives the list [2,3,5]. Implementation is harder if you want to handle numbers of non-trivial size. Neal Koblitz's book "A C

[issue40623] JSON streaming

2020-05-14 Thread paul rubin
paul rubin added the comment: Also I didn't know about ndjson (I just looked at it, ndjson.org) but its existence and formalization is even more evidence that this is useful. I'll check what the two different python modules linked from that site do that's different from your example

[issue40028] Math module method to find prime factors for non-negative int n

2020-05-14 Thread paul rubin
paul rubin added the comment: I'm the one always asking for more stuff in the stdlib, but above some simplistic approaches this seems out of scope. Doing it usefully above say 2**32 requires fancy algorithms. Better to use some external package that implements that stuff. -- nosy

[issue40623] JSON streaming

2020-05-14 Thread paul rubin
New submission from paul rubin : This is a well-explored issue in other contexts: https://en.wikipedia.org/wiki/JSON_streaming There is also a patch for it in json.tool, for release in 3.9: https://bugs.python.org/issue31553 Basically it's often convenient to have a file containing a list

[issue40411] frozen collection.Counter

2020-05-14 Thread paul rubin
paul rubin added the comment: Note: PEP 603 may essentially take care of this, if it is accepted. -- ___ Python tracker <https://bugs.python.org/issue40

[issue40623] JSON streaming

2020-05-14 Thread paul rubin
paul rubin added the comment: Note: the function in my attached file wants no separation at all between the json docs (rather than a newline between them), but that was ok for the application I wrote it for some time back. I forgot about that when first writing this rfe so thought I better

[issue40623] JSON streaming

2020-05-14 Thread paul rubin
Change by paul rubin : Added file: https://bugs.python.org/file49154/jsonstream.py ___ Python tracker <https://bugs.python.org/issue40623> ___ ___ Python-bugs-list mailin

[issue36027] Support negative exponents in pow() where a modulus is specified.

2020-05-14 Thread paul rubin
paul rubin added the comment: https://bugs.python.org/issue457066 The old is new again ;-). -- nosy: +phr ___ Python tracker <https://bugs.python.org/issue36

[issue40623] JSON streaming

2020-05-14 Thread paul rubin
paul rubin added the comment: It's coming back to me, I think I used the no-separator format because I made the multi-document input files by using json.dump after opening the file in append mode. That seems pretty natural. I figured the wikipedia article and the json.tool patch just

[issue40733] Make IDLE doc more visible, mention in main python docs page

2020-05-23 Thread paul rubin
paul rubin added the comment: I think I used duckduckgo to find the docs. They don't change much between versions and I was trying to find how to do a specific thing. My installation has the docs included but it didn't explain how to do what I wanted, so I had hoped there was a more

[issue40734] /usr/bin surprisingly in sys.path under IDLE

2020-05-25 Thread paul rubin
paul rubin added the comment: Matthias, I get the same result you do when I run python from the shell command line. I see /usr/bin in the path when I import sys and print sys.path from inside IDLE. In other words this is an IDLE configuration oddity. Again I don't know if it's a bug

[issue40734] /usr/bin surprisingly in sys.path under IDLE

2020-05-25 Thread paul rubin
paul rubin added the comment: I'm using Debian 10 MATE live install and have been running IDLE by clicking an icon on the top panel, but I just tried running IDLE from the shell prompt in a terminal window, and also see /usr/bin in the path. In both cases, the output of os.system('pwd

[issue40734] /usr/bin surprisingly in sys.path under IDLE

2020-05-26 Thread paul rubin
paul rubin added the comment: Yes as mentioned I'm running Debian GNU/Linux, not Windows. By "idle is installed in /usr/bin" I mean that it is an executable shell script stored at /usr/bin/idle . Yes, shell prompt is the $ prompt to bash. When I run "python3 -m idlelib&

[issue40733] mention IDLE in main python docs page

2020-05-22 Thread paul rubin
Change by paul rubin : -- title: mention IDLE in main python ocs page -> mention IDLE in main python docs page ___ Python tracker <https://bugs.python.org/issu

[issue40734] /usr/bin surprisingly in sys.path under IDLE

2020-05-22 Thread paul rubin
New submission from paul rubin : This is in the standard python 3.7.3 install under Debian 10. It's possible that this is on purpose, and it's (separately) possible that the Debian packagers did this for some reason. I'm not sure it's a bug but am reporting it as it's an oddity that might

[issue40733] mention IDLE in main python ocs page

2020-05-22 Thread paul rubin
New submission from paul rubin : The IDLE documentation is in https://docs.python.org/3/library/idle.html which is not where I'd have thought to look for it, since I think of IDLE as an application rather than a library. So I looked for it on the main docs page, docs.python.org, and didn't

[issue44571] itertools: takedowhile()

2021-10-11 Thread paul rubin
paul rubin added the comment: Oh wow, before_and_after will go into the itertools module per that patch? I found this issue while looking for a way to this, but had written the following implementation: def span(pred, xs): # split xs into two iterators a,b where a() is the prefix of xs

[issue44571] itertools: takedowhile()

2021-10-11 Thread paul rubin
paul rubin added the comment: Bah, the above doesn't work in the cases where the iterator is empty or (different symptom) where the tail part is empty. Rather than posting a corrected version (unless someone wants it) I'll just say not to use that code fragment, but that the intended API

[issue47257] add methods to get first and last elements of a range

2022-04-08 Thread paul rubin
New submission from paul rubin : Inspired by a question on comp.lang.python about how to deal with an int set composed of integers and ranges. Range objects like range(1,5,2) contain start, stop, and step values, but it's messy and potentially tricky to get the actual first and last values

[issue47257] add methods to get first and last elements of a range

2022-04-08 Thread paul rubin
paul rubin added the comment: Oh nice, I didn't realize you could do that. len(range) and bool(range) (to test for empty) also work. Ok I guess this enhancement is not needed. I will close ticket, hope that is procedurally correct, otherwise feel free to fix. Thanks

[issue24820] IDLE themes for light on dark

2015-09-30 Thread Marc Paul Rubin
Marc Paul Rubin added the comment: Greetings from an idle-dev 'lurker.' Has anyone tested the new dark theme with a Set Breakpoint command? The dark theme is great for me except for this quirk: breakpoints are invisible on my test box. Under the Classic light scheme breakpoints appear