Re: [Python-ideas] Syntactic sugar to declare partial functions

2018-08-04 Thread Daniel.
That's an awesome library! Congratulation for doing this and thanks for sharing! Em sáb, 4 de ago de 2018 às 13:42, Robert Vanden Eynde escreveu: > The funcoperators lib on pypi does exactly that: > > from funcoperators import partially > > @partially > def add(x: int, y: int) -> int: > retu

[Python-ideas] Re: "return if "

2020-06-18 Thread Daniel.
I love the do_stuff if cond syntax in Ruby and in perl. It's very natural to real, much more to follow than if cond: do_stuff But still I don't think that it is enough to demand a language change. Something near this is to have a default of none for A if B else None So we can ommit the else Non

[Python-ideas] Re: "return if "

2020-06-18 Thread Daniel.
To read* Em qui, 18 de jun de 2020 09:30, Daniel. escreveu: > I love the do_stuff if cond syntax in Ruby and in perl. It's very natural > to real, much more to follow than if cond: do_stuff > > But still I don't think that it is enough to demand a language change. > &g

[Python-ideas] Re: "return if "

2020-06-18 Thread Daniel.
e 2020 13:36, Barry Scott escreveu: > > > On 18 Jun 2020, at 13:30, Daniel. wrote: > > I love the do_stuff if cond syntax in Ruby and in perl. It's very natural > to real, much more to follow than if cond: do_stuff > > > I on the other hand hate that syntax and fin

[Python-ideas] Re: "return if "

2020-06-18 Thread Daniel.
it is not worth changing Python over. I agreed here, is doesn't make that difference Em qui, 18 de jun de 2020 14:25, Christopher Barker escreveu: > On Thu, Jun 18, 2020 at 10:00 AM Daniel. wrote: > >> def foo(): >> if a: >> return >> if B: >>

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

2020-06-27 Thread Daniel.
When I need to traverse nested dicts, is a common pattern to do somedict.get('foo', {}).get('bar', {}) But there is no such equivalent for arrays, wouldn't be nice if we can follow somedict.get('foo', {}).get('bar', []).get(10) ... ? What I do in this case is surround with try/except IndexError

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

2020-06-27 Thread Daniel.
Oh, sorry, I will take a look. Thanks! Em sáb., 27 de jun. de 2020 às 12:06, Guido van Rossum escreveu: > Please read PEP 505 before rehashing this old idea. > > On Sat, Jun 27, 2020 at 06:35 Daniel. wrote: > >> When I need to traverse nested dicts, is a co

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

2020-06-30 Thread Daniel.
veu: > Hello! > > Which would be the use cases for this feature? > > I can't think of one. > > I think that "nice to have" leads to the ways of Perl. > > Regards, > > On Sat, Jun 27, 2020 at 9:34 AM Daniel. wrote: > >> When I need to

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

2020-07-02 Thread Daniel.
Em qua, 1 de jul de 2020 00:56, David Lowry-Duda escreveu: > Very similar things could be said about dict.get too, no? It's easy to > write your own function that does the same thing or to catch an > exception. > > On the other hand, it seems far more likely to miss keys in a dictionary > than it

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

2020-07-02 Thread Daniel.
Em ter., 30 de jun. de 2020 às 15:49, Alex Hall escreveu: > I think I'm missing something. Daniel wants a `list.get` method with > similar semantics to `dict.get`. So instead of writing: > > ``` > try: > x = lst[i] > except IndexError: > x = default > ```

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

2020-07-03 Thread Daniel.
Em sex, 3 de jul de 2020 11:37, Kyle Lahnakoski escreveu: > > On 2020-06-27 09:34, Daniel. wrote: > > When I need to traverse nested dicts, is a common pattern to do > > > > somedict.get('foo', {}).get('bar', {}) > > > > But there is n

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

2020-08-25 Thread Daniel.
I just came across this again while implementing an parser I would like to compare stack elements as if stack[-3] == x and stack[-2] == y and stack[-1] == z and somewere below elif stack[-1] == t I had to spread `len(stack)` in a lot of places. People said about the length of a list is usuall

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

