[Python-ideas] Re: re.match(pattern, string, require=True)

2023-10-22 Thread Juancarlo Añez
The *re* module is a black swan, because most of stdlib raises exceptions on invalid arguments or not being able to deliver. It's impossible to change *re* now, so wrapping the calls should be the right solution. -- Juancarlo Añez mailto:apal...@gmail.com On Sun, Oct 22, 2023 at 5:19 AM

[Python-ideas] Re: Bringing the print statement back

2022-03-02 Thread Juancarlo Añez
). -- Juancarlo Añez mailto:apal...@gmail.com On Tue, Jun 9, 2020 at 8:09 PM Guido van Rossum wrote: > In Python 3.10 we will no longer be burdened by the old parser (though 3rd > party tooling needs to catch up). > > One thing that the PEG parser makes possible in about 20 lines of code is

[Python-ideas] Re: Power Assertions: Is it PEP-able?

2021-09-14 Thread Juancarlo Añez
s turned off only with -O, and some that never are? > There are lots of ways `assert` could be improved, and the question is > how? What is/are the best way(s)? > > -- > Finn Mason > > On Mon, Sep 13, 2021, 5:36 AM Juancarlo Añez wrote: > >> What about asserts that are not

[Python-ideas] Re: Power Assertions: Is it PEP-able?

2021-09-13 Thread Juancarlo Añez
__ >> 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://m

[Python-ideas] Re: Different exceptions for assert

2021-09-12 Thread Juancarlo Añez
shortcutting to an "*if not"*. I do really like this option. On Sun, Sep 12, 2021 at 1:46 AM Steven D'Aprano wrote: > On Sat, Sep 11, 2021 at 02:30:10PM -0400, Juancarlo Añez wrote: > > > *invariant* cond: etc > > A software invariant is still an assertion. > >

[Python-ideas] Re: Different exceptions for assert

2021-09-11 Thread Juancarlo Añez
Sep 11, 2021 at 2:05 PM David Mertz, Ph.D. wrote: > On Sat, Sep 11, 2021 at 9:20 AM Juancarlo Añez wrote: > >> I'm happy about dropping the DBC theme and rebooting to make *assert* easier >> to use so it gets used more. >> > > I agree with Steven, Marc-Andé, an

[Python-ideas] Re: Different exceptions for assert

2021-09-11 Thread Juancarlo Añez
Marc-Andre, I must agree that the current state of assertions with "-O" and "-OO" is difficult to impossible to change. Perhaps I'm looking for an: *invariant* cond: etc Regards, On Sat, Sep 11, 2021 at 11:00 AM Marc-Andre Lemburg wrote: > On 11.09.2021 15:1

[Python-ideas] Re: Different exceptions for assert

2021-09-11 Thread Juancarlo Añez
It's fair to note that complex arguments to assertions can be hacked with: *assert* cond, ( f'{conputesomething} {and more}' f''{some more}' ) The exception type can't be changed, though. On Sat, Sep 11, 2021 at 9:17 AM Juancarlo Añez wrote: > Stephen, > > Assert

[Python-ideas] Re: Different exceptions for assert

2021-09-11 Thread Juancarlo Añez
be true of the > contracts in DBC, I don't know. But I would prefer not to mix the > difficulties of the semantics of "contract" with the simplicity of > the semantics of "assert". > > Steve > > -- Juancarlo *Añez* ___

[Python-ideas] Re: Different exceptions for assert

2021-09-10 Thread Juancarlo Añez
-09-09 22:31, Juancarlo Añez wrote: > > Well, if the idea makes sense, then I'm certain that we'll have a very > > long and productive discussion about the best syntax here (re: *:=*). > > > > ;-) > > > > For backwards compatibility and no surprises: >

[Python-ideas] Re: Different exceptions for assert

