[issue29036] logging module: Add `full_module_name` to LogRecord details

2018-08-08 Thread Ram Rachum
Ram Rachum added the comment: Hi Vinay, Since it's been a couple of years since I opened this ticket, I can't tell you the case in which I wanted to know the full module name of a logger. But it's probably been a logger from a third-party library. Since I can't force a third-party library

[issue29036] logging module: Add `full_module_name` to LogRecord details

2016-12-21 Thread Ram Rachum
New submission from Ram Rachum: LogRecord currently supplies `module` that you can show in your messages, but it's just the name of the module without the path. It'll be nice to have `full_module_name` that has the qualified name (e.g. foo.bar.baz instead of baz.) Usually it's the logger's

[issue28953] Use `raise from` when raising new IncompleteRead

2016-12-12 Thread Ram Rachum
Changes by Ram Rachum <r...@rachum.com>: -- type: -> behavior ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28953> ___ ___

[issue28953] Use `raise from` when raising new IncompleteRead

2016-12-12 Thread Ram Rachum
New submission from Ram Rachum: I had this error come up in my code, and because it doesn't use `raise ... from` I thought that the second error was unexpected, while in fact it wasn't. This patch should fix that. -- components: Library (Lib) files: 1.patch keywords: patch messages

[issue28817] Provide method PurePath.quote() that calls shlex.quote

2016-11-28 Thread Ram Rachum
Changes by Ram Rachum <r...@rachum.com>: -- versions: +Python 3.7 -Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue28817] Provide method PurePath.quote() that calls shlex.quote

2016-11-28 Thread Ram Rachum
New submission from Ram Rachum: I have a a PurePath object like so: path = PurePath('/home/my awesome user/file.txt') I'm SSHing into a server and I want to remove the file. So I have to do this: ssh_client.run(f'/bin/rm {shlex.quote(str(path))}') Which is really long and ugly

[issue28811] Make pathlib.PurePath.__str__ use shlex.quote

2016-11-28 Thread Ram Rachum
Ram Rachum added the comment: I understand now, you're completely right. This change would break the entire world :) -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue28811] Make pathlib.PurePath.__str__ use shlex.quote

2016-11-27 Thread Ram Rachum
Ram Rachum added the comment: "This will break any code that pass str(path) to API that doesn't support pathlib." I don't understand. Can you give a concrete example of code it would break? -- ___ Python tracker <rep...@bugs.pyth

[issue28811] Make pathlib.PurePath.__str__ use shlex.quote

2016-11-27 Thread Ram Rachum
New submission from Ram Rachum: I have a a PurePath object like so: path = PurePath('/home/my awesome user/file.txt') I'm SSHing into a server and I want to remove the file. So I have to do this: ssh_client.run(f'/bin/rm {shlex.quote(str(path))}') Which is really long and ugly

[issue28624] Make the `cwd` argument to `subprocess.Popen` accept a `PathLike`

2016-11-06 Thread Ram Rachum
Changes by Ram Rachum <r...@rachum.com>: -- components: Library (Lib) nosy: cool-RR priority: normal severity: normal status: open title: Make the `cwd` argument to `subprocess.Popen` accept a `PathLike` versions: Python 3.7 ___ Python tracke

[issue28624] Make the `cwd` argument to `subprocess.Popen` accept a `PathLike`

2016-11-06 Thread Ram Rachum
Changes by Ram Rachum <r...@rachum.com>: -- type: -> enhancement ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28624> ___ ___

[issue28623] Let `shlex.quote` accept a `PathLike` object

2016-11-06 Thread Ram Rachum
New submission from Ram Rachum: Currently it complains that you haven't fed it a string-like object. -- components: Library (Lib) messages: 280133 nosy: cool-RR priority: normal severity: normal status: open title: Let `shlex.quote` accept a `PathLike` object type: enhancement versions

[issue28608] Support creating hardlink using `pathlib`