2020-08-25 Thread Daniel.
n you deal with parsing problems yielding sequence of tokens are pretty common and knowing how much tokens are there is a matter of input. When you deal with recursives problems using a stack too.. so there are use cases out there and it's a tiny change Em ter, 25 de ago de 2020 09:

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

2020-08-25 Thread Daniel.
ty of use cases still exist ( > https://mail.python.org/archives/list/[email protected]/message/7W74OCYU5WTYFNTKW7PHONUCD3U2S3OO/) > and I think we shouldn't need to keep talking about them. > > On Tue, Aug 25, 2020 at 2:54 PM Daniel. wrote: > >> I just came across this aga

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

2020-08-27 Thread Daniel.
An .get method wont hurt duck typing, it makes it better. Also most of the time we're working with plain dicts and lists not abtract classes. If you're typechecking for a Sequence you cant treat it as a list, and this is already true because there are methods in list that dont exists Sequence as A

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

2020-08-27 Thread Daniel.
Em qui, 27 de ago de 2020 10:09, M.-A. Lemburg escreveu: > On 27.08.2020 14:40, Daniel. wrote: > > It's simple: > > > > def get(self, i, default=None): > > try: > > return self[i] > > except IndexError: > > return defa

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

2020-08-28 Thread Daniel.
Em qui, 27 de ago de 2020 10:37, M.-A. Lemburg escreveu: > On 27.08.2020 15:17, Alex Hall wrote: > > On Thu, Aug 27, 2020 at 3:09 PM M.-A. Lemburg wrote: > > > >> I disagree on the above assessment. I have had such a get() builtin > >> in mxTools for more than 20 years now and found that I hardl

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

2020-10-27 Thread Daniel.
My little contribution I will always prefer expressions over statements. So, -1 for bringing back a statement for something that we have a function for. Functions are first citizens, statement are not Now if we are talking about parenthesesless expressions, if we're designing a language from scra

[Python-ideas] Re: SimpleNamespace vs object

2021-02-17 Thread Daniel Moisset
If we're bike shedding, I'd go for "mutableobject". It's not terribly short, but it is built on familiar python terminology and does exactly what it says in the box: like object() but mutable On Wed, 17 Feb 2021, 23:01 Chris Angelico, wrote: > On Thu, Feb 18, 2021 at 8:53 AM Brendan Barnwell >

[Python-ideas] Re: Add switch-case statements in Python

2021-05-04 Thread Daniel Moisset
I'm not sure if you're reading the right document, but PEP 634 refers to 636 in its second paragraph On Tue, 4 May 2021, 19:56 Shreyan Avigyan, wrote: > Ok. Now I'm able to understand. PEP 634 should have a reference to PEP 636 > or else it's pretty hard to understand because the syntax section

Re: [Python-ideas] Pre-conditions and post-conditions

2018-08-20 Thread Daniel Moisset
ns that if you want to restart discussion, reviving >> PEP 316 is likely the best approach. >> >> Paul >> ___ >> Python-ideas mailing list >> [email protected] >> https://mail.python.org/mailman/lis

Re: [Python-ideas] Are we supposed to be able to have our own class dictionary in python 3?

2018-11-03 Thread Daniel Moisset
Sorry, should have replied to the list too On Sat, 3 Nov 2018, 23:55 Daniel Moisset If I understood correctly what you want, it's possible with a metaclass. > Check the __prepare__ method at > https://docs.python.org/3/reference/datamodel.html#preparing-the-class-namespace > and P

Re: [Python-ideas] Are we supposed to be able to have our own class dictionary in python 3?

2018-11-04 Thread Daniel Moisset
ing for to end up with a custom attribute dict (so in *your* case, you do not need to do the copying) On Sun, 4 Nov 2018 at 00:03, Amit Green wrote: > Thanks Daniel, > > I found my answer here (using your link): > https://docs.python.org/3/reference/datamodel.html#preparing-the-class-na

Re: [Python-ideas] cli tool to print value, similar to pydoc

2019-04-08 Thread Daniel Bradburn
Could it be q that you are thinking about? Op ma 8 apr. 2019 om 09:10 schreef Paul Moore : > On Sun, 7 Apr 2019 at 12:44, Thomas Gläßle wrote: > > There is already a tool like this on PyPI [1] (sadly py2 only atm), but > > if you agree that this is a common pattern,

[Python-ideas] zipfile refactor and AES

2019-06-03 Thread Daniel Hillier
Hi, I've written a package that can read and write zip files encrypted with Winzip's AES encryption scheme (https://github.com/danifus/pyzipper/). It is based on Python's zipfile module which I refactored to facilitate adding the AES code as subclasses of the classes defined in the zipfile module.

Re: [Python-ideas] zipfile refactor and AES

2019-06-03 Thread Daniel Hillier
Robert Collins wrote: > Is it API compatible with the current zipfile module docs? Yes it should be (that was my intention during the refactor and if I accidentally introduced an incompatibility, I'll fix that up before I attempt to integrate the work). I had a look through the docs again and I ca

[Python-ideas] Add a `get_profile_dict` function to cProfile

2019-08-16 Thread olshansky . daniel
Hey everyone, I've been using cProfile to profile some of my code, but found out that while the tools to print the results are very convenient, it was difficult to extract and send to a logging tool (i.e. fluentd) where it can be further parsed and analyzed. I'm thinking of adding a function to

[Python-ideas] Tuple Comprehension

2019-11-17 Thread Daniel Zeng
Syntax for tuple comprehension, something like: (i, for i in range(10)) This shouldn't result in ambiguity, since generators need to be in parentheses anyway: (i, for i in range(10)) vs (1, (i for i in range(10))) ___ Python-ideas mailing list -- python-

[Python-ideas] Re: Tuple Comprehension

2019-11-17 Thread Daniel Zeng
> > Is this meant to produce a tuple that contains inner tuples, or is it > the same as tuple(i for i in range(10)) ? This would be equivalent to tuple(i for i in range(10)) > Is the comma just magic that says "tuple comprehension, not genexp"? I think that my proposal is consistent with Python's

[Python-ideas] Re: Tuple Comprehension

2019-11-18 Thread Daniel Zeng
To me, however, that would look like a one-element genexp tuple, and would be too easily confused with something like ((i for i in range(10),) ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-ideas-le...@pyt

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

2019-12-11 Thread Daniel Moisset
I think a solution nobody has proposed in this thread is relaxing the next builtin, so it calls iter() on the argument when it doesn't implement the iterator protocol. That would make next([1, 2]) == 1, and also make next([], "missing") == "missing". After that all that is needed is educating the u

[Python-ideas] Re: pickle.reduce and deconstruct

2020-02-07 Thread Daniel Spitz
ng interesting using esoteric, inappropriate corners of python.) If Andrew's proposal happened, pickle would be uncoupled from that core machinery, and my idea, as well as other interesting ideas, could be implemented in a non-silly way. Daniel Spitz On Thu, Jan 23, 2020 at 7:11 PM Andrew Barnert

[Python-ideas] Re: pickle.reduce and deconstruct

2020-02-08 Thread Daniel Spitz
re not available. If you're interested in coordinating on it, let me know and perhaps we can find a time to get started. You're also welcome to jump right in without me if you have the time and motivation. Daniel Spitz ___ Python

[Python-ideas] a new itertools.product variant that supports kwargs and returns dicts

2020-02-18 Thread Daniel Grießhaber
When doing a grid-search over some hyper-parameters of an algorithm I often need to specify the possible value space for each parameter and then evaluate on every combination of these values. In this case, the product function of the itertools module is handy: from itertools import product def t

[Python-ideas] A new itertools.product variant that supports kwargs and returns dicts

2020-02-18 Thread Daniel Grießhaber
When doing a grid-search over some hyper-parameters of an algorithm I often need to specify the possible value space for each parameter and then evaluate on every combination of these values. In this case, the product function of the itertools module is handy: from itertools import product

[Python-ideas] Re: zip(x, y, z, strict=True)

2020-04-26 Thread Daniel Moisset
This idea is something I could have used many times. I agree with many people here that the strict=True API is at least "unusual" in Python. I was thinking of 2 different API approaches that could be used for this and I think no one has mentioned: - we could add a callable filler_factory keywo

[Python-ideas] Re: Dict unpacking assignment

2020-10-24 Thread Daniel Moisset
If you find PEP-634 a bit dry, you might give a try to PEP-636 (written in an explanatory style rather than a hard-spec style). You can always go back to PEP-634 for the precise details. On Fri, 23 Oct 2020 at 13:48, Ricky Teachey wrote: > Fwiw, although I see how PEP 634 has the potential to be

[Python-ideas] Re: Make for/while loops nameable.

2020-12-07 Thread Daniel Moisset
For the likely rare situation where I'd want to do this rather than refactoring into a function, I might try with something like this without requiring changes to the language: from contextlib import contextmanager @contextmanager def breakable(): class Break(Exception): pass def breaker(

[Python-ideas] Re: Add the brotli & zstandard compression algorithms as modules

2020-12-14 Thread Daniel Holth
I think packaging ought to be able to use binary dependencies. Some disagree. The binary ZStandard decompressor could be offered in a gzip-compressed wheel. The reason an improved packaging format can only use ZStandard and not LZMA is that we need to improve everyone's experience, not just min

Re: [Python-ideas] Fwd: Null coalescing operator

2016-09-11 Thread Daniel Moisset
gt; (3).real# 3 > {}.values # > None.__class__ # > > --- Bruce > Check out my puzzle book and get it free here: > http://J.mp/ingToConclusionsFree (available on iOS) > > > > ___ > Python-ideas mailing list &

Re: [Python-ideas] if-statement in for-loop

2016-10-04 Thread Daniel Moisset
cial cased to > disallow the "else" clause? > > Comprehensions don't have that concern, as they don't support "else" > clauses at all. > > Cheers, > Nick. > > -- > Nick Coghlan | [email protected] | Brisbane, Australia > ___

Re: [Python-ideas] Fwd: Fwd: Fwd: unpacking generalisations for list comprehension

2016-10-18 Thread Daniel Moisset
tten is not enough in all cases", and I can find a counterexample (even for 1 level flatten which is what I used here) PS: or alternatively, flatten = lambda it: list(itertools.chain(it)) # :) PPS: or if you prefer to work with iterators, flatten = itertools.chain -- Daniel F. Moisset -

Re: [Python-ideas] Proposal: Tuple of str with w'list of words'

2016-11-15 Thread Daniel Moisset
> mydf = df[ ('field1', 'field2', 'field3') ] > If using a tuple as an index expression, wouldn't it be ok for you to use: mydf = df['field1', 'field2', 'field3'] ? That should be equivalent to the second example, but withou

Re: [Python-ideas] Ideas for improving the struct module

2017-01-18 Thread Daniel Spitz
+1 on the idea of supporting variable-length strings with the length encoded in the preceding packed element! Several months ago I was trying to write a parser and writer of PostgreSQL's COPY ... WITH BINARY format. I started out trying to implement it in pure python using the struct module. Due t

Re: [Python-ideas] New function to add into the "random" module

2017-02-02 Thread Daniel Moisset
, maxfloatpt): > > flnum = randint(0 , 9) > > str(flnum) > > num = '%s%s' % (num , flnum) > > return float(num) > > > > P.S.: If the indent has anything wrong, just correct me, thx! > > > > P.P.S.: The function is te

Re: [Python-ideas] if in for-loop statement

2017-02-23 Thread Daniel Moisset
org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > -- Daniel F. Moisset - UK Country Manager www.machinalis.com Skype: @dmoisset ___ Python-ideas mailing list Python-idea

Re: [Python-ideas] Way to repeat other than "for _ in range(x)"

2017-03-30 Thread Daniel Moisset
>> Thoughts? >> >> ___ >> Python-ideas mailing list >> [email protected] >> https://mail.python.org/mailman/listinfo/python-ideas >> Code of Conduct: http://python.org/psf/codeofconduct/ >> >> > >

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

2017-04-25 Thread Daniel Moisset
ind time > later. If nothing else, such a decorator would be a good prototype for > the proposed functionality, and may well be sufficient for the likely > use cases without needing a syntax change. > > Paul > ___ > Python-ideas mailing list > [email protected] > https://mail.p

[Python-ideas] Defer Statement

2017-06-03 Thread Daniel Bershatsky
Dear Python Developers, We have a potential idea for enhancing Python. You will find a kind of draft bellow. Best regards,Daniel Bershatsky  Abstract This PEP proposes the introduction of new syntax to create community standard,readable and clear way to defered function execution in basic

Re: [Python-ideas] Dollar operator suggestion

2017-10-26 Thread Daniel Moisset
, > Yan > > ___ > Python-ideas mailing list > [email protected] > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > > -- Daniel F. Moisset - UK Country Manage

Re: [Python-ideas] How assignment should work with generators?

2017-11-27 Thread Daniel Moisset
s one (trailing comma) would be ambiguous/backward incompatible for the 1 variable case: x, = iter which is a relatively common idiom and is expected to raise an error if the iterator has trailing elements. -- Daniel F. Moisset - UK Country Manager - Machinalis Limited www.machinalis.co.uk <h

Re: [Python-ideas] Add a dict with the attribute access capability

2017-11-29 Thread Daniel Moisset
t; [1] https://bugs.python.org/issue29196 > > ___ > Python-ideas mailing list > [email protected] > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > -- Daniel F

[Python-ideas] .then execution of actions following a future's completion

2018-01-25 Thread Daniel Collins
Hello all, So, first time posting here. I’ve been bothered for a while about the lack of the ability to chain futures in python, such that the next future will execute upon the first’s completion. So I submitted a pr to do this. This would add the .then(self, fn) method to concurrent.futures.

Re: [Python-ideas] .then execution of actions following a future's completion

2018-01-26 Thread Daniel Collins
ase *or* the semantics very > well. You have some explaining to do... > > (Also, full links: https://bugs.python.org/issue32672; > https://github.com/python/cpython/pull/5335) > >> On Thu, Jan 25, 2018 at 8:38 PM, Daniel Collins >> wrote: >> Hello all, >>

Re: [Python-ideas] .then execution of actions following a future's completion

2018-01-26 Thread Daniel Collins
Also to be honest I don't understand the use case *or* the semantics very >> well. You have some explaining to do... >> >> (Also, full links: https://bugs.python.org/issue32672; >> https://github.com/python/cpython/pull/5335) >> >>> On Thu, Jan 25, 2018 at 8:3

Re: [Python-ideas] .then execution of actions following a future's completion

2018-01-26 Thread Daniel Collins
:59 AM, Guido van Rossum wrote: > > @Bar: I don't know about exposing _chain_future(). Certainly it's overkill > for what the OP wants -- their PR only cares about chaining > concurrent.future.Future. > > @Daniel: I present the following simpler solution -- it req

Re: [Python-ideas] .then execution of actions following a future's completion

2018-01-26 Thread Daniel Collins
to submit a callback function back to the executor. Sent from my iPhone > On Jan 26, 2018, at 12:10 PM, Daniel Collins wrote: > > @Guido: I agree, that’s a much cleaner solution to pass the executor. > However, I think the last line should be future.add_done_callback(callback) &

Re: [Python-ideas] .then execution of actions following a future's completion

2018-01-26 Thread Daniel Collins
) and it would be confusing if a few lines later, a “but you can use them for this” example was provided. -dancollins34 Sent from my iPhone > On Jan 26, 2018, at 1:05 PM, Guido van Rossum wrote: > >> On Fri, Jan 26, 2018 at 9:20 AM, Daniel Collins >> wrote: >>

Re: [Python-ideas] Accepting multiple mappings as positional arguments to create dicts

2018-04-09 Thread Daniel Moisset
our thoughts? > > ___ > Python-ideas mailing list > [email protected] > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > > -- Daniel F. Moisset - UK Country Man

Re: [Python-ideas] Accepting multiple mappings as positional arguments to create dicts

2018-04-09 Thread Daniel Moisset
I didn't know that kwargs unpacking in dictionaries displays don't > raise a TypeError exception. > > On Mon, Apr 9, 2018 at 8:23 AM, Daniel Moisset > wrote: > >> In which way would this be different to {**mapping1, **mapping2, >> **mapping3} ? >> >> O

Re: [Python-ideas] Move optional data out of pyc files

2018-04-10 Thread Daniel Moisset
settings different docstring file can be used. > > For suppressing line numbers and annotations new options can be added. > > ___ > Python-ideas mailing list > [email protected] > https://mail.python.org/mailman/listinfo/python-idea

Re: [Python-ideas] Move optional data out of pyc files

2018-04-12 Thread Daniel Moisset
quot;int","return":"int"}. > > This change will require new pyc format, and descriptor for > PyFunction.__doc__, PyFunction.__annotation__ > and type.__doc__. > > Regards, > > -- > INADA Naoki > ___ > Pyth

Re: [Python-ideas] Move optional data out of pyc files

2018-04-12 Thread Daniel Moisset
n the singleton that cpython normally uses for "1", although most duplicates are some small strings, tuples with argument names, or . Something that could be interesting to write is a "pyc optimizer" that removes duplicates, this should be a gain at a minimal preprocessing cost. On

Re: [Python-ideas] Pattern Matching Syntax

2018-05-04 Thread Daniel Moisset
-all-motivating but hopefully illustrative example: > > > > return match x: > > (0, _) => None > > (n, x) if n < 32 => ', '.join([x] * n) > > x:str if len(x) <= 5 => x > > x:str => x[:2] + '...' > > n:Integral <

Re: [Python-ideas] Pattern Matching Syntax

2018-05-04 Thread Daniel Moisset
of data structures, instance checking). It works very well when you use algebraic data types (which are like unions of namedtuples)as your primary data structure, because there are very natural patterns to decompose those. In Python, there's less value to this because well... it already h

[Python-ideas] Syntax idea: escaping names to avoid keyword ambiguity

2018-05-14 Thread Daniel Moisset
uot; argument to every classmethod ever) - If we're worried about over proliferation of "$" in code, I'm quite sure given past experience that just a notice in PEP 8 of "only with $ in names to prevent ambiguity" should be more than enough for the community

