[issue40791] hmac.compare_digest could try harder to be constant-time.

2020-05-27 Thread Devin Jeanpierre
Change by Devin Jeanpierre : -- keywords: +patch pull_requests: +19700 stage: -> patch review pull_request: https://github.com/python/cpython/pull/20444 ___ Python tracker <https://bugs.python.org/issu

[issue40791] hmac.compare_digest could try harder to be constant-time.

2020-05-27 Thread Devin Jeanpierre
New submission from Devin Jeanpierre : `hmac.compare_digest` (via `_tscmp`) does not mark the accumulator variable `result` as volatile, which means that the compiler is allowed to short-circuit the comparison loop as long as it still reads from both strings. In particular, when `result

Re: Users banned

2018-07-15 Thread Devin Jeanpierre
On Sun, Jul 15, 2018 at 5:09 PM Jim Lee wrote: > That is, of course, the decision of the moderators - but I happen to > agree with both Christian and Ethan. Banning for the simple reason of a > dissenting opinion is censorship, pure and simple. While Bart may have > been prolific in his

Kindness

2018-07-13 Thread Devin Jeanpierre
On Fri, Jul 13, 2018 at 10:49 AM Mark Lawrence wrote: > > On 13/07/18 16:16, Bart wrote: > > On 13/07/2018 13:33, Steven D'Aprano wrote: > >> On Fri, 13 Jul 2018 11:37:41 +0100, Bart wrote: > >> > >>> (** Something so radical I've been using them elsewhere since forever.) > >> > >> And you just

Re: Thread-safe way to add a key to a dict only if it isn't already there?

2018-07-07 Thread Devin Jeanpierre
On Sat, Jul 7, 2018 at 6:49 AM Marko Rauhamaa wrote: > Is that guaranteed to be thread-safe? The documentation ( s://docs.python.org/3/library/stdtypes.html#dict.setdefault>) makes no > such promise. It's guaranteed to be thread-safe because all of Python's core containers are thread safe (in as

Re: Why is the use of an undefined name not a syntax error?

2018-04-01 Thread Devin Jeanpierre
On Sun, Apr 1, 2018 at 2:38 PM, Chris Angelico wrote: > On Mon, Apr 2, 2018 at 7:24 AM, David Foster wrote: >> My understanding is that the Python interpreter already has enough >> information when bytecode-compiling a .py file to determine which names >>

Re: Why is the use of an undefined name not a syntax error?

2018-04-01 Thread Devin Jeanpierre
> But if it is cheap to detect a wide variety of name errors at compile time, > is there any particular reason it is not done? >From my perspective, it is done, but by tools that give better output than Python's parser. :) Linters (like pylint) are better than syntax errors here, because they

Re: binary decision diagrams

2017-12-20 Thread Devin Jeanpierre
On Mon, Dec 18, 2017 at 5:00 AM, Wild, Marcel, Dr wrote: > Hello everybody: > I really don't know anything about Python (I'm using Mathematica) but with > the help of others learned that > > g=expr2bdd(f) > > makes the BDD (=binary decision diagram) g of a

[issue29505] Submit the re, json, & csv modules to oss-fuzz testing

2017-09-11 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: Oops, so it is. I can't read apparently. I'll spend my time on making more fuzz tests in the meantime. -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/i

[issue29505] Submit the re, json, & csv modules to oss-fuzz testing

2017-09-11 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: kcc strongly disagrees though. Copying latest comment: """ fwiw - I object to us running any of this internally at Google. We need to be part of the main oss-fuzz project pulling from upstream revisions. Doing this testing within our blackh

[issue29505] Submit the re, json, & csv modules to oss-fuzz testing

2017-09-11 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: > i'd rather make this work in oss-fuzz on cpython. can you point me to how > oss-fuzz works and what it wants to do so i can better understand what it > needs? I don't have any details except for what's in the PR to oss-fuzz (https://github.c

[issue29505] Submit the re, json, & csv modules to oss-fuzz testing

2017-09-08 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: So here's an interesting issue: oss-fuzz requires that the built location be movable. IOW, we build Python into $OUT, and then the $OUT directory gets moved somewhere else and the fuzz test gets run from there. This causes problems because Python can

[issue29505] Submit the re, json, & csv modules to oss-fuzz testing

2017-09-07 Thread Devin Jeanpierre
Changes by Devin Jeanpierre <jeanpierr...@gmail.com>: -- keywords: +patch pull_requests: +3434 stage: test needed -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue29505] Submit the re, json, & csv modules to oss-fuzz testing

2017-09-06 Thread Devin Jeanpierre
Changes by Devin Jeanpierre <jeanpierr...@gmail.com>: -- pull_requests: +3412 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue29505] Submit the re, json, & csv modules to oss-fuzz testing

2017-09-06 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: Huh. I would not have predicted that. https://gcc.gnu.org/onlinedocs/cpp/Defined.html I'll send a fix. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue29505] Submit the re, json, & csv modules to oss-fuzz testing

2017-07-25 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: I think they misspoke, it's normal with fuzzing to test against master. The current draft of the code runs this git pull before building/launching any tests: git clone --depth 1 https://github.com/python/cpython.git cpython Speaking of which, I forgot

[issue29505] Submit the re, json, & csv modules to oss-fuzz testing

2017-07-25 Thread Devin Jeanpierre
Changes by Devin Jeanpierre <jeanpierr...@gmail.com>: -- pull_requests: +2929 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue17870] Python does not provide PyLong_FromIntMax_t() or PyLong_FromUintMax_t() function

2017-06-15 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: Oh, to be clear on this last point: > Hum, who else needs such function except of you? Right now there is no way to convert an int that might be > 64 bits, into a python long, except really bizarre shenanigans, unless we want to rely on implemen

[issue17870] Python does not provide PyLong_FromIntMax_t() or PyLong_FromUintMax_t() function

2017-06-15 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: > Making two C functions public is very different from supporting intmax_t. I > expect a change of a few lines, whereas my intmax_t patch modified a lot of > code. I requested either a way to create from intmax_t, or from bytes. We have two

[issue17870] Python does not provide PyLong_FromIntMax_t() or PyLong_FromUintMax_t() function

2017-06-15 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: > Devin, I asked you for a strong rationale to add the feature. I don't see > such rationale, so this issue will be closed again. I guess we have different definitions of "strong rationale". Clearer criteria would help. >> It

[issue17870] Python does not provide PyLong_FromIntMax_t() or PyLong_FromUintMax_t() function

2017-06-14 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: > Write your own C extension to do that. Sorry, I don't know what is the best > way to write such C extension. If everyone who wants to convert intptr_t to a python int has to write their own function, then why not just include it in the C-API?

[issue17870] Python does not provide PyLong_FromIntMax_t() or PyLong_FromUintMax_t() function

2017-06-14 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: > I wrote my first patch in 2013, but I still fail to find a very good example > where intmax_t would be an obvious choice. So I have to agree and I will now > close the issue. Hold on, nobody ever answered the question in the OP. How would yo

[issue29505] Submit the re, json, & csv modules to oss-fuzz testing

2017-05-09 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: https://github.com/google/oss-fuzz/pull/583 is the PR to oss-fuzz to add the project. I'm working on actual tests to be submitted here. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.p

[issue29505] Submit the re, json, & csv modules to oss-fuzz testing

2017-05-02 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: Aha, I found an existing issue! For adding to oss-fuzz, is there a contact email we can use that is connected to a google account? I am tempted to just put gregory.p.smith on there if not. :) I can volunteer to fuzz some interesting subset of the stdlib

Re: tempname.mktemp functionality deprecation

2017-04-29 Thread Devin Jeanpierre
On Sat, Apr 29, 2017 at 11:45 AM, Tim Chase wrote: > Unfortunately, tempfile.mktemp() is described as deprecated > since 2.3 (though appears to still exist in the 3.4.2 that is the > default Py3 on Debian Stable). While the deprecation notice says > "In version 2.3

[issue29986] Documentation recommends raising TypeError from tp_richcompare

2017-04-04 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: Yeah, I agree there might be a use-case (can't find one offhand, but in principle), but I think it's rare enough that you're more likely to be led astray from reading this note -- almost always, NotImplemented does what you want. In a way this is a special

[issue29986] Documentation recommends raising TypeError from tp_richcompare

2017-04-04 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: Sorry, forgot to link to docs because I was copy-pasting from the PR: https://docs.python.org/2/c-api/typeobj.html#c.PyTypeObject.tp_richcompare https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_richcompare > Note: If you want to implem

[issue29986] Documentation recommends raising TypeError from tp_richcompare

2017-04-04 Thread Devin Jeanpierre
New submission from Devin Jeanpierre: am not sure when TypeError is the right choice. Definitely, most of the time I've seen it done, it causes trouble, and NotImplemented usually does something better. For example, see the work in https://bugs.python.org/issue8743 to get set to interoperate

Re: Clickable hyperlinks

2017-01-05 Thread Devin Jeanpierre
Sadly, no. :( Consoles (and stdout) are just text, not hypertext. The way to make an URL clickable is to use a terminal that makes URLs clickable, and print the URL: print("%s: %s" % (description, url)) -- Devin On Tue, Jan 3, 2017 at 11:46 AM, Deborah Swanson

Re: Clickable hyperlinks

2017-01-03 Thread Devin Jeanpierre
Sadly, no. :( Consoles (and stdout) are just text, not hypertext. The way to make an URL clickable is to use a terminal that makes URLs clickable, and print the URL: print("%s: %s" % (description, url)) -- Devin On Tue, Jan 3, 2017 at 11:46 AM, Deborah Swanson

Re: Looking for ideas to improve library API

2015-11-28 Thread Devin Jeanpierre
Documentation is all you can do. -- Devin On Thu, Nov 26, 2015 at 5:35 AM, Chris Lalancette <clalance...@gmail.com> wrote: > On Thu, Nov 26, 2015 at 7:46 AM, Devin Jeanpierre > <jeanpierr...@gmail.com> wrote: >> Why not take ownership of the file object, instead of requ

Re: Looking for ideas to improve library API

2015-11-26 Thread Devin Jeanpierre
Why not take ownership of the file object, instead of requiring users to manage lifetimes? -- Devin On Wed, Nov 25, 2015 at 12:52 PM, Chris Lalancette wrote: > Hello, > I'm currently developing a library called pyiso ( > https://github.com/clalancette/pyiso), used

Re: Should non-security 2.7 bugs be fixed?

2015-07-20 Thread Devin Jeanpierre
I think you're missing the line where I said all the relevant conversation happened in IRC, and that you should refer to logs. On Sun, Jul 19, 2015 at 11:25 PM, Terry Reedy tjre...@udel.edu wrote: On 7/19/2015 9:20 PM, Devin Jeanpierre wrote: Search your logs for https://bugs.python.org

Re: Should non-security 2.7 bugs be fixed?

2015-07-19 Thread Devin Jeanpierre
On Sat, Jul 18, 2015 at 9:45 PM, Steven D'Aprano st...@pearwood.info wrote: It gets really boring submitting 2.7-specific patches, though, when they aren't accepted, and the committers have such a hostile attitude towards it. I was told by core devs that, instead of fixing bugs in Python 2, I

Re: Should non-security 2.7 bugs be fixed?

2015-07-19 Thread Devin Jeanpierre
On Sun, Jul 19, 2015 at 8:05 PM, Steven D'Aprano st...@pearwood.info wrote: On Mon, 20 Jul 2015 11:20 am, Devin Jeanpierre wrote: I was most frustrated by the first case -- the patch was (informally) rejected in favor of the right fix, and the right fix was (informally) rejected because

Re: Should non-security 2.7 bugs be fixed?

2015-07-18 Thread Devin Jeanpierre
Considering CPython is officially accepting performance improvements to 2.7, surely bug fixes are also allowed? I have contributed both performance improvements and bug fixes to 2.7. In my experience, the problem is not the lack of contributors, it's the lack of code reviewers. I think this is

Re: Should non-security 2.7 bugs be fixed?

2015-07-18 Thread Devin Jeanpierre
On Sat, Jul 18, 2015 at 6:34 PM, Terry Reedy tjre...@udel.edu wrote: On 7/18/2015 8:27 PM, Mark Lawrence wrote: On 19/07/2015 00:36, Terry Reedy wrote: Programmers don't much like doing maintainance work when they're paid to do it, so why would they volunteer to do it? Right. So I am

Re: Pure Python Data Mangling or Encrypting

2015-06-27 Thread Devin Jeanpierre
On Fri, Jun 26, 2015 at 11:16 PM, Steven D'Aprano st...@pearwood.info wrote: On Sat, 27 Jun 2015 02:05 pm, Devin Jeanpierre wrote: On Fri, Jun 26, 2015 at 8:38 PM, Steven D'Aprano st...@pearwood.info wrote: Now you say that the application encrypts the data, except that the user can turn

Re: Pure Python Data Mangling or Encrypting

2015-06-27 Thread Devin Jeanpierre
On Sat, Jun 27, 2015 at 6:18 PM, Steven D'Aprano st...@pearwood.info wrote: On Sun, 28 Jun 2015 06:30 am, Devin Jeanpierre wrote: On Fri, Jun 26, 2015 at 11:16 PM, Steven D'Aprano st...@pearwood.info wrote: On Sat, 27 Jun 2015 02:05 pm, Devin Jeanpierre wrote: On Fri, Jun 26, 2015 at 8:38

Re: Pure Python Data Mangling or Encrypting

2015-06-26 Thread Devin Jeanpierre
Johannes, I agree with a lot of what you say, but can you please have less of a mean attitude? -- Devin On Fri, Jun 26, 2015 at 3:42 PM, Johannes Bauer dfnsonfsdu...@gmx.de wrote: On 26.06.2015 23:29, Jon Ribbens wrote: While you seem to think that Steven is rampaging about nothing, he does

Re: Pure Python Data Mangling or Encrypting

2015-06-26 Thread Devin Jeanpierre
On Fri, Jun 26, 2015 at 8:38 PM, Steven D'Aprano st...@pearwood.info wrote: Now you say that the application encrypts the data, except that the user can turn that option off. Just make the AES encryption mandatory, not optional. Then the user cannot upload unencrypted malicious data, and the

Re: Pure Python Data Mangling or Encrypting

2015-06-25 Thread Devin Jeanpierre
On Thu, Jun 25, 2015 at 2:57 AM, Chris Angelico ros...@gmail.com wrote: On Thu, Jun 25, 2015 at 7:41 PM, Devin Jeanpierre jeanpierr...@gmail.com wrote: I know that the OP doesn't propose using ROT-13, but a classical substitution cipher isn't that much stronger. Yes, it is. It requires

Re: Pure Python Data Mangling or Encrypting

2015-06-25 Thread Devin Jeanpierre
On Thu, Jun 25, 2015 at 2:25 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Thursday 25 June 2015 14:27, Devin Jeanpierre wrote: The original post said that the sender will usually send files they encrypted, unless they are malicious. So if the sender wants them

Re: Pure Python Data Mangling or Encrypting

2015-06-24 Thread Devin Jeanpierre
How about a random substitution cipher? This will be ultra-weak, but fast (using bytes.translate/bytes.maketrans) and seems to be the kind of thing you're asking for. -- Devin On Tue, Jun 23, 2015 at 12:02 PM, Randall Smith rand...@tnr.cc wrote: Chunks of data (about 2MB) are to be stored on

Re: Pure Python Data Mangling or Encrypting

2015-06-24 Thread Devin Jeanpierre
On Wed, Jun 24, 2015 at 9:07 PM, Steven D'Aprano st...@pearwood.info wrote: But just sticking to the three above, the first one is partially mitigated by allowing virus scanners to scan the data, but that implies that the owner of the storage machine can spy on the files. So you have a conflict

Re: enhancement request: make py3 read/write py2 pickle format

2015-06-10 Thread Devin Jeanpierre
D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Wednesday 10 June 2015 14:48, Devin Jeanpierre wrote: [...] and literal_eval is not a great idea. * the common serializer (repr) does not output a canonical form, and can serialize things in a way that they can't be deserialized

Re: enhancement request: make py3 read/write py2 pickle format

2015-06-10 Thread Devin Jeanpierre
On Wed, Jun 10, 2015 at 4:39 PM, Devin Jeanpierre jeanpierr...@gmail.com wrote: On Wed, Jun 10, 2015 at 4:25 PM, Terry Reedy tjre...@udel.edu wrote: On 6/10/2015 6:10 PM, Devin Jeanpierre wrote: The problem is that there are two different ways repr might write out a dict equal to {'a': 1, 'b

Re: enhancement request: make py3 read/write py2 pickle format

2015-06-10 Thread Devin Jeanpierre
On Wed, Jun 10, 2015 at 4:46 PM, Terry Reedy tjre...@udel.edu wrote: On 6/10/2015 7:39 PM, Devin Jeanpierre wrote: On Wed, Jun 10, 2015 at 4:25 PM, Terry Reedy tjre...@udel.edu wrote: On 6/10/2015 6:10 PM, Devin Jeanpierre wrote: The problem is that there are two different ways repr might

Re: enhancement request: make py3 read/write py2 pickle format

2015-06-10 Thread Devin Jeanpierre
On Wed, Jun 10, 2015 at 4:25 PM, Terry Reedy tjre...@udel.edu wrote: On 6/10/2015 6:10 PM, Devin Jeanpierre wrote: The problem is that there are two different ways repr might write out a dict equal to {'a': 1, 'b': 2}. This can make tests brittle Not if one compares objects rather than

Re: enhancement request: make py3 read/write py2 pickle format

2015-06-10 Thread Devin Jeanpierre
Snipped aplenty. On Wed, Jun 10, 2015 at 8:21 PM, Steven D'Aprano st...@pearwood.info wrote: On Thu, 11 Jun 2015 08:10 am, Devin Jeanpierre wrote: [...] I could spend a bunch of time writing yet another config file format, or I could use text format protocol buffers, YAML, or TOML and call

Re: enhancement request: make py3 read/write py2 pickle format

2015-06-09 Thread Devin Jeanpierre
There's a lot of subtle issues with pickle compatibility. e.g. old-style vs new-style classes. It's kinda hard and it's better to give up. I definitely agree it's better to use something else instead. For example, we switched to using protocol buffers, which have much better compatibility

Re: enhancement request: make py3 read/write py2 pickle format

2015-06-09 Thread Devin Jeanpierre
underrated. (Relatedly: underdocumented, too.) /me lifts head out of kool-aid and gasps for air -- Devin On Tue, Jun 9, 2015 at 5:17 PM, Irmen de Jong irmen.nos...@xs4all.nl wrote: On 10-6-2015 1:06, Chris Angelico wrote: On Wed, Jun 10, 2015 at 6:07 AM, Devin Jeanpierre jeanpierr...@gmail.com

Re: enhancement request: make py3 read/write py2 pickle format

2015-06-09 Thread Devin Jeanpierre
On Tue, Jun 9, 2015 at 8:52 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Wednesday 10 June 2015 10:47, Devin Jeanpierre wrote: Passing around data that can be put into ast.literal_eval is synonymous with passing around data taht can be put into eval. It sounds like

[issue15138] base64.urlsafe_b64**code are too slow

2015-05-30 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: Here's a backport of the patch to 2.7. It's pretty rad, and basically identical to how YouTube monkeypatches base64. Not sure what will happen to this patch. According to recent discussion on the list (e.g. https://mail.python.org/pipermail/python-dev/2015

[issue17094] sys._current_frames() reports too many/wrong stack frames

2015-05-29 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: The patch I'm providing with this comment has a ... really hokey test case, and a two line + whitespace diff for pystate.c . The objective of the patch is only to have _current_frames report the correct frame for any live thread. It continues to report dead

[issue17094] sys._current_frames() reports too many/wrong stack frames

2015-05-28 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: This bug also affects 2.7. The main problem I'm dealing with is sys._current_frames will then return wrong stack frames for existing threads. One fix to just this would be to change how the dict is created, to keep newer threads rather than tossing them

[issue23275] Can assign [] = (), but not () = []

2015-05-27 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: [a, b] = (1, 2) is also fine. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23275 ___ ___ Python-bugs-list

[issue5315] signal handler never gets called

2015-05-25 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: Adding haypo since apparently he's been touching signals stuff a lot lately, maybe has some useful thoughts / review? :) -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5315

[issue24283] Print not safe in signal handlers

2015-05-25 Thread Devin Jeanpierre
New submission from Devin Jeanpierre: The code attached runs a while loop that prints, and has a signal handler that also prints. There is a thread that constantly fires off signals, but this is just to ensure the condition for the bug happens -- this is a bug with signal handling

[issue24283] Print not safe in signal handlers

2015-05-25 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: It doesn't do any of those things in Python 2, to my knowledge. Why aren't we willing to make this work? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24283

[issue5315] signal handler never gets called

2015-05-24 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: Agree with Charles-François's second explanation. This makes it very hard to reliably handle signals -- basically everyone has to remember to use set_wakeup_fd, and most people don't. For example, gunicorn is likely vulnerable to this because it doesn't use

[issue24235] ABCs don't fail metaclass instantiation

2015-05-18 Thread Devin Jeanpierre
New submission from Devin Jeanpierre: If a subclass has abstract methods, it fails to instantiate... unless it's a metaclass, and then it succeeds. import abc class A(metaclass=abc.ABCMeta): ... @abc.abstractmethod ... def foo(self): pass ... class B(A): pass ... B() Traceback

[issue24144] Docs discourage use of binascii.unhexlify etc.

2015-05-07 Thread Devin Jeanpierre
New submission from Devin Jeanpierre: Maybe the functions should be split up into those you shouldn't need to call directly, and those you should? I find it unlikely that you're supposed to use codecs.encode(..., 'hex') and codecs.decode(..., 'hex') instead of binascii (the only other thing

Re: Pickle based workflow - looking for advice

2015-04-13 Thread Devin Jeanpierre
On Mon, Apr 13, 2015 at 10:58 AM, Fabien fabien.mauss...@gmail.com wrote: Now, to my questions: 1. Does that seem reasonable? A big issue is the use of pickle, which is: * Often suboptimal performance wise (e.g. you can't load only subsets of the data) * Makes forwards/backwards compatibility

Re: You must register a new account to report a bug (was: Python 2 to 3 conversion - embrace the pain)

2015-03-16 Thread Devin Jeanpierre
On Sun, Mar 15, 2015 at 11:17 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Sadly becoming the norm. People will run a software project and just assume that users will be willing to go through a registration process for every project just to report a bug. Registering for github is a lot

Re: Design thought for callbacks

2015-02-21 Thread Devin Jeanpierre
On Fri, Feb 20, 2015 at 9:42 PM, Chris Angelico ros...@gmail.com wrote: No, it's not. I would advise using strong references - if the callback is a closure, for instance, you need to hang onto it, because there are unlikely to be any other references to it. If I register a callback with you, I

Re: meaning of: line, =

2015-02-06 Thread Devin Jeanpierre
Sorry for late reply, I somehow missed this email. On Thu, Feb 5, 2015 at 8:59 AM, Rustom Mody rustompm...@gmail.com wrote: The reason I ask: I sorely miss haskell's pattern matching in python. It goes some way: ((x,y),z) = ((1,2),3) x,y,z (1, 2, 3) But not as far as I would like:

Re: meaning of: line, =

2015-02-05 Thread Devin Jeanpierre
On Thu, Feb 5, 2015 at 8:08 AM, Ian Kelly ian.g.ke...@gmail.com wrote: On Thu, Feb 5, 2015 at 2:40 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Devin Jeanpierre wrote: On Wed, Feb 4, 2015 at 1:18 PM, Chris Angelico ros...@gmail.com wrote: [result] = f() result 42 Huh

Re: meaning of: line, =

2015-02-05 Thread Devin Jeanpierre
On Wed, Feb 4, 2015 at 1:18 PM, Chris Angelico ros...@gmail.com wrote: On Thu, Feb 5, 2015 at 4:36 AM, Peter Otten __pete...@web.de wrote: Another alternative is to put a list literal on the lefthand side: def f(): yield 42 ... [result] = f() result 42 Huh, was not aware of that

Re: dunder-docs (was Python is DOOMED! Again!)

2015-02-03 Thread Devin Jeanpierre
On Mon, Feb 2, 2015 at 6:07 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Run this code: # === cut === class K(object): def f(self): pass def f(self): pass instance = K() things = [instance.f, f.__get__(instance, K)] from random import shuffle shuffle(things)

Re: dunder-docs (was Python is DOOMED! Again!)

2015-02-03 Thread Devin Jeanpierre
On Mon, Feb 2, 2015 at 6:20 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Devin Jeanpierre wrote: Oops, I just realized why such a claim might be made: the documentation probably wants to be able to say that any method can use super(). So that's why it claims that it isn't

Re: dunder-docs (was Python is DOOMED! Again!)

2015-02-02 Thread Devin Jeanpierre
On Mon, Feb 2, 2015 at 4:06 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sun, Feb 1, 2015 at 11:15 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Both K.f and K.g are methods, even though only one meets the definition given in the glossary. The glossary

Re: dunder-docs (was Python is DOOMED! Again!)

2015-02-02 Thread Devin Jeanpierre
On Mon, Feb 2, 2015 at 5:00 AM, Devin Jeanpierre jeanpierr...@gmail.com wrote: On Mon, Feb 2, 2015 at 4:06 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sun, Feb 1, 2015 at 11:15 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Both K.f and K.g are methods

Re: Python is DOOMED! Again!

2015-02-01 Thread Devin Jeanpierre
On Sun, Feb 1, 2015 at 8:31 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Paul Rubin wrote: It's completely practical: polymorphism and type inference get you the value you want with usually no effort on your part. But it's the usually that bites you. If I have an

Re: Python is DOOMED! Again!

2015-02-01 Thread Devin Jeanpierre
On Sun, Feb 1, 2015 at 8:34 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Devin Jeanpierre wrote: It's really only dynamically typed languages that have a single null value of a single type. Maybe I misunderstand the original statement. Pascal is statically typed and has

Re: Python is DOOMED! Again!

2015-02-01 Thread Devin Jeanpierre
On Sun, Feb 1, 2015 at 2:27 PM, Paul Rubin no.email@nospam.invalid wrote: Devin Jeanpierre jeanpierr...@gmail.com writes: That said, Haskell (and the rest) do have a sort of type coercion, of literals at compile time (e.g. 3 can be an Integer or a Double depending on how you use it.) That's

Re: dunder-docs (was Python is DOOMED! Again!)

2015-02-01 Thread Devin Jeanpierre
-- Devin On Sun, Feb 1, 2015 at 11:15 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Gregory Ewing wrote: Steven D'Aprano wrote: [quote] If the object has a method named __dir__(), this method will be called and must return the list of attributes. [end

Re: RAII vs gc (was fortran lib which provide python like data type)

2015-01-31 Thread Devin Jeanpierre
On Fri, Jan 30, 2015 at 1:28 PM, Sturla Molden sturla.mol...@gmail.com wrote: in Python. It actually corresponds to with Foo() as bar: suite The problem with with statements is that they only handle the case of RAII with stack allocated variables, and can't handle transfer of ownership

Re: Python is DOOMED! Again!

2015-01-31 Thread Devin Jeanpierre
Sorry, sort of responding to both of you. On Sat, Jan 31, 2015 at 10:12 PM, Paul Rubin no.email@nospam.invalid wrote: Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: Some degree of weakness in a type system is not necessarily bad. Even the strongest of languages usually allow a

Re: ANN: unpyc3 - a python bytecode decompiler for Python3

2015-01-29 Thread Devin Jeanpierre
On Wed, Jan 28, 2015 at 4:34 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Devin Jeanpierre wrote: Git doesn't help if you lose your files in between commits, Sure it does? You just lose the changes made since the previous commit, but that's no different from restoring from

Re: ANN: unpyc3 - a python bytecode decompiler for Python3

2015-01-28 Thread Devin Jeanpierre
On Wed, Jan 28, 2015 at 1:40 PM, Chris Angelico ros...@gmail.com wrote: On Thu, Jan 29, 2015 at 5:47 AM, Chris Kaynor ckay...@zindagigames.com wrote: I use Google Drive for it for all the stuff I do at home, and use SVN for all my personal projects, with the SVN depots also in Drive. The

Re: multiprocessing module backport from 3 to 2.7 - spawn feature

2015-01-28 Thread Devin Jeanpierre
On Wed, Jan 28, 2015 at 10:06 AM, Skip Montanaro skip.montan...@gmail.com wrote: On Wed, Jan 28, 2015 at 7:07 AM, Andres Riancho andres.rian...@gmail.com wrote: The feature I'm specially interested in is the ability to spawn processes [1] instead of forking, which is not present in the 2.7

Re: ANN: unpyc3 - a python bytecode decompiler for Python3

2015-01-28 Thread Devin Jeanpierre
I distrust any backup strategy that requires explicit action by the user. I've seen users fail too often. (Including myself.) -- Devin On Wed, Jan 28, 2015 at 2:02 PM, Chris Angelico ros...@gmail.com wrote: On Thu, Jan 29, 2015 at 8:52 AM, Devin Jeanpierre jeanpierr...@gmail.com wrote: Git

Re: ANN: unpyc3 - a python bytecode decompiler for Python3

2015-01-28 Thread Devin Jeanpierre
FWIW I put all my source code inside Dropbox so that even things I haven't yet committed/pushed to Bitbucket/Github are backed up. So far it's worked really well, despite using Dropbox on both Windows and Linux. (See also: Google Drive, etc.) (Free) Dropbox has a 30 day recovery time limit, and I

Re: An object is an instance (or not)?

2015-01-27 Thread Devin Jeanpierre
On Tue, Jan 27, 2015 at 9:37 PM, random...@fastmail.us wrote: On Tue, Jan 27, 2015, at 16:06, Mario Figueiredo wrote: That error message has me start that thread arguing that the error is misleading because the Sub object does have the __bases__ attribute. It's the Sub instance object that

[issue23322] parser module docs missing second example

2015-01-25 Thread Devin Jeanpierre
New submission from Devin Jeanpierre: The port to reST missed the second example: https://docs.python.org/release/2.5/lib/node867.html This is still referred to in the docs, so it is not deliberate. For example, the token module docs say The second example for the parser module shows how

Re: Alternative to multi-line lambdas: Assign-anywhere def statements

2015-01-24 Thread Devin Jeanpierre
On Sat, Jan 24, 2015 at 11:55 AM, Chris Angelico ros...@gmail.com wrote: That's still only able to assign to a key of a dictionary, using the function name. There's no way to represent fully arbitrary assignment in Python - normally, you can assign to a name, an attribute, a subscripted item,

Re: Alternative to multi-line lambdas: Assign-anywhere def statements

2015-01-24 Thread Devin Jeanpierre
On Sat, Jan 24, 2015 at 5:58 PM, Ethan Furman et...@stoneleaf.us wrote: On 01/24/2015 11:55 AM, Chris Angelico wrote: On Sun, Jan 25, 2015 at 5:56 AM, Ethan Furman et...@stoneleaf.us wrote: If the non-generic is what you're concerned about: # not tested dispatch_table_a = {}

Re: Trees

2015-01-20 Thread Devin Jeanpierre
There are similarly many kinds of hash tables. For a given use case (e.g. a sorted dict, or a list with efficient removal, etc.), there's a few data structures that make sense, and a library (even the standard library) doesn't have to expose which one was picked as long as the performance is

Re: Trees

2015-01-19 Thread Devin Jeanpierre
On Mon, Jan 19, 2015 at 3:08 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Zachary Gilmartin wrote: Why aren't there trees in the python standard library? Possibly because they aren't needed? Under what circumstances would you use a tree instead of a list or a dict or

[issue23275] Can assign [] = (), but not () = []

2015-01-19 Thread Devin Jeanpierre
New submission from Devin Jeanpierre: [] = () () = [] File stdin, line 1 SyntaxError: can't assign to () This contradicts the assignment grammar, which would make both illegal: https://docs.python.org/3/reference/simple_stmts.html#assignment-statements -- components: Interpreter

Re: Hello World

2015-01-17 Thread Devin Jeanpierre
Sorry for necro. On Sat, Dec 20, 2014 at 10:44 PM, Chris Angelico ros...@gmail.com wrote: On Sun, Dec 21, 2014 at 5:31 PM, Terry Reedy tjre...@udel.edu wrote: Just to be clear, writing to sys.stdout works fine in Idle. import sys; sys.stdout.write('hello ') hello #2.7 In 3.4, the number of

Re: PyWart: Poor Documentation Examples

2015-01-10 Thread Devin Jeanpierre
On Sat, Jan 10, 2015 at 6:32 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: At the point you are demonstrating reduce(), if the reader doesn't understand or can't guess the meaning of n = 4, n+1 or range(), they won't understand anything you say. Teachers need to understand

Re: Decimals and other numbers

2015-01-09 Thread Devin Jeanpierre
On Fri, Jan 9, 2015 at 2:20 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: -snip- I don't understand what you're trying to say here. You can't just arbitrarily declare that 0**1 equals something other than 0 (or for that matter, doesn't equal anything at all). You can,

[issue23086] Add start and stop parameters to the Sequence.index() ABC mixin method

2015-01-09 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: I inferred from Serhiy's comment that if you override __iter__ to be efficient and not use __getitem__, this overridden behavior used to pass on to index(), but wouldn't after this patch. -- ___ Python tracker

Re: Decimals and other numbers

2015-01-09 Thread Devin Jeanpierre
On Fri, Jan 9, 2015 at 7:05 PM, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: It's far from clear what *anything* multiplied by itself zero times should be. A better way of thinking about what x**n for integer n means is this: Start with 1, and multiply it by x n times. The result of this

[issue23201] Decimal(0)**0 is an error, 0**0 is 1, but Decimal(0) == 0

2015-01-09 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: Does the spec have a handy list of differences to floats anywhere, or do you have to internalize the whole thing? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23201

Re: Decimals and other numbers

2015-01-09 Thread Devin Jeanpierre
on the reals. -- Devin On Thu, Jan 8, 2015 at 11:28 PM, Marko Rauhamaa ma...@pacujo.net wrote: Devin Jeanpierre jeanpierr...@gmail.com: If 0**0 is defined, it must be 1. You can justify any value a within [0, 1]. For example, choose y(a, x) = log(a, x) Then, limy(a, x) = 0 x - 0

Re: Decimals and other numbers

2015-01-09 Thread Devin Jeanpierre
On Fri, Jan 9, 2015 at 12:58 AM, Devin Jeanpierre jeanpierr...@gmail.com wrote: Arguably, *integer* 0**0 could be zero, on the basis that you can't take limits of integer-valued quantities, and zero times itself zero times surely has to be zero. I should have responded in more detail here

Re: Decimals and other numbers

2015-01-09 Thread Devin Jeanpierre
On Fri, Jan 9, 2015 at 12:49 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Devin Jeanpierre wrote: On Thu, Jan 8, 2015 at 6:43 PM, Dave Angel da...@davea.name wrote: What you don't say is which behavior you actually expected. Since 0**0 is undefined mathematically, I'd

  1   2   3   4   5   >