2016-11-04 Thread Ram Rachum
Changes by Ram Rachum <r...@rachum.com>: -- components: Library (Lib) nosy: cool-RR priority: normal severity: normal status: open title: Support creating hardlink using `pathlib` type: enhancement versions: Python 3.7 ___ Python tracke

[issue28560] Implement `PurePath.startswith` and `PurePath.endswith`

2016-10-30 Thread Ram Rachum
Ram Rachum added the comment: Thanks. -- resolution: -> wont fix status: open -> closed ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue28560] Implement `PurePath.startswith` and `PurePath.endswith`

2016-10-30 Thread Ram Rachum
Ram Rachum added the comment: I mean that `/foo` is one of the parent directories. "there are plenty of options ..." Can you please spell them out precisely? The full line of code. -- ___ Python tracker <rep...@bugs.pyth

[issue28560] Implement `PurePath.startswith` and `PurePath.endswith`

2016-10-29 Thread Ram Rachum
New submission from Ram Rachum: Today I had to check whether a path object started with `/foo`. The nicest way I could think of was `str(p).startswith('/foo')`. What do you think about implementing `p.startswith('/foo')`? -- components: Library (Lib) messages: 279699 nosy: cool-RR

[issue28335] Exception reporting in `logging.config`

2016-10-03 Thread Ram Rachum
Ram Rachum added the comment: Thanks for the quick fix Vinay! -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28335> ___ ___ Pyth

[issue28335] Exception reporting in `logging.config`