Re: [Python-ideas] Syntax idea: escaping names to avoid keyword ambiguity

2018-05-14 Thread Daniel Moisset
On 14 May 2018 at 15:02, Clint Hepner wrote: > > > On 2018 May 14 , at 6:47 a, Daniel Moisset > wrote: > > > > Following up some of the discussions about the problems of adding > keywords and Guido's proposal of making tokenization context-dependent, I > wante

Re: [Python-ideas] Syntax idea: escaping names to avoid keyword ambiguity

2018-05-14 Thread Daniel Moisset
On 14 May 2018 at 15:02, Clint Hepner wrote: > > > On 2018 May 14 , at 6:47 a, Daniel Moisset > wrote: > > > > Following up some of the discussions about the problems of adding > keywords and Guido's proposal of making tokenization context-dependent, I > wante

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

2018-05-21 Thread Daniel Moisset
ax won't give me. > > That use case should be covered by for v in iter(get_something, INCOVENIENT_SENTINEL): do_something(v) -- <https://www.machinalis.co.uk> Daniel Moisset UK COUNTRY MANAGER A: 1 Fore Street, EC2Y 9DT London <https://goo.gl/maps/pH9BBLgE8dG2>

Re: [Python-ideas] Add the imath module

2018-07-12 Thread Daniel Moisset
ore ideas? > > ___ > Python-ideas mailing list > [email protected] > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > -- <https://www.machinalis.com/> Daniel Moi