2021-09-10 Thread Juancarlo Añez
ition always, > just use an if and a raise: > > How is this: > > if value < 0: > raise ValueError("this only works with positive numbers") > > Any more difficult to read or write than: > > assert value >= 0, raise ValueError("this only works

[Python-ideas] Re: Different exceptions for assert

2021-09-09 Thread Juancarlo Añez
d can become optional. > > —Guido > > On Thu, Sep 9, 2021 at 09:04 Juancarlo Añez wrote: > >> Steven, >> >> The purpose is to make it easier to make software more resilient. >> >> The inspiration was this article that reminded me that software *_will >> al

[Python-ideas] Re: Different exceptions for assert

2021-09-09 Thread Juancarlo Añez
that easy and syntactically pleasant? On Thu, Sep 9, 2021 at 12:02 PM Juancarlo Añez wrote: > Steven, > > The purpose is to make it easier to make software more resilient. > > The inspiration was this article that reminded me that software *_will > always fail_*, and also rem

[Python-ideas] Re: Different exceptions for assert

2021-09-09 Thread Juancarlo Añez
> On Tue, Sep 07, 2021 at 11:12:37AM -0400, Juancarlo Añez wrote: > > I won't propose a syntax, but I think it would be useful if *assert* > could > > raise an exception different from *AssertionError*. > > > > This is in the context of "Design by contrast"

[Python-ideas] Different exceptions for assert

2021-09-07 Thread Juancarlo Añez
that verifies its state at runtime through assertions. An SO reference to the basic inquiry: https://stackoverflow.com/questions/1569049/making-pythons-assert-throw-an-exception-that-i-choose -- Juancarlo *Añez* ___ Python-ideas mailing list -- python-ideas@py

[Python-ideas] Re: What about having a .get(index, default) method for arrays like we have for dicts?

2020-06-30 Thread Juancarlo Añez
n3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/LLK3EQ3QWNDB54SEBKJ4XEV4LXP5HVJS/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- Juancarlo *Añez* __

[Python-ideas] Re: python -m quality of life improvements

2020-01-11 Thread Juancarlo Añez
ight). It's hard to write scripts in Python that have access to the modules they intuitively should have access to, without patching (`sys.path.insert(...)` is awful) -- Juancarlo *Añez* ___ Python-ideas mailing list -- python-ideas@python.org To uns

[Python-ideas] Re: python -m quality of life improvements

2020-01-11 Thread Juancarlo Añez
t easier all around. and "python -m" provides a much nicer > project structure than "python" IMO and I'd like to encourage ppl to switch > their "python" projects to "python -m" projects. > > On 2020-01-11 7:28 p.m., Juancarlo Añez wrote: > >

[Python-ideas] Re: python -m quality of life improvements

2020-01-11 Thread Juancarlo Añez
tion into python -m instead. why's that so > bad? it's simply ergonomics. > > On 2020-01-11 6:28 p.m., Juancarlo Añez wrote: > > Soni, > > Perhaps what you're looking for is available by writing a short Python > program with a shebang? Then PYTHONPATH would be set to t

[Python-ideas] Re: python -m quality of life improvements

2020-01-11 Thread Juancarlo Añez
e qux.py) > > > > > ___ > 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 &

[Python-ideas] Integrating Discourse and email for python-ideas

2020-01-07 Thread Juancarlo Añez
orough threading provided by Discourse. Could we switch the email discussions to Discourse email? Has this been considered earlier and rejected? Cheers, -- Juancarlo *Añez* ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an

[Python-ideas] Re: findfirst() from findalliter(), and first

2019-12-29 Thread Juancarlo Añez
()*?) Cheers, On Sat, Dec 28, 2019 at 4:03 PM Andrew Barnert wrote: > On Dec 28, 2019, at 10:12, Juancarlo Añez wrote: > > > As far as I understand it, my implementation of *findalliter()* matches > the semantics in the *switch* statement. > > > There’s nothing outs

[Python-ideas] Re: findfirst() from findalliter(), and first

2019-12-28 Thread Juancarlo Añez
_checks(s) base = s for i in range(2, 10): s = base * i g = re.findall('a', s) assert len(g) == i all_checks(s) Cheers, On Fri, Dec 27, 2019 at 5:37 PM Andrew Barnert wrote: > > On Dec 27, 2019, at 09:00, Juancarlo Añez wrote: > > > &g

[Python-ideas] Re: Fix statistics.median()?

2019-12-27 Thread Juancarlo Añez
ailing 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/524SWHDA3HVPDIQ6F6S3OMFGFX

[Python-ideas] findfirst() from findalliter(), and first

