Re: [Python-ideas] Shuffled

2016-09-08 Thread Danilo J. S. Bellini
; > > pozdrawiam, > Arkadiusz Bulski > > > ___ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/code

Re: [Python-ideas] Shuffled

2016-09-07 Thread Danilo J. S. Bellini
e "state" in that "implicit input"). That would also be a great feature when non-uniform (or external) random number generators are to be used. This seem to be something that only shuffle gives some control (among the functions we're talking about), or am I missing someth

Re: [Python-ideas] Reduce/fold and scan with generator expressions and comprehensions

2016-11-06 Thread Danilo J. S. Bellini
d a really strong reason to migrate to Python 3 a proprietary legacy code that isn't mine, and any "anti-functional" / "anti-expression" bias is a strong reason not to do so. Also, it's worth noting that the "functional" package in PyPI doesn't work on Python 3. Stuff

Re: [Python-ideas] Reduce/fold and scan with generator expressions and comprehensions

2016-11-06 Thread Danilo J. S. Bellini
2016-11-06 18:00 GMT-02:00 Stephen J. Turnbull < turnbull.stephen...@u.tsukuba.ac.jp>: > Danilo J. S. Bellini writes: > > > About the effort, do you really find the examples below with the new > > proposed syntax difficult to understand? > > No. I just don't see

Re: [Python-ideas] Reduce/fold and scan with generator expressions and comprehensions

2016-11-06 Thread Danilo J. S. Bellini
2016-11-06 23:55 GMT-02:00 Steven D'Aprano <st...@pearwood.info>: > On Sun, Nov 06, 2016 at 04:46:42PM -0200, Danilo J. S. Bellini wrote: > > > 1.2. Sub-expressions in an expression might be on other statements (e.g. > > assignments, other functions). > > Not in

Re: [Python-ideas] Proposal for default character representation

2016-10-12 Thread Danilo J. S. Bellini
ot; (or any binary file viewer) with decimal output instead of hexadecimal? I agree that mixing representations for the same abstraction (using decimal in some places, hexadecimal in other ones) can be a bad idea. Actually, that makes me believe "decimal unicode codepoint" shouldn't ever appear

Re: [Python-ideas] Reduce/fold and scan with generator expressions and comprehensions

2016-10-23 Thread Danilo J. S. Bellini
te in some sense. The advantages would be: 1 - The scan signature and the functools.reduce signature are the same (the function as the first parameter, like map/filter) 2 - The module, functools, is the same that has the reduce function -- Danilo J. S. Bellini --- "*It is no

Re: [Python-ideas] Reduce/fold and scan with generator expressions and comprehensions

2016-10-23 Thread Danilo J. S. Bellini
an use case because I sent links with several use cases, should I paste their contents here? The PyScanPrev link (https://github.com/ danilobellini/pyscanprev) has several use case examples (including some just for a comparison with other possible solutions) and even have a full rationale for t

[Python-ideas] Reduce/fold and scan with generator expressions and comprehensions

2016-10-23 Thread Danilo J. S. Bellini
.python.org/pypi/pyscanprev [3] https://groups.google.com/forum/#!topic/grupy-sp/wTIj6G5_5S0 [4] https://github.com/danilobellini/pyscanprev/blob/v0.1.0/examples/conditional-toggling.rst [5] https://github.com/danilobellini/pyscanprev/blob/v0.1.0/examples/state-space.rst [6] https://groups.goo

Re: [Python-ideas] Reduce/fold and scan with generator expressions and comprehensions

2016-10-23 Thread Danilo J. S. Bellini
et the last item. There's no way > around that. > Not if there's enough information to create the last value. Perhaps on the it = iter(range(999)) one can get 2 values (call next(it) twice) and use its __length_hint__ to create the last value. But I think only sequences should have such an optimiz

Re: [Python-ideas] Reduce/fold and scan with generator expressions and comprehensions

2016-10-23 Thread Danilo J. S. Bellini
d" on endless iterables, it would behave like "last", doesn't it? The whole point of this idea is the scan as a generator expression or list/set comprehension that can access the previous iteration output. Reduce/fold is just the last value of a scan, and the scan is sti

Re: [Python-ideas] Reduce/fold and scan with generator expressions and comprehensions

2016-10-23 Thread Danilo J. S. Bellini
; > But if it is indeed just reduce(), then it's even simpler. > > ChrisA > ___ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/

Re: [Python-ideas] Reduce/fold and scan with generator expressions and comprehensions

2016-10-25 Thread Danilo J. S. Bellini
n that matters seem to be a kind of social status, not really "reason". I probably wrote way more reasons for that proposal than annotations could ever have. But if no one seem to care enough to read, then why should I insist? That's like my pprint bugfix patch some months ago, was it appl

Re: [Python-ideas] Reduce/fold and scan with generator expressions and comprehensions

2016-11-13 Thread Danilo J. S. Bellini
[0, 1])) [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] With the "windowed scan" syntax proposal, it would become: >>> [fibs[-1] + fibs[-2] for unused in range(10) with fibs = [0, 1]] [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] Or: >>> [fibs[-1] + fibs[-2] for unused in

Re: [Python-ideas] Reduce/fold and scan with generator expressions and comprehensions

2016-11-02 Thread Danilo J. S. Bellini
ums, mul) > > Which is even shorter. It's feels very artificially contrived to insist > that the initial element must live somewhere other than the iterator > itself. But it would be easy enough to write a wrapper to massage an > iterator for this special case: > > def prepend(item, i

Re: [Python-ideas] Reduce/fold and scan with generator expressions and comprehensions

2016-11-02 Thread Danilo J. S. Bellini
insufficient. Brendan, please see the PyScanPrev examples, mainly the Fibonacci and the State-space model examples. Recursion is enough to give you that. The proposal isn't about lag and windowing, but if you've got an idea to improve that, I'd like to know. 2016-10-25 15:55 GMT-02:00 Rob Cliffe

Re: [Python-ideas] + operator on generators

2017-06-25 Thread Danilo J. S. Bellini
tuple(a + b) # -> 0 1 2 3 AudioLazy does that: https://github.com/danilobellini/audiolazy -- Danilo J. S. Bellini --- "*It is not our business to set up prohibitions, but to arrive at conventions.*" (R. Carnap) ___ P

Re: [Python-ideas] Add "default" kw argument to operator.itemgetter and operator.attrgetter

2018-05-07 Thread Danilo J. S. Bellini
/ > issue14384#msg316222 for examples and alternatives). As attrgetter/itemgetter might get heterogeneus data, I would expect a per-get default, not [just] a global default. Perhaps something like: >>> itemgetter(-1, 0, -2, ... default0="first argument default",

[Python-ideas] Let try-except check the exception instance

2018-05-30 Thread Danilo J. S. Bellini
t; try: ... raise Exception("message") ... except Exception as exc: ... print(isinstance(exc, ExceptionHasMessage)) ... True The idea is to allow catching exceptions beyond checking their MRO, using a class that checks the exception instance by implementing a custom

Re: [Python-ideas] Let try-except check the exception instance

2018-05-31 Thread Danilo J. S. Bellini
31 May 2018 at 06:29, Stephan Houben wrote: > "[...] The exception matching machinery ignores the __instancecheck__ > mechanism." > The __subclasscheck__ gets bypassed, as well. -- Danilo J. S. Bellini --- "*It is not our business to set up prohibitions, but to arrive at conve

Re: [Python-ideas] Does jargon make learning more difficult?

2018-08-15 Thread Danilo J. S. Bellini
trary "simplification" goal (e.g. minimize the number of characters, only use English, ...). IMHO, avoiding jargon sounds like avoiding teaching. In the case of new Python stuff, avoiding the socially standardized terminology is an act of isolation/seclusion. -- Danilo J. S. Bellini ---

Re: [Python-ideas] Add the imath module

2018-07-13 Thread Danilo J. S. Bellini
that it might be slow. The alternatives are: - exact, unbounded: Slower test - not exact, unbounded: Probabilistic test - exact, bounded: Default, raises OverflowError beyond 2**64 - not exact, bounded: Invalid, but it can just ignore exact input -- Danilo J. S. Bellini

Re: [Python-ideas] Proposal: A Reduce-Map Comprehension and a "last" builtin

2018-04-14 Thread Danilo J. S. Bellini
esult, I wrote this project, that adds the "scan" feature to Python comprehensions using a decorator that performs bytecode manipulation (and it had to fit in with a valid Python syntax): https://github.com/danilobelli ni/pyscanprev In that GitHub page I've wrote several examples and a rationa

Re: [Python-ideas] Proposal: A Reduce-Map Comprehension and a "last" builtin

2018-04-16 Thread Danilo J. S. Bellini
2, 1, -1, -2], decay=.1, memory=5)) [5, 4.6, 4.34, 4.206, 3.9854, 3.68686, 3.218174, 2.6963566] In that example, "y" is the "previous result" (a.k.a. accumulator, or what had been called "average" here). -- Danilo J. S. Bellini --- "*It is not

Re: [Python-ideas] Disallow importing the same module under multiple names

2018-03-20 Thread Danilo J. S. Bellini
quot; be 1-to-1 concepts (or neither)? How about symbolic links? I'm not sure, but linking "absolute file name" to "module" sounds like endorsing the relative-importable-from-external-scripts naming style, and IMHO that's not the main issue. As packages with modules

[Python-ideas] Revert "RuntimeError: generator raised StopIteration"

2018-09-17 Thread Danilo J. S. Bellini
body. But I can't do that to all packages from other people, and having to change/monkeypatch imported stuff in order to keep it working in this new Python version is getting annoying already. Perhaps adding a new kwarg to the "next" built-in to choose between a "propagate" defa

Re: [Python-ideas] Open parenthesis in REPL completion

2019-04-20 Thread Danilo J. S. Bellini
Python 3.7.3, or at least a single global configuration file for the REPL where I can put that oneliner or a file reference with that line? I strongly prefer not to mess around with ~/.bashrc, ~/.zshrc and scattered stuff like that, if possible. -- Danilo J. S. Bellini --- &q

[Python-ideas] Open parenthesis in REPL completion

2019-04-19 Thread Danilo J. S. Bellini
unmatched parentheses, because the "something" was filled by a TAB completion, and the trailing open parenthesis wasn't expected (given that there's no such a completion elsewhere). -- Danilo J. S. Bellini --- "*It is not our business to set up prohibitions, but to arrive at

[Python-ideas] Use __signature__ in help() and perhaps somewhere else too

2019-11-15 Thread Danilo J. S. Bellini
ation (e.g. to avoid showing just a "**kwargs" when the valid keyword arguments can be grabbed from the function that uses them). Regards, Danilo J. S. Bellini --- "*It is not our business to set up prohibitions, but to arrive at conventions.*" (R. Carnap) __

[Python-ideas] Option to show help without typing

2021-05-08 Thread Danilo J. S. Bellini
ier to find the default values, to count the parameters, etc.. -- Danilo J. S. Bellini ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-idea

[Python-ideas] Re: Add a decorators called @staticproperty

2021-12-18 Thread Danilo J. S. Bellini
gt;> - Scientific Software Development >> - Desktop GUI and Web Development >> - wxPython, numpy, scipy, Cython >> ___ >> Python-ideas mailing list -- python-ideas@python.org >> To unsubscribe send an email to python-ideas-le...@python.or

[Python-ideas] Re: Heterogeneous numeric data in statistics library

2022-05-12 Thread Danilo J. S. Bellini
thon-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/5QN2E5F3L4S2SEEWOF