[Python-ideas] @lazy decorator an alternative to functools.partial ?

2023-05-12 Thread Daniel Guffey
Hello all! I've been playing with string templating quite a bit lately and wrote some logic to help me with this. I found it a bit more flexible than using partial and wanted to get feedback to see if it would be worth formalizing this code into the functools module. It's pretty short so I don'

[Python-ideas] Re: @lazy decorator an alternative to functools.partial ?

2023-05-17 Thread Daniel Guffey
Thanks for the reference, Lucas. I wasn't familiar with toolz and it looks similar to a package I'm contributing to with a similar purpose of filling holes in the standard library, as such shouldn't some of this stuff be targeted for integration? I'm a bit dubious about the pypi suggestion as pac

[Python-ideas] Re: @lazy decorator an alternative to functools.partial ?

2023-05-17 Thread Daniel Guffey
e: > On Wed, May 17, 2023 at 2:22 PM Daniel Guffey > wrote: > >> I'm a bit dubious about the pypi suggestion as packages are being >> regularly poisoned with malware ( e.g. New KEKW malware infects >> open-source Python Wheel files via a PyPI distribution | SC Media

[Python-ideas] else without except

2023-06-30 Thread Daniel Walker
As most of you probably know, you can use else with try blocks: try: do_stuff() except SomeExceptionClass: handle_error() else: no_error_occurred() Here, no_error_occurred will only be called if do_stuff() didn't raise an exception. However, the following is invalid syntax: try: do