2019-12-27 Thread Juancarlo Añez
r first(findall(...)) """ return first(findalliter(pattern, string, flags=flags), default=default) ``` Fon *first()*, maybe calling it *take_one()* will clear up misunderstandings about it's semantics. -- Juancarlo *Añez* ___ Pytho

[Python-ideas] Re: __eq__ and __ne__

2019-12-27 Thread Juancarlo Añez
//python.org/psf/codeofconduct/ > -- Juancarlo *Añez* ___ 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 arc

[Python-ideas] Re: Argumenting in favor of first()

2019-12-14 Thread Juancarlo Añez
* should be would be a great step forward. -- Juancarlo *Añez* ___ 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

[Python-ideas] Re: Argumenting in favor of first()

2019-12-12 Thread Juancarlo Añez
articular. In that context, *takeone()* sounds a lot like if any random result is fine. The docs can be simpler (less special cases) if it's called *first()* by just explaining that the result is *next(iter(it))* with provisions for non-yielding iterators and default return values. -- Juanca

[Python-ideas] Fwd: Re: Argumenting in favor of first()

2019-12-09 Thread Juancarlo Añez
* and there is no *default=* should be the same. -- Juancarlo *Añez* ___ 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.pyt

[Python-ideas] Re: Fwd: Re: Fwd: re.findfirst()

2019-12-07 Thread Juancarlo Añez
s always a string, while the first element in the list returned by *findall()* will be a tuple if several groups matched. As others have pointed out, there is an asymmetry in the library regarding Match-return and string/tuple-return functions, and that leads to *findal(...)[0

[Python-ideas] Re: Fwd: Re: Fwd: re.findfirst()

2019-12-06 Thread Juancarlo Añez
a *findalliter()* using the current *findall()* code, and implement *findall() *and *findfirst()* by calling that. On Thu, Dec 5, 2019 at 10:31 PM Guido van Rossum wrote: > On Thu, Dec 5, 2019 at 6:16 PM Juancarlo Añez wrote: > >> It’s unfortunate that these functions aren’t better

[Python-ideas] Fwd: Re: Fwd: re.findfirst()

2019-12-05 Thread Juancarlo Añez
e for *findfirst()* is weaker if *first()* is available. Yet *findfirst()* solves the bigger problem. -- Juancarlo *Añez* ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https:/

[Python-ideas] Fwd: re.findfirst()

2019-12-03 Thread Juancarlo Añez
*findfirst()*. -- Juancarlo *Añez* ___ 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-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading (was: (Re: Re: Overloading assignment concrete proposal (Re: Re: Operator as first class citizens -- like in s

2019-06-25 Thread Juancarlo Añez
int know to call getself, but type know not to? >>> >>> ChrisA >>> ___ >>> Python-ideas mailing list -- python-ideas@python.org >>> To unsubscribe send an email to python-ideas-le...@python.org >&

Re: [Python-ideas] Syntax for allowing extra keys when unpacking a dict as keyword arguments

2019-04-13 Thread Juancarlo Añez
On Sat, Apr 13, 2019 at 9:02 AM Chris Angelico wrote: > Would be really nice to be able to spell this as a dict/set intersection. > > func(**(d & {'a', 'b', 'c'})) > That would be _very_ consistent with the ongoing discussions about operators over dicts. --

Re: [Python-ideas] Syntax for allowing extra keys when unpacking a dict as keyword arguments

2019-04-13 Thread Juancarlo Añez
c=kwargs_dict["c"], > ) > func(**{k:v for k, v in d.items() if k in ('a','b','c')) Or you can `def dict_filter(d, yes)` to the the above. -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org https://m

Re: [Python-ideas] Python list of list matrixes without NumPy

2019-04-06 Thread Juancarlo Añez
[ins] In [2]: x Out[2]: [[False, False], [False, False], [False, False], [False, False], [False, False]] [ins] In [3]: x[1][1] = True [ins] In [4]: x Out[4]: [[False, True], [False, True], [False, True], [False, True], [False, True]] -- Juancarlo *Añez* ___

[Python-ideas] Python list of list matrixes without NumPy

2019-04-05 Thread Juancarlo Añez
(n, m, o, p, init=float) Maybe it could also be done with syntax, but I don't have any ideas in that regard (I don't think "lol()" is overloaded). Regards, -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org https://mail.

Re: [Python-ideas] Why not ['a','b','c'].join(',') ?

2019-03-24 Thread Juancarlo Añez
On Sun, Mar 24, 2019 at 5:11 AM Jonathan Fine wrote: > I'm willing to provide some useful information, if you're willing to write > it up into a good blog post. > ... or a PEP for rejection. Deal! -- Juancarlo *Añez* ___ Python-ideas mai

[Python-ideas] Why not ['a','b','c'].join(',') ?

2019-03-23 Thread Juancarlo Añez
it wouldn't hurt to make Python more familiar/friendly to people coming from other languages, even if it breaks "There should be one-- and preferably only one --obvious way to do it." -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@

[Python-ideas] True and False are singletons

2019-03-18 Thread Juancarlo Añez
key: if settings[MY_KEY] is True: ... If True and False are singletons in the spec (and not only in the CPython implementation), it should be prominent and well known. Cheers, -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas

Re: [Python-ideas] PEP 8 update on line length

2019-02-22 Thread Juancarlo Añez
an exception in that after taking 8 spaces of indentation to write the implementation of a method in Python, the sweet spot is more around 100 chars. -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/lis

Re: [Python-ideas] Type hints for functions with side-effects and for functions raising exceptions

2019-02-22 Thread Juancarlo Añez
On Thu, Feb 21, 2019 at 11:32 PM Chris Angelico wrote: > On Fri, Feb 22, 2019 at 2:27 PM Juancarlo Añez wrote: > > Then, if exceptions are going to be part of a type, there should be a > way to express the semantics of them (like in Eiffel), so > stack.pop();stack.push(x) doesn'

Re: [Python-ideas] Type hints for functions with side-effects and for functions raising exceptions

2019-02-21 Thread Juancarlo Añez
rm hint me about the actual exceptions a given call may actually raise. Newer languages like Go and Swift shy away from exceptions because of the tendency to: try: # something except: print('oops!) -- Juancarlo *Añez* ___ Python-ideas mail

Re: [Python-ideas] Type hints for functions with side-effects and for functions raising exceptions

2019-02-21 Thread Juancarlo Añez
y time a dependency changes its implementation. The strategy of catching only exceptions of interest and letting others pass produces less fragile and easier to test code. -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org https://mail.pyt

[Python-ideas] [off-topic?] Unwinding generators

2018-11-29 Thread Juancarlo Añez
specially if exceptions escape from the final callback. Is there a bug in exception handling in the generator logic, or is unwinding just inherently wrong? How could the needs tried to solved with unwinding be handled with async? -- Juancarlo *Añez*

Re: [Python-ideas] Range and slice syntax

2018-11-11 Thread Juancarlo Añez
{'a': 1} In [*2*]: {('a':1)} File "", line 1 {('a':1)} ^ SyntaxError: invalid syntax -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Co

Re: [Python-ideas] loop: statement

2018-10-29 Thread Juancarlo Añez
bsolute-need_ basis. On Sat, Oct 27, 2018 at 8:33 PM Steven D'Aprano wrote: > On Sat, Oct 27, 2018 at 07:37:32PM -0400, Juancarlo Añez wrote: > > > A `loop:` statement to replace `while True:` has probably been discussed > at > > length more than once. > > > >

[Python-ideas] loop: statement

2018-10-27 Thread Juancarlo Añez
A `loop:` statement to replace `while True:` has probably been discussed at length more than once. Does anyone keep links to the discussions? TIA! -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org

Re: [Python-ideas] Moving to another forum system where moderation is possible

2018-09-18 Thread Juancarlo Añez
p...@phdru.name >Programmers don't die, they just GOSUB without RETURN. > ___ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ >

Re: [Python-ideas] Alternative spelling for list.append()

2018-06-18 Thread Juancarlo Añez
globals(), number=REPS)) if __name__ == '__main__': main() -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Alternative spelling for list.append()

2018-06-18 Thread Juancarlo Añez
ist += [item] gets optimized to mylist.append(item). -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] A PEP on introducing variables on 'if' and 'while'

2018-06-10 Thread Juancarlo Añez
+)-(\d+)$', identifier) if not m: raise ValueError('f{identifier} is not a valid identifier') print(f'first part is {m.group(1)}') print(f'first part is {m.group(2)}') -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org

Re: [Python-ideas] A PEP on introducing variables on 'if' and 'while'

2018-06-10 Thread Juancarlo Añez
it or not, I expect that they will be seen as competing PEPs, not > independent ones. Finding a real-world example of something like the above synthetic example would be in favor of the orthogonality. -- Juancarlo *Añez* ___ Python-ideas mailing list P

Re: [Python-ideas] A PEP on introducing variables on 'if' and 'while'

2018-06-09 Thread Juancarlo Añez
efore you do, and > expect to have your PEP compared to it. > My intention would be to make the to proposals orthogonal, if possible, so both/any can be accepted or rejected in their own timeline. I'm certain that both can live together. -- Juancarlo *Añez* __

[Python-ideas] A PEP on introducing variables on 'if' and 'while'

2018-06-09 Thread Juancarlo Añez
Hello @here, Is there a guide about writing (and publishing) PEPs? I'd like to write one on `while expre as v: ...` using the context semantics of `with expr as v` (not `except E as e`). Cheers, ___ Python-ideas mailing list Python-ideas@python.org

Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-21 Thread Juancarlo Añez
ile", they pattern might be: while get_something() as v: if v == INCONVENIENT_SENTINEL: break do_something(v) The discussion isn't over, so it could also be: while (get_something() as v) != INCONVENIENT_SENTINEL: do_something(v)

Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-20 Thread Juancarlo Añez
Anyway, if you want to propose an alternative to PEP 572, you ought to > write your own competing PEP. > I don't take that as a challenge. It would be good to have different, maybe somewhat competing PEPs. It's been done before. -- Juancarlo *Añez*

Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-20 Thread Juancarlo Añez
way from ":=". For example, Should this be valid? if child_pid := os.fork(): parent(child_pid) else: child() print(child_pid) This shouldn't be: if os.fork() as child_pid: parent(child_pid) else: child() print(child_pid) # child_pid is undefined -- Juancarlo *Añez* _

Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-20 Thread Juancarlo Añez
ments in favor of "as" are around the patterns exemplified by the "re" module; patterns which seem correct and useful, and that are used by other standard and 3rd-party modules. if os.fork() as child_pid: parent(child_pid) else: child() Cheers! -- Ju

Re: [Python-ideas] Inline assignments using "given" clauses

2018-05-13 Thread Juancarlo Añez
tions like special_gcd() inline, right before it is first used. -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Inline assignments using "given" clauses

2018-05-12 Thread Juancarlo Añez
just by reading the code. It could also be: if special_gcd(x - x_base, n) as g: return g Cheers! Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http:/

[Python-ideas] Inline changes to context, or PEP572

2018-05-12 Thread Juancarlo Añez
ely be on the "don't use :=, unless" band of pundits (already a filibuster). ":=" is like going back to "reduce()", which is almost defunct thanks to.. us! Cheers! -- Juancarlo *Añez* ___ Python-ideas mailing list Pytho

Re: [Python-ideas] Inline assignments using "given" clauses

2018-05-12 Thread Juancarlo Añez
with" or "given". I don't remember if "when" was already rejected. http://www.thesaurus.com/browse/with?s=t http://www.thesaurus.com/browse/given?s=t http://www.thesaurus.com/browse/considering?s=t http://www.thesaurus.com/browse/assume?s=t http://www.thesaurus.com/browse/when?s=t C

Re: [Python-ideas] Inline assignments using "given" clauses

2018-05-11 Thread Juancarlo Añez
> > while (cmd := get_command()).token != CMD_QUIT: > > cmd.do_something() > > while get_command() as cmd: if cmd.token == CMD_QUIT: break cmd.do_something() -- Juancarlo *Añez* ___ Python-ideas mailing

Re: [Python-ideas] A comprehension scope issue in PEP 572

2018-05-08 Thread Juancarlo Añez
ike the new syntax, or that I'am biased towards using "as". -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] A comprehension scope issue in PEP 572

2018-05-08 Thread Juancarlo Añez
`if` and `while` accept `as` to bind an expression to a variable that would be local to the structured statement. Cheers, -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas

Re: [Python-ideas] Inline assignments using "given" clauses

2018-05-05 Thread Juancarlo Añez
>> Python-ideas mailing list >> Python-ideas@python.org >> https://mail.python.org/mailman/listinfo/python-ideas >> Code of Conduct: http://python.org/psf/codeofconduct/ >> > > ___ > Python-ideas mailin

Re: [Python-ideas] Repurpose `assert' into a general-purpose check

2018-01-16 Thread Juancarlo Añez
___ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

[Python-ideas] Data Classes in Kotlin

2017-12-04 Thread Juancarlo Añez
I thought this might be interesting input for the discussions about "data classes" in Python: https://kotlinlang.org/docs/reference/data-classes.html I think that the use of "data class" as syntax is kind of cool, but what really matters is the semantics they chose for Ko

[Python-ideas] About the efficiency of range()

2017-11-05 Thread Juancarlo Añez
I found this interesting: https://stackoverflow.com/a/46996392 -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Defining an easily installable "Recommended baseline package set"

2017-10-30 Thread Juancarlo Añez
On Mon, Oct 30, 2017 at 12:29 PM, Guido van Rossum wrote: > What's your proposed process to arrive at the list of recommended > packages? And is it really just going to be a list of names, or is there > going to be some documentation (about the vetting, not about the contents >

Re: [Python-ideas] PEP draft: context variables

2017-10-16 Thread Juancarlo Añez
d on this PEP... Please don't break it? (or make it illegal) -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] namedtuple literals [Was: RE a new namedtuple]

2017-07-25 Thread Juancarlo Añez
________ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] namedtuple literals [Was: RE a new namedtuple]

2017-07-21 Thread Juancarlo Añez
ome ingenious mangling for the (quasi-anonymous) type name. Equivalence of types by structure is useful, and is very different from the mess that using dicts as records can produce. Cheers, -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@pytho

Re: [Python-ideas] Arguments to exceptions

2017-07-03 Thread Juancarlo Añez
thod of the exception class. -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Define __fspath__() for NamedTemporaryFile and TemporaryDirectory

2017-06-08 Thread Juancarlo Añez
licitely. > +1 -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Security: remove "." from sys.path?

2017-06-04 Thread Juancarlo Añez
r ways to make the source of the import unambiguous) is common in programming languages. Cheers, -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Security: remove "." from sys.path?

2017-06-03 Thread Juancarlo Añez
g to have two very similar > but subtly different relative import mechanisms. > > -- > Greg > > ___ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-i

Re: [Python-ideas] Defer Statement

2017-06-03 Thread Juancarlo Añez
hose defers at the start of the function I just changed). >From import this: Explicit is better than implicit. ​ -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Con

Re: [Python-ideas] tweaking the file system path protocol

2017-05-28 Thread Juancarlo Añez
or pathlib.Path objects and might or might > not work for some other types. Importantly, this has nothing to do with > this proposal, but is in the nature of the protocol as it is defined *now*. +1 -- Juancarlo *Añez* ___ Python-ideas mail

Re: [Python-ideas] Suggestion: push() method for lists

2017-05-21 Thread Juancarlo Añez
, and pop(index) removes > (and returns) the object at the index. The name asymmetry between .pop() and .append() has always bothered me. Cheers! -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailm

Re: [Python-ideas] JavaScript-Style Object Creation in Python (using a constructor function instead of a class to create objects)

2017-05-17 Thread Juancarlo Añez
def grand_total(self): > return self.bar + self.baz > Really?! I didn't know that idiom existed. It is enough for many use cases, and I was just about to require typing and pathlib on my 2.7-compatible projects. -- Juancarlo *Añez* _

Re: [Python-ideas] singledispatch for instance methods

2017-05-14 Thread Juancarlo Añez
(*args, **kw) wrapper.register = dispatcher.register update_wrapper(wrapper, method) return wrapper ​ -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http:

Re: [Python-ideas] Add an option for delimiters in bytes.hex()

2017-05-02 Thread Juancarlo Añez
On Tue, May 2, 2017 at 8:43 PM, Steven D'Aprano <st...@pearwood.info> wrote: > String methods should return strings. > >>> "A-B-C".split("-") ['A', 'B', 'C'] If chunk() worked for all iterables: >>> " ".join("123

Re: [Python-ideas] Augmented assignment syntax for objects.

2017-05-01 Thread Juancarlo Añez
is typical: https://goo.gl/l54tx7 I don't know which would be the best syntax, but it would be convenient to be able to declare something like: class A: var a = 'a' And have "a" be an instance attribute. -- Juancarlo *Añez* ___ Pytho

Re: [Python-ideas] Augmented assignment syntax for objects.

2017-04-26 Thread Juancarlo Añez
ctor. There are common and frequent use cases of "objects are mostly data" that are partially solved in Python (mostly through namedtuple?). Cheers! -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org https://mail.py

Re: [Python-ideas] Augmented assignment syntax for objects.

2017-04-26 Thread Juancarlo Añez
e found in which classes define several attributes that are initialized in the constructor I think that a library like https://github.com/python-attrs/attrs does what's needed. The downside is that code-writing tools (like IDEs) don't understand what's going on under the hood. -- Juancarlo *Añez* __

Re: [Python-ideas] Augmented assignment syntax for objects.

2017-04-25 Thread Juancarlo Añez
ow what's going on. -- Juancarlo *Añez* ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/