Re: [Python-ideas] slice[] to get more complex slices

2018-07-23 Thread Joseph Jevnik
I still think that 'operator.subscript' would be valuable to me for all of the same reasons discussed in the previous threads and issues. I don't understand why it was reverted without any serious discussion given that it was already accepted and many people find this useful. On Mon, Jul 23, 2018

Re: [Python-ideas] Do not block threads when pickle/unpickle

2018-07-16 Thread Joseph Jevnik
The GIL must be held to allocate memory for Python objects and to invoke the Python code to deserialize user defined picklable objects. I don't think there is a long span of time where the code could leave the GIL released. The Python implementation is just pausing to let other Python threads run,

Re: [Python-ideas] Add new `Symbol` type

2018-07-05 Thread Joseph Jevnik
I have also wanted sentinel objects many times. These are often useful for creating a "Not Specified" default value when explicitly passing `None` has semantic meaning. There are a few issues with the `sentinel = object()` code. One is that they don't repr well so they make debugging harder. Anoth

Re: [Python-ideas] Copy (and/or pickle) generators

2018-06-20 Thread Joseph Jevnik
This was already posted in the thread, but https://github.com/ll/cloudpickle-generators is just an extension to the standard pickle machinery and is able to support closures, nonlocals, and globals: https://github.com/ll/cloudpickle-generators/blob/master/cloudpickle_generators/test

Re: [Python-ideas] Non-intrusive debug logging

2018-01-25 Thread Joseph Jevnik
This can be accomplished as a decorator. Jim Crist wrote a version of this using the codetransformer library. The usage is pretty simple: @trace() def sum_word_lengths(words): total = 0 for w in words: word_length = len(w) total += word_length return total >>> sum_wo

Re: [Python-ideas] f-string literals by default?

2017-12-05 Thread Joseph Jevnik
This would break code that uses str.format everywhere for very little benefit. On Tue, Dec 5, 2017 at 4:19 PM, Neil Schemenauer wrote: > I think most people who have tried f-strings have found them handy. > Could we transition to making default string literal into an > f-string? I think there is

Re: [Python-ideas] Should Python have user-defined constants?

2017-11-20 Thread Joseph Jevnik
How is that different from "pi = 3.14"? On Tue, Nov 21, 2017 at 1:33 AM, Saeed Baig wrote: > Hey guys I am thinking of perhaps writing a PEP to introduce user-defined > constants to Python. Something along the lines of Swift’s “let” syntax (e.g. > “let pi = 3.14”). > > Do you guys think it would

Re: [Python-ideas] a new namedtuple

2017-07-17 Thread Joseph Jevnik
If we are worried about speed but want to keep the same API I have a near drop in replacement for collections.namedtuple that dramatically improves class and instance creation speed [1]. The only things missing from this implementation are `_source` and `verbose` which could be dynamically computed

Re: [Python-ideas] Delayed Execution via Keyword

2017-03-02 Thread Joseph Jevnik
he state variables in a list iterator are > actually visible to the Interpreter or if it's implemented in C that is > inscrutable to the interpreter. > > > On Mar 2, 2017 5:54 PM, "Joseph Jevnik" wrote: > > Other things that scrutinize an expression are iteration

Re: [Python-ideas] Delayed Execution via Keyword

2017-03-02 Thread Joseph Jevnik
Other things that scrutinize an expression are iteration or branching (with the current evaluation model). If `xs` is a thunk, then `for x in xs` must scrutinize `xs`. At first this doesn't seem required; however, in general `next` imposes a data dependency on the next call to `next`. For example:

Re: [Python-ideas] Delayed Execution via Keyword

2017-02-17 Thread Joseph Jevnik
ave side effects and delayed execution anywhere near each other. You only open youself up to a long list of special cases for when and where things get evaluated. On Fri, Feb 17, 2017 at 4:49 PM, Ed Kellett wrote: > On Fri, 17 Feb 2017 at 21:18 Joseph Jevnik wrote: > >> There is n

Re: [Python-ideas] Delayed Execution via Keyword

2017-02-17 Thread Joseph Jevnik
ht now then the order of evaluation is part of the correctness of your program and you need to sequence execution such that `d` is evaluated before creating that closure. On Fri, Feb 17, 2017 at 4:17 PM, Joseph Jevnik wrote: > There is no existing code that uses delayed execution so we don'

Re: [Python-ideas] Delayed Execution via Keyword

2017-02-17 Thread Joseph Jevnik
t the observable side-effect? On Fri, Feb 17, 2017 at 4:14 PM, Ed Kellett wrote: > On Fri, 17 Feb 2017 at 19:38 Joseph Jevnik wrote: > >> Delayed execution and respecting mutable semantics seems like a >> nightmare. For most indexers we assume hashability which implies >&g

Re: [Python-ideas] Delayed Execution via Keyword

2017-02-17 Thread Joseph Jevnik
Delayed execution and respecting mutable semantics seems like a nightmare. For most indexers we assume hashability which implies immutability, why can't we also do that here? Also, why do we need to evaluate callables eagerly? re the thunk replacing itself with the result instead of memoizing the

Re: [Python-ideas] Delayed Execution via Keyword

2017-02-17 Thread Joseph Jevnik
isy! It's an interesting project too. The behavior > of 'autodask()' is closer to what I'd want in new syntax than is plain > dask.delayed(). I'm not sure of all the corners. But is definitely love to > have it for expressions generally, not only pure functions. > &g

Re: [Python-ideas] Delayed Execution via Keyword

2017-02-17 Thread Joseph Jevnik
You can let dask "see" into the function by entering it and wrapping all of the operations in `delayed`; this is how daisy[0] builds up large compute graphs. In this case, you could "inline" the identity function and the delayed object would flow through the function and the call to identity never

Re: [Python-ideas] Delayed Execution via Keyword

2017-02-16 Thread Joseph Jevnik
You might be interested in https://github.com/ll/lazy_python, which implements the features you describe but instead of a keyword it uses a decorator. On Fri, Feb 17, 2017 at 12:24 AM, Joseph Hackman wrote: > Howdy All! > > This suggestion is inspired by the question on "Efficient debug

Re: [Python-ideas] Python multi-dimensional array constructor

2016-10-19 Thread Joseph Jevnik
You could add or prototype this with quasiquotes ( http://quasiquotes.readthedocs.io/en/latest/). You just need to be able to parse the body of your expression as a string into an array. Here is a quick example with a parser that only accepts 2d arrays: ``` # coding: quasiquotes import numpy as n

Re: [Python-ideas] Thunks (lazy evaluation) [was Re: Delay evaluation of annotations]

2016-09-26 Thread Joseph Jevnik
Hello everyone, this idea looks like something I have tried building already: https://github.com/ll/lazy_python. This project implements a `thunk` class which builds up a deferred computation which is evaluated only when needed. One use case I have had for this project is building up a larg