[Python-ideas] Have del return a value

2023-09-07 Thread Daniel Walker
Perhaps this is a solution in search of a problem but I recently encountered this situation in one of my projects. I have an object, foo, which, due to the references it contains, I'd rather not keep around longer than necessary. I use foo to instantiate another object: bar = Bar(foo) bar i

[Python-ideas] Re: Have del return a value

2023-09-07 Thread Daniel Walker
Maybe a new keyword like `delvalue`? On Thu, Sep 7, 2023 at 10:02 AM Chris Angelico wrote: > On Thu, 7 Sept 2023 at 23:51, Daniel Walker wrote: > > > > Perhaps this is a solution in search of a problem but I recently > encountered this situation in one of my projects. > &

[Python-ideas] Re: Have del return a value

2023-09-07 Thread Daniel Walker
Ah! I like that! On Thu, Sep 7, 2023 at 5:24 PM Tiago Illipronti Girardi < [email protected]> wrote: > You would be deleting the name, not the value. `unbind` would be a better > keyword. > ___ > Python-ideas mailing list -- [email protected]

[Python-ideas] Re: Have del return a value

2023-09-12 Thread Daniel Walker
Makes sense. On Tue, Sep 12, 2023 at 2:55 AM Rob Cliffe via Python-ideas < [email protected]> wrote: > > > On 08/09/2023 22:19, Christopher Barker wrote: > > On Fri, Sep 8, 2023 at 11:00 AM Barry Scott > wrote: > >> I see no need for del to return anything, you already have the reference >