2016-10-02 Thread Ram Rachum
Ram Rachum added the comment: Thanks for the patch sreyas! Maybe we should also take this opportunity to remove the string formatting from the exception that shows the name of the original exception? Because when you think about it, it's just a poor man's `raise from

[issue28335] Exception reporting in `logging.config`

2016-10-02 Thread Ram Rachum
Ram Rachum added the comment: You're right Vinay: I missed that first traceback because I wasn't running code in the console, I was running it with a debugger. (I'll ask my debugger vendor to maybe include these extra tracebacks.) But in any case, I think that the correct way to raise would

[issue28335] Exception reporting in `logging.config`

2016-10-01 Thread Ram Rachum
Ram Rachum added the comment: I now see similar raises that could use a `from` in other places in this module, so I'd suggest going over the module and putting `from`s all over the place. -- ___ Python tracker <rep...@bugs.python.org>

[issue28335] Exception reporting in `logging.config`

2016-10-01 Thread Ram Rachum
New submission from Ram Rachum: In `logging.config.DictConfigurator.configure`, there are exceptions that are caught and then replaced with `ValueError` exceptions. I think you should use the `raise x from y` syntax so that the original tracebacks will be preserved. (I'm debugging

[issue28278] Make `weakref.WeakKeyDictionary.__repr__` meaningful

2016-09-26 Thread Ram Rachum
New submission from Ram Rachum: Both `WeakKeyDictionary` and `WeakValueDictionary` have opaque `__repr__` methods: >>> x = weakref.WeakKeyDictionary({object: 2, type: 4,}) >>> x >>> dict(x) {: 4, : 2} This makes it annoying to view them at a glance. Is there a re

[issue27775] `shlex.split(None)` causes infinite loop

2016-08-16 Thread Ram Rachum
New submission from Ram Rachum: I had a code that would freeze, and after debugging I realized that a bug in my code caused `shlex.split(None)` to be called, which puts Python in an infinite loop. We probably want to do an `if not isinstance(s, ...): raise TypeError('Bla bla')` at the start

[issue27181] Add geometric mean to `statistics` module

2016-08-09 Thread Ram Rachum
Ram Rachum added the comment: I meant the mathematical definition. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27181> ___ ___

[issue27181] Add geometric mean to `statistics` module

2016-08-09 Thread Ram Rachum
Ram Rachum added the comment: Also... I like the detailed docstrings with the real-life examples! That stuff helps when coding and using an unfamiliar function (since I see the docs in a panel of my IDE), so I wish I'd see more detailed docstrings like these ones in the standard library

[issue27181] Add geometric mean to `statistics` module

2016-08-09 Thread Ram Rachum
Ram Rachum added the comment: Thanks for the patch Steven! I won't comment about the code because I don't know enough about these algorithms, but I'm thinking, since you also did a refactoring of the statistics module, maybe these should be two separate patches/commits so it'll be easy to see

[issue27650] Implement `__repr__` methods for logging.Logger and others

2016-08-06 Thread Ram Rachum
Ram Rachum added the comment: Okay, but consider that if there are no tests, this code will never be run during testing. Consider that if there's a bug in that code that causes an exception to be raised (unlikely, I know, but maybe from the call to getLevelName) it won't be discovered until

[issue27650] Implement `__repr__` methods for logging.Logger and others

2016-08-06 Thread Ram Rachum
Ram Rachum added the comment: If you want, I can implement them. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27650> ___ ___

[issue27650] Implement `__repr__` methods for logging.Logger and others

2016-08-06 Thread Ram Rachum
Ram Rachum added the comment: Vinay: Looks good to me. What do you think about adding tests? -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue27604] More details about `-O` flag

2016-07-30 Thread Ram Rachum
Ram Rachum added the comment: Well, I guess we had a fun week exchanging a couple thousand words about a two-line change to the docs that's now never going to happen ;) -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.p

[issue27604] More details about `-O` flag

2016-07-30 Thread Ram Rachum
Ram Rachum added the comment: Hmm. What do you think about merging 3.patch now, and then possibly adding more information later? (Or asking the people who are designing the complex behvior you describe to write those docs.) -- ___ Python tracker

[issue27650] Implement `__repr__` methods for logging.Logger and others

2016-07-29 Thread Ram Rachum
New submission from Ram Rachum: A while ago I was debugging through code that uses the `logging` module, and I was looking at `Logger` objects and possibly other kinds of objects (maybe handlers? It was a while ago.) I was frustrated because I was trying to figure out what a particular logger

[issue27604] More details about `-O` flag

2016-07-29 Thread Ram Rachum
Ram Rachum added the comment: Hi David, I attached a patch that follows your instructions, but to be honest, if I wasn't the person writing this patch and I wanted to find the information "Does Python do any optimization besides dumping asserts when I do -O?" I'm not sure I

[issue27604] More details about `-O` flag

2016-07-29 Thread Ram Rachum
Ram Rachum added the comment: I uploaded a new patch. I added another thing: Mentioning explicitly that no other optimizations are currently being made. I think this is important because it's often the question that the user is asking themselves. (At least my boss and team members have asked

[issue27604] More details about `-O` flag

2016-07-25 Thread Ram Rachum
Ram Rachum added the comment: I'm sorry everyone, for being unpleasant on this thread. Rereading the thread from the beginning, I think I misunderstood Brett's message and immediately saw it as someone trying to block my efforts rather than just answering the question I asked. Anyway, I

[issue27604] More details about `-O` flag

2016-07-25 Thread Ram Rachum
Ram Rachum added the comment: Thanks for your understanding David. I'll submit a patch for this issue soon. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue27604] More details about `-O` flag

2016-07-25 Thread Ram Rachum
Ram Rachum added the comment: Yes, my comment was antagonistic. I'm baffled that the first response to someone who wants to contribute to Python is an esoteric argument against the contribution. I understand that sometimes not all contributions can be accepted because they break existing

[issue27604] More details about `-O` flag

2016-07-24 Thread Ram Rachum
Ram Rachum added the comment: So... The reasoning is that if someone adds optimizations to Python's `-O` mode (Something that hasn't happened in the last decade or two, right?) we want to save them from going to the trouble of writing two or three sentences in the docs describing

[issue27604] More details about `-O` flag

2016-07-24 Thread Ram Rachum
New submission from Ram Rachum: I wanted to ensure that the `-O` flag doesn't really do anything more than remove assert statement and make `__debug__` equal `False`. But the documentation for `-O` doesn't cover it: https://docs.python.org/3/using/cmdline.html#cmdoption-O https

[issue27597] Add usage examples for TracebackException, StackSummary and FrameSummary

2016-07-23 Thread Ram Rachum
New submission from Ram Rachum: I saw these new interesting classes in the `traceback` docs, but if I were shown an example of how they are used, I might get inspired to use them in my own code. -- assignee: docs@python components: Documentation messages: 271072 nosy: cool-RR, docs

[issue27563] docs for `gc.get_referrers` should explain the result format (i.e. what keys in the dict mean)

2016-07-18 Thread Ram Rachum
New submission from Ram Rachum: My mistake -- resolution: -> not a bug status: open -> closed ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue27563] docs for `gc.get_referrers` should explain the result format (i.e. what keys in the dict mean)

2016-07-18 Thread Ram Rachum
Changes by Ram Rachum <r...@rachum.com>: -- assignee: docs@python components: Documentation nosy: cool-RR, docs@python priority: normal severity: normal status: open title: docs for `gc.get_referrers` should explain the result format (i.e. what keys in the dict mean) versions:

[issue27181] Add geometric mean to `statistics` module

2016-06-04 Thread Ram Rachum
Ram Rachum added the comment: And of course, if the goal of the `statistics` module is to be comprehensive, one should ask himself what should be the difference between this new module and a mature statistics module like `scipy.stats`, and whether we should try to copy the features of off

[issue27181] Add geometric mean to `statistics` module

2016-06-03 Thread Ram Rachum
Ram Rachum added the comment: To complicate things further... I implemented a geometric mean on my own, and then I figured out what I really want is a *weighted* geometric mean, so I implemented that for myself. If you'd want to include that, that'll be cool. Actually I'm not sure if the goal

[issue27181] Add geometric mean to `statistics` module

2016-06-02 Thread Ram Rachum
Changes by Ram Rachum <r...@rachum.com>: -- components: Library (Lib) nosy: cool-RR priority: normal severity: normal status: open title: Add geometric mean to `statistics` module type: enhancement versions: Python 3.6 ___ Python tracke

[issue26978] Implement pathlib.Path.link (Using os.link)

2016-05-08 Thread Ram Rachum
Changes by Ram Rachum <r...@rachum.com>: -- components: Library (Lib) nosy: cool-RR priority: normal severity: normal status: open title: Implement pathlib.Path.link (Using os.link) versions: Python 3.6 ___ Python tracker <rep...@bugs.p

[issue26128] Let the subprocess.STARTUPINFO constructor take arguments

2016-01-22 Thread Ram Rachum
Ram Rachum added the comment: Agreed on keywords-only. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26128> ___ ___ Python-bugs-

[issue26128] Let the subprocess.STARTUPINFO constructor take arguments

2016-01-15 Thread Ram Rachum
New submission from Ram Rachum: Right now when you want to use `subprocess.STARTUPINFO`, you need to do something like this: si = subprocess.STARTUPINFO() si.dwFlags = subprocess.STARTF_USESTDHANDLES subprocess.Popen(['whatever'], startupinfo=si) It would be much nicer to do

[issue22570] Better stdlib support for Path objects

2016-01-10 Thread Ram Rachum
Ram Rachum added the comment: Here's an alternate idea I thought of now. Maybe `path.path` should be a pointer to the same `Path` object, so every function will do this: str(arg.path) if hasattr(arg, 'path') else arg What I like about this is that it avoids having the path argument

[issue22570] Better stdlib support for Path objects

2016-01-06 Thread Ram Rachum
Ram Rachum added the comment: I thought about it some more, and personally I'd prefer each function to do `str(path)` internally rather than `if hasattr(p, 'path'): p = p.path`. Even if it means we'll have to deal with "where did that file named '' come from?!" errors. I think i

[issue25832] Document weird behavior of `finally` when it has `break` in it

2015-12-10 Thread Ram Rachum
New submission from Ram Rachum: Today I spent 30 minutes because of weird behavior of `finally` when it has a `break` statement inside of it. (The behavior is that the exception gets suppressed, which I found unexpected.) I think this behavior should be documented. Example: c

[issue24195] Add `Executor.filter` to concurrent.futures

2015-06-08 Thread Ram Rachum
Ram Rachum added the comment: Right, so it might be garbage-collecting the items before the futures are done being created, so the whole list wouldn't need to be saved in memory. I understand now. -- ___ Python tracker rep...@bugs.python.org http

[issue24394] TypeError: popitem() takes no keyword arguments

2015-06-06 Thread Ram Rachum
Ram Rachum added the comment: I'm seeing a similar problem with `move_to_end` and its `last` keyword argument. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24394

[issue24195] Add `Executor.filter` to concurrent.futures

2015-06-06 Thread Ram Rachum
Ram Rachum added the comment: A problem I just realized with Brian's 2-line implementation of `filter`: It doesn't work for iterables which aren't sequences, since it attempts to exhaust the iterable twice. So if you have a non-sequence you'll have to make it into a sequence first

[issue24394] TypeError: popitem() takes no keyword arguments

2015-06-06 Thread Ram Rachum
New submission from Ram Rachum: Python 3.5.0b2 (v3.5.0b2:7a088af5615b, May 31 2015, 06:22:19) [MSC v.1900 64 bit (AMD64)] on win32 Type help, copyright, credits or license for more information. import collections

[issue24337] Implement `http.client.HTTPMessage.__repr__` to make debugging easier

2015-05-31 Thread Ram Rachum
Changes by Ram Rachum r...@rachum.com: -- components: Library (Lib) nosy: cool-RR priority: normal severity: normal status: open title: Implement `http.client.HTTPMessage.__repr__` to make debugging easier type: enhancement versions: Python 3.5

[issue24337] Implement `http.client.HTTPMessage.__repr__` to make debugging easier

2015-05-31 Thread Ram Rachum
Ram Rachum added the comment: Regarding a unified `__repr__`: Sounds good. What I needed is to know whether there are any headers in there or not. So the number of headers, or the first 2-3, would have solved my problem. -- ___ Python tracker rep

[issue24195] Add `Executor.filter` to concurrent.futures

2015-05-23 Thread Ram Rachum
Ram Rachum added the comment: Raymond: Thank you. So the discussion is back on adding a recipe to the docs. Brian: When I said possible issues, I followed that with a couple of issues with the example I uploaded (filter_example.py). -- ___ Python

[issue24271] Python site randomly scrolls up when on mobile.

2015-05-23 Thread Ram Rachum
New submission from Ram Rachum: I was trying to read this page: https://www.python.org/dev/peps/pep-0492/#acceptance On my mobile. (Nexus 5, chrome.) But when scrolling down the page, the browser sometimes scrolls up to the top of the page. This makes reading very annoying because I have

[issue24195] Add `Executor.filter` to concurrent.futures

2015-05-18 Thread Ram Rachum
Ram Rachum added the comment: Looks like this a recipe in the docs is where this ticket is headed. I took my original example for `Executor.filter` and changed it using Brian's suggestion so now it uses `Executor.map`. Please check it out. If someone other than me feels comfortable in putting

[issue24195] Add `Executor.filter` to concurrent.futures

2015-05-17 Thread Ram Rachum
Ram Rachum added the comment: Okay, let me understand what the opinions of people are about this feature. Ram Rachum: +1 Antoine Pitrou: -1 Nick Coghlan: Is that a +1 or a +0? Ethan and Paul, you've participated but I didn't get your opinion on whether you want to see this feature go

[issue24195] Add `Executor.filter` to concurrent.futures

2015-05-15 Thread Ram Rachum
Ram Rachum added the comment: Patch with documentation attached. (I don't know how to concatenate patches, so 2.patch contains only the documentation, while 1.patch has the implementation and the tests (but Ethan's patch is better.)) Brian, regarding your simpler implementation based

[issue24195] Add `Executor.filter`

2015-05-14 Thread Ram Rachum
Ram Rachum added the comment: Also, I notice Python 3.5 feature freeze is a bit over a week away, and I hope we can get that in so it could go in Python 3.5. (Assuming it goes in at all.) -- ___ Python tracker rep...@bugs.python.org http

[issue24195] Add `Executor.filter`

2015-05-14 Thread Ram Rachum
New submission from Ram Rachum: `Executor.filter` is to `filter` what `Executor.map` is to `map`. See Python-ideas thread: https://groups.google.com/forum/#!topic/python-ideas/EBOC5YCWPyo Patch attached. I don't know how to run the Python test suite (I'm guessing it involves building Python

[issue18162] Add index attribute to IndexError

2015-04-15 Thread Ram Rachum
Ram Rachum added the comment: Looking forward to your patch Ofer! Thanks for working on this! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18162

[issue22652] Add suggestion about keyword arguments to this error message: builtins.TypeError: my_func() takes 1 positional argument but 2 were given

2015-04-12 Thread Ram Rachum
Ram Rachum added the comment: ztane: I don't think so. You're taking attention away from the and keyword-only arguments, where in fact this is the piece of information that's likely to save the user the most time, so therefore it should get more attention

[issue22515] Implement partial order on Counter

2014-11-19 Thread Ram Rachum
Ram Rachum added the comment: Hi everyone, Just wanted to follow up here that I've created my own dedicated bag class. Documentation: https://combi.readthedocs.org/en/stable/bags.html Install using `pip install combi` It's packed with features. There are a ton of arithmetic operations

[issue22506] `dir` on Enum subclass doesn't expose parent class attributes

2014-10-21 Thread Ram Rachum
Ram Rachum added the comment: Thanks for the fix Ethan. Will you also push this to the backport on PyPI? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22506

[issue22506] `dir` on Enum subclass doesn't expose parent class attributes

2014-10-21 Thread Ram Rachum
Ram Rachum added the comment: Thanks! Two questions: 1. Is there a GitHub repo for enum34? Couldn't find a link to it on the PyPI page. 2. Aren't 'name' and 'value' already included in `added_behavior`? -- ___ Python tracker rep

[issue22506] `dir` on Enum subclass doesn't expose parent class attributes

2014-10-21 Thread Ram Rachum
Ram Rachum added the comment: Also, aren't you excluding a lot of important magic methods from that `dir`? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22506

[issue22656] `help` ignores `__doc__` of descriptors

2014-10-17 Thread Ram Rachum
New submission from Ram Rachum: The builtin `property` lets you specify a `doc` argument for your properties, which is great because then it shows up in `help`. So I figured that when I'm writing my own descriptor, I could set `__doc__` on it and have `help` use it. Not so, `help` ignores

[issue22652] Add suggestion about keyword arguments to this error message: builtins.TypeError: my_func() takes 1 positional argument but 2 were given

2014-10-16 Thread Ram Rachum
New submission from Ram Rachum: When programming, I just got this exception: builtins.TypeError: my_func() takes 1 positional argument but 2 were given After a couple of minutes of investigation I figured out that the problem is that the function has a `*` in its signature, so arguments

[issue22652] Add suggestion about keyword arguments to this error message: builtins.TypeError: my_func() takes 1 positional argument but 2 were given

2014-10-16 Thread Ram Rachum
Ram Rachum added the comment: (I should note that I see this suggestion as low-priority, because it's very specific, so I'll completely understand if it's deemed to not be worth the added complexity.) -- ___ Python tracker rep...@bugs.python.org

[issue22570] Better stdlib support for Path objects

2014-10-16 Thread Ram Rachum
Ram Rachum added the comment: I agree with Brett. Making old functions support `Path` sounds trivial to me, and I don't think there are any backward compatibility issues. Having to do str(path) every time you call a function is ugly. So I think that all stdlib functions that currently take

[issue22570] Better stdlib support for Path objects

2014-10-16 Thread Ram Rachum
Ram Rachum added the comment: Fine, so you add an `if isinstance...` in front of it and you're done. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22570

[issue22570] Better stdlib support for Path objects

2014-10-16 Thread Ram Rachum
Ram Rachum added the comment: Georg: You're right, I forgot about C modules which make this not as trivial as I thought. As for Python modules: If there's general agreement that this is a feature we want, I'll be happy to make a patch for the `zipfile` module to accept `Path` arguments

[issue22506] `dir` on Enum subclass doesn't expose parent class attributes

2014-10-10 Thread Ram Rachum
Ram Rachum added the comment: Ethan: I'm very confused by your example. `huh` isn't even a method, why would it be included? Or are you saying if it was a method? I'm really not sure what your example is adding over mine, given that it's 10 times longer and more complex. I'm not sure why

[issue18043] No mention of `match.regs` in `re` documentation

2014-10-04 Thread Ram Rachum
Ram Rachum added the comment: Mark, I prefer to leave this to someone else. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18043 ___ ___ Python

[issue22515] Implement partial order on Counter

2014-10-04 Thread Ram Rachum
Ram Rachum added the comment: I don't really understand the refactoring. For example why is `len(self) = len(other)` needed? For which case? Note that `len` would also catch keys with `0` value which shouldn't have an effect. -- ___ Python tracker

[issue22515] Implement partial order on Counter

2014-10-04 Thread Ram Rachum
Ram Rachum added the comment: There are some properties of set comparison: (a b) == (a = b and a != b) I don't think so, because counter equality is based on dict equality so it doesn't ignore zero values. (a = b) == (a b or a == b) No, ditto. (a = b and b = a) == (a == b

[issue22515] Implement partial order on Counter

2014-10-04 Thread Ram Rachum
Ram Rachum added the comment: I see that in my implementation for __lt__ and __gt__ I forgot to check whether the other counter has elements that this counter doesn't, which could flip `found_strict_difference`. -- ___ Python tracker rep

[issue22515] Implement partial order on Counter

2014-10-04 Thread Ram Rachum
Ram Rachum added the comment: Hi everybody, I agree we have a mess on our hands, with lots of cases where comparison is weird. To be honest I've given up on `collections.Counter` at this point. The fact that it's a hybrid mapping/multiset is the cause of all the problems, so I just made my

[issue22515] Implement partial order on Counter

2014-10-03 Thread Ram Rachum
Ram Rachum added the comment: Attached patch of implementation with tests. I haven't actually run this (because I don't know how to run Python's test suite) so there are likely to be bugs. if there's general agreement about this direction I'll figure out how to run the test so I could ensure

[issue22547] Implement an informative `BoundArguments.__repr__`

2014-10-03 Thread Ram Rachum
Changes by Ram Rachum r...@rachum.com: -- components: Library (Lib) nosy: cool-RR priority: normal severity: normal status: open title: Implement an informative `BoundArguments.__repr__` versions: Python 3.5 ___ Python tracker rep...@bugs.python.org

[issue22547] Implement an informative `BoundArguments.__repr__`

2014-10-03 Thread Ram Rachum
Ram Rachum added the comment: Something like BoundArguments: foo=bar, boo=baz I have no problem with truncation when it gets too long. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22547

[issue22547] Implement an informative `BoundArguments.__repr__`

2014-10-03 Thread Ram Rachum
Ram Rachum added the comment: Em, that kind of defeats the purpose of describing the object, doesn't it? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22547

[issue22547] Implement an informative `BoundArguments.__repr__`

2014-10-03 Thread Ram Rachum
Ram Rachum added the comment: I think the point of `__init__` is to know what the object is, and if you're hiding the values then someone has to access the attributes to find out the values and that sucks. -- ___ Python tracker rep

[issue22515] Implement partial order on Counter

2014-10-03 Thread Ram Rachum
Ram Rachum added the comment: Fixed patch attached. Still needs someone to run it and see whether there are any bugs. -- Added file: http://bugs.python.org/file36792/patch2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue22547] Implement an informative `BoundArguments.__repr__`

2014-10-03 Thread Ram Rachum
Ram Rachum added the comment: Another thing I proposed in python-ideas is to have `__getitem__` delegate to `.arguments`, so this proposal is similar in spirit, because I want to have `__repr__` show information from `.arguments`. To be honest I don't see the point in having to access

[issue22515] Implement partial order on Counter

2014-10-03 Thread Ram Rachum
Ram Rachum added the comment: Yes, correct. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22515 ___ ___ Python-bugs-list mailing list

[issue22515] Implement partial order on Counter

2014-10-01 Thread Ram Rachum
Ram Rachum added the comment: I needed it for an internal calculation in a combinatorics package I'm writing. Do you want me to take the time to explain the calculation? It's quite complex. -- ___ Python tracker rep...@bugs.python.org http

[issue22515] Implement partial order on Counter

2014-10-01 Thread Ram Rachum
Ram Rachum added the comment: I don't see why it's so hard to imagine how this will be used. Say I have a counter signifying how many of each product I have in my warehouse, and I have another counter saying how many of each product a client wants. I may use `counter2 = counter1` to check

[issue22515] Implement partial order on Counter

2014-10-01 Thread Ram Rachum
Ram Rachum added the comment: If/when there's general agreement that this functionality should be merged in (assuming the implementation is acceptable), let me know and I'll be happy to write the code and tests. -- ___ Python tracker rep

[issue22515] Implement partial order on Counter

2014-10-01 Thread Ram Rachum
Ram Rachum added the comment: The real problem is that `Counter` was put into the standard library with such lenient conditions on how it should be used-- basically looking at it as a `dict` subclass rather than a counter, putting emphasis on implementation rather than purpose, which

[issue22515] Implement partial order on Counter

2014-10-01 Thread Ram Rachum
Ram Rachum added the comment: Stefan: If you'd want to raise an exception, you'll need to define in which cases. Should it raise an exception for decimal numbers? Complex numbers? etc. Personally I'd enjoy it raising exceptions in as many situations as possible (so we could keep Counter usage

[issue22515] Implement partial order on Counter

2014-10-01 Thread Ram Rachum
Ram Rachum added the comment: Ah, now I understand you Stefan. That sounds like a good scheme; let any comparison errors between the values simply propagate up. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22515

[issue20218] Add methods to `pathlib.Path`: `write_text`, `read_text`, `write_bytes`, `read_bytes`

2014-09-30 Thread Ram Rachum
Ram Rachum added the comment: Matthias: Do you prefer having both `write_bytes` and `write_text` instead of just `write` with a `binary` option? Do you prefer `append` and `exclusive` modes to be allowed or not? -- ___ Python tracker rep

[issue20218] Add methods to `pathlib.Path`: `write_text`, `read_text`, `write_bytes`, `read_bytes`

2014-09-30 Thread Ram Rachum
Ram Rachum added the comment: What do you think about changing the signature to something like this: def read_text(self, *, encoding=None, errors=None): This is to avoid these arguments being used positionally, which eases future backwards compatibility changes

[issue22515] Implement partial order on Counter

2014-09-29 Thread Ram Rachum
New submission from Ram Rachum: I suggest implementing `Counter.__lt__` which will be a partial order, similarly to `set.__lt__`. That is, one counter will be considered smaller-or-equal to another if for any item in the first counter, the second counter has an equal or bigger amount

[issue22515] Implement partial order on Counter

2014-09-29 Thread Ram Rachum
Ram Rachum added the comment: I suggest they be ignored like in `elements`. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22515 ___ ___ Python

<    1   2   3   4   >