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

2022-05-12 Thread 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-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ide

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

2021-12-18 Thread Danilo J. S. Bellini
>> Python Language Consulting >> - Teaching >> - Scientific Software Development >> - Desktop GUI and Web Development >> - wxPython, numpy, scipy, Cython >> ___ >> Python-ideas mailing list -- python-ideas@python.org >>

[Python-ideas] Option to show help without typing

2021-05-08 Thread Danilo J. S. Bellini
sier 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

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

2019-11-15 Thread Danilo J. S. Bellini
lp messages documentation (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. Ca

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

2019-04-20 Thread Danilo J. S. Bellini
lt PYTHONSTARTUP file name in 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.

[Python-ideas] Open parenthesis in REPL completion

2019-04-19 Thread Danilo J. S. Bellini
quot; with 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 prohibition

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

2018-09-17 Thread Danilo J. S. Bellini
that uses "next" in its 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 cho

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

2018-08-15 Thread Danilo J. S. Bellini
siveness towards people who already know the concepts that should be emphasized, not some other arbitrary "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 s

Re: [Python-ideas] Add the imath module

2018-07-13 Thread Danilo J. S. Bellini
aware 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.

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

2018-05-31 Thread Danilo J. S. Bellini
something else for that specific error code. On 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

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

2018-05-30 Thread Danilo J. S. Bellini
; 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 c

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

2018-05-07 Thread Danilo J. S. Bellini
gt; 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", ..

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

2018-04-16 Thread Danilo J. S. Bellini
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 our business to

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

2018-04-14 Thread Danilo J. S. Bellini
ds 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 rationale on why this would be use

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

2018-03-20 Thread Danilo J. S. Bellini
ddress/name" and "module" 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

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] Reduce/fold and scan with generator expressions and comprehensions

2016-11-13 Thread Danilo J. S. Bellini
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 range(10)

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 : > 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 Python it can't b

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'

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

2016-11-06 Thread Danilo J. S. Bellini
avior. For me, the idea I'm proposing is clearly useful. I wanted to use it last friday to create a function that auto-indents some text based on some simple rules, and the resulting indentation is the "accumulation" (scan) of indent/dedent markers. But I couldn't even use itertools

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

2016-11-02 Thread Danilo J. S. Bellini
nt. 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 Cli

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

2016-11-02 Thread Danilo J. S. Bellini
ame thing as simply spelling it: > > accumulate(nums, 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 > iter

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

2016-10-25 Thread Danilo J. S. Bellini
son, but I wrote a lot about the scan use cases and no one here seem to have read what I wrote, and the only reason 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 on

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

2016-10-23 Thread Danilo J. S. Bellini
d. > > 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://pytho

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

2016-10-23 Thread Danilo J. S. Bellini
rtools.accumulate 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 --- "*I

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

2016-10-23 Thread Danilo J. S. Bellini
;t paste here any scan 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

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

2016-10-23 Thread Danilo J. S. Bellini
sary* to get 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 sh

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

2016-10-23 Thread Danilo J. S. Bellini
you call "sorted" 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

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

2016-10-23 Thread Danilo J. S. Bellini
function [2] https://pypi.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.r

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

2016-10-12 Thread Danilo J. S. Bellini
uot;hexdump" (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" s

Re: [Python-ideas] Shuffled

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

Re: [Python-ideas] Shuffled

2016-09-07 Thread Danilo J. S. Bellini
inputs (and there would be some "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 t

Re: [Python-ideas] Shuffled

2016-09-07 Thread Danilo J. S. Bellini
tools.repeat(container))". > > Cheers, > Nick. > > -- > Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia > -- Danilo J. S. Bellini --- "*It is not our business to set up prohibitions, but to arrive at conventions.*" (R. Carnap) _

Re: [Python-ideas] Shuffled

2016-09-07 Thread Danilo J. S. Bellini
unction at the top of > your module isn't sufficient. > > For what's it is worth, if it were *my* call, I'd accept that the costs > of adding this are low, but the benefits are just a *tiny* bit higher. > But that's a judgement call, and if Raymond see t