[Python-ideas] PEP: add a `no` keyword as an alias for `not`

2019-08-02 Thread Daniel Okey-Okoro
st example. This PEP would make the difference between the two usecases explicit. Thoughts? Best Intentions, Daniel Okey-Okoro. ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to python-ideas-le...@python

[Python-ideas] Fwd: PEP: add a `no` keyword as an alias for `not`

2019-08-02 Thread Daniel Okey-Okoro
-- Forwarded message - From: Daniel Okey-Okoro Date: Thu, Aug 1, 2019 at 1:24 PM Subject: Re: PEP: add a `no` keyword as an alias for `not` To: Calvin Spealman Good point Calvin, But in many cases, when people write

[Python-ideas] Fwd: Re: PEP: add a `no` keyword as an alias for `not`

2019-08-02 Thread Daniel Okey-Okoro
-- Forwarded message - From: Daniel Okey-Okoro Date: Thu, Aug 1, 2019 at 1:37 PM Subject: Re: [Python-ideas] Re: PEP: add a `no` keyword as an alias for `not` To: Chris Angelico > not a strong enough justification for breaking any code that uses "no" in any other

[Python-ideas] Check type hints in stack trace printing

2018-06-14 Thread Daniel Sánchez Fábregas
My idea consist in: Adding a method to perform type checking in traceback objects When printing stack traces search for mistyped arguments and warn about them to the user. Don't know if it is in the roadmap, but seems that have a good cost/benefit ratio to me. _

[Python-ideas] Check type hints in stack trace printing

2018-06-20 Thread Daniel Sánchez Fábregas
El 14/06/18 a las 14:37, Steven D'Aprano escribió: > On Thu, Jun 14, 2018 at 01:03:37PM +0200, Daniel Sánchez Fábregas wrote: >> My idea consist in: >> Adding a method to perform type checking in traceback objects >> When printing stack traces search for mistyped argume