class MyList(list):
def find(self, func, default=None):
for i in self:
if func(i):
return i
return default
my_list = MyList(users)
user_2 = my_list.find(lambda user: user['id'] == 2)
print(user_2) # {'id': 2, 'name
Well, I suppose it wants simlink=False.
Anyway, why not change the signature of move to
def move(src, dst, **kwargs):
and change the call of copytree to
copytree(src, real_dst, **kwargs)
?
___
Python-ideas mailing list -- [email protected]
To
res
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/python
i = 0
for size in sizes:
elem.append(it_true[i:i+size])
i += size
res.append(elem)
return res
_______
Python-ideas
There's already:
for i in range(j):
if i > 5:
...
else:
...
else:
...
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
See my implementation, is generic and not only for strings. It could be added
to more-itertools, I suppose:
https://mail.python.org/archives/list/[email protected]/message/E452LQGA3XKU5ADPTG54XP36ENXDZN2B/
___
Python-ideas mailing list -- python
nations(range(1, len_it), n-1)
)
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/KYM
put objects. Maybe I
want to support also dict. In this way writing such function is much more hard.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mai
h) as f:
self._data_raw = json.load(f)
Apart the `dict` check, this logic could be applied to a `json.deserialize()`
function. Python let you function overloading more simple, so why not use it?
___
Python-ideas mailing list -- python-
Andrew Barnert wrote:
> On Dec 25, 2019, at 14:57, python-ideas--- via Python-ideas
> [email protected] wrote:
> > If I can spend my two cents, I think the fact the
> > most of you prefer | is because is already how sets works. And IMHO it's a
> > bit i
st don't get this way.
- various degrees of: "solve the issue of contention over new languages
features once and for all by introducing macros/preprocessors to the language":
Against this I have just my personal plea "please don't turn python into
lisp/c++".
_
t in
PEP622 originally and if it were released this way would have been impossible
to change later.
___________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/
t sight
suggests that many will do so.
If we were going to do this - and I am still on the fence - I think we
should avoid anything that reads like it could be confused as an operator.
_______
Python-ideas mailing list -- [email protected]
To
3Y6Z6RCAXW72Y4WPWZ6HN3MYVFJ/>
Code of Conduct: http://python.org/psf/codeofconduct/
<http://python.org/psf/codeofconduct/>
___
Python-ideas mailing list [email protected]
To unsubscribe send an email [email protected]
http
?
=
pxeger wrote:
=
This is not the appropriate place to propose language changes.
Try the
[python-ideas](https://mail.python.org/mailman3
inally` clauses (or just `except` and `else` - do we need `finally` here).
--
Anthony Flury
*Moble*: +44 07743 282707
*Home*: +44 (0)1206 391294
*email*: [email protected] <mailto:[email protected]>
<>_______
Python-ideas ma
lt;mailto:[email protected]>
<>___________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
htt
It would be awesome to be able to create a list with just:
li = [1—100]
or
li = [1 .. 100]
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists
tem: If the required directory is the systemd directory or user direcotry.
This may also be implemented as an external library, but I am not sure I would
like add add a dependency to my projects "just for this".
I can implement this if people are interested with this feature.
_____
, but provides more dirs on it.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/p
ll no longer be able
to dictionary-unpack it which will prove very frustrating.
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.pytho
erefore well-defined APIs), which is why it
has wider applicability in JS.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
M
ponding to your message.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/python-i
0
EMAIL;PREF=1:[email protected]
FN:Anthony Flury
NICKNAME:Tony
N:Flury;Anthony;;;
TEL;TYPE=home;VALUE=TEXT:01206 391294
TEL;TYPE=cell;VALUE=TEXT:07743282707
UID:c00fc9c3-a56a-4584-8886-6466cf32b9c8
END:VCARD
_______
Python-ideas mailing list -- p
`, or `B <=
C (if B is a subclass or itself of C)`
Because, since == means equality check. With the same logic, a class wraps
another class is actually greater than this class from its type.
_______
Python-ideas mailing list -- [email protected]
To
und, avoiding `KeyError`.
Thoughts?
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.py
s way to
do things)?
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives
t; (and perhaps other
symbols) could be planned for Python 4.
Clean, simple and forward-looking. That, to me, is a good solution. Today we
have "=" and ":=" which, from my opinionated perspective, does not represent
progress at all.
[0] http://www.eecg.toronto.ed
a string:
`f"{x}{y}{z}{a}"`
or for the more functional programmers out there folding a map
`"".join(map(str, (x, y, z, a))`
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail
work with threads,
though there does seem to be a library janus which provides a thread-capbable
queue object which could be another solution.
-Original Message-
From: Guido van Rossum
To: Brian Allen Vanderburg II
Cc: Python-Ideas
Sent: Thu, Feb 13, 2020 1:18 am
Subject: Re: [Python-
an option seem to be more flexible as it give the user of the script
the ability to say "don't add this current directory to the python path" for
existing scripts and modules without having to edit them, create a custom
launcher script, or change directories, etc.____
python.org/issue13475
One idea may be, when executing "python -m", check to see if the module is
loaded from CWD, if so then have CWD added, but if the module is not loaded
from CWD then not have it added.
-Original Message-
From: Nick Timkovich
To: Brianvanderburg2
Cc: python-ideas@p
Maybe this has been considered at some point in the past? The "is [not] a|an"
proposal would at least be a strong contender for "hardest thing to search for
on the internet" lol.
Thanks!
Gavin
_______
Python-ideas mailing list
this something that other see the possibility of being
added
to python? (Also, I know name mangling isn't super common but I think it
may as well be added alongside a private variable implementation))
_______
Python-ideas mailing list -- python
e dict
attribute.
Zach
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/lis
de (that the user of the library will not see when using the library) is
>perfectly fine.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/li
- but in terms of the functions api e.g.
dividing by zero being a natural part of division that has to be handled
somehow.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailma
__
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/L5WR6CEP4T4IRMT43
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/UBV7D3ZTVDDLCIMYJOEAN7
ad())
Basically, it includes the file and keep the scope of all variables that came
before this type of include statement. Very useful for this like a shared
authentication file across an entire website of multiple files/pages.
Happy Thanksgiving!
_______
kind and have some netiquette. 🙏
Thank you,
--
Bernard `Guyzmo` Pratz
___________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
x: isinstance(x), range(0,3)` to be fed to `filter`,
and not
`range(0,3)` to be fed to `lambda x: isinstance(x, int)`?
But then it would be just another way to introduce currying as a
language feature with an operator, so we should then just discuss on how
to add currying as a language syntax
16:27PM +0100, zmo via Python-ideas wrote:
> > This idea sounds fun, so as a thought experiment why not imagine one
> > way of integrating it in what I believe would be pythonic enough.
> This idea is sometimes called "the Collection Pipeline" design pattern,
> and
s about it, blog articles written and
RTFW updated, so you'll get the info you'll need fastly.
Cheers,
--
Guyzmo
___________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
nmatch-and-recursive-path-match-with
http://stackoverflow.com/questions/27726545/python-glob-but-against-a-list-of-strings-rather-than-the-filesystem
I would appreciate any thoughts.
Kind regards,
Aaron
_______
Python-ideas mailing list
Pyth
;
>>>>> But we also have something to manipulate dict as immutable
>>>> datastructures:
>>>>>
>>>>>>>> from types import MappingProxyType as idict
>>>>>>>&
ttp://lol.zoy.org/blog/2012/06/17/compose-key-on-os-x
Then I wrote my own ~/.XCompose file with:
: "π" U03C0 #
GREEK SMALL LETTER PI
so it's like the vim digraphs.
Cheers,
--
zmo
_______
Python-ideas mailing
.
(In pure python, the implementation would be something like `def
__add__(self, othr): return itertools.chain(self, othr)`)
Best regards,
--lucas
signature.asc
Description: OpenPGP digital signature
_______
Python-ideas mailing list
Python
-to-change-values-in-a-tuple
for more context.
Currently, tuples have 2 public methods: index and count. replace would be
similarly easy to implement and similarly useful.
Furthermore, it would be a natural counterpart to nametuple's _replace method._____
ot;batteries included" philosophy.
If users find themselves re-implementing the same utility function over again
and over again across different projects, it's a good sign that such a function
should be part of the standard library.
--- Original Message ---
On Thursday, March
method.
>
> On the other hand, it might be an indication that a tuple is the wrong
>
> tool for the job. As noted, a namedtuple DOES allow you to replace one
>
> component, and to do so by name rather than knowing its index, so
>
> possibly that would be a better ch
way.
See namedtuple's ._replace method. namedtuples are also immutable. We simply
want the same functionality for tuple.
--- Original Message ---
On Friday, March 11th, 2022 at 4:41 AM, Paul Moore wrote:
> On Fri, 11 Mar 2022 at 02:20, wfdc via Python-ideas
>
> python-idea
s not mean it shouldn't be built-in.
>>
>> See Python's "batteries included" philosophy.
>
> "Not every 1-line function needs to be a built-in".
>
>> If users find themselves re-implementing the same utility function over
>> again an
> would be in my top five considerations.
>
> But if you want it, subclassing is a thing.
>
> On Fri, Mar 11, 2022, 2:14 PM wfdc via Python-ideas
> wrote:
>
>>> one Stack Overflow question, with a low number of votes
>>
>> Mind explaining why you say 159 i
nal Message ---
On Friday, March 11th, 2022 at 2:36 PM, Chris Angelico wrote:
> On Sat, 12 Mar 2022 at 06:33, wfdc via Python-ideas
>
> [email protected] wrote:
>
> > > But humans can be confused by "replace" having a totally different API in
> &g
of times.
>
> I'd call the purpose rare at best.
>
> I'm not going to list other one-liners that I'd also not want, but are less
> rare. There are various, but none I'd advocate adding rather than writing
> when I need them.___
eal-world code (for example, the standard
>
> library) and pointing out where the proposed new feature would
>
> demonstrably improve the readability or maintainability of parts of
>
> the code.
>
> > We've already had 2 other participants here attesting to frequent use
rather than a
> > dictionary-like one.
>
> You keep saying this sort of thing, but you haven't shown us what your
>
> use-case actually is, and whether it would actually be more
>
> appropriate for a list instead.
>
> Do all your tuples have the same length?
>
&
> why haven't you used a list
1. A list is not immutable.
2. I don't want to modify the original sequence.
--- Original Message ---
On Friday, March 11th, 2022 at 4:07 PM, Marco Sulla
wrote:
> On Fri, 11 Mar 2022 at 21:39, wfdc via Python-ideas
>
> python-
post your candidate?
>
> It was you that said it could be a 1-liner. The burden of proof is on you, if
> you still want to argue the point.
> Rob Cliffe_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to py
olution. There's a reason we have immutable types: To enforce immutability.
Otherwise, why aren't you proposing getting rid of the tuple type entirely?
--- Original Message ---
On Friday, March 11th, 2022 at 4:29 PM, David Mertz, Ph.D.
wrote:
> On Fri, Mar 11, 2022, 4
ave immutable types: To enforce
>> immutability. Otherwise, why aren't you proposing getting rid of the tuple
>> type entirely?
>>
>> --- Original Message ---
>> On Friday, March 11th, 2022 at 4:29 PM, David Mertz, Ph.D.
>> wrote:
>>
>>> O
mutable types: To enforce immutability.
> Otherwise, why aren't you proposing getting rid of the tuple type entirely?
>
> --- Original Message ---
> On Friday, March 11th, 2022 at 4:29 PM, David Mertz, Ph.D.
> wrote:
>
>> On Fri, Mar 11, 2022, 4:16 PM wfdc via Pytho
: To enforce
>>> immutability. Otherwise, why aren't you proposing getting rid of the tuple
>>> type entirely?
>>>
>>> --- Original Message ---
>>> On Friday, March 11th, 2022 at 4:29 PM, David Mertz, Ph.D.
>>> wrote:
>&g
der than you think. (Try it!)
>>>>
>>>> How much harder? Can you post your candidate?
>>>
>>> It was you that said it could be a 1-liner. The burden of proof is on you,
>>> if you still want to argue the point.
>>> Rob Cliffe__
ing at all. It's a perfectly valid question to address to a
post that seems to be contesting the purpose of immutable types in the first
place.
--- Original Message ---
On Friday, March 11th, 2022 at 5:38 PM, Rob Cliffe
wrote:
> This is a common scenario on python-list or pyth
nsulting at all. It's a perfectly valid question to address to a
>> post that seems to be contesting the purpose of immutable types in the first
>> place.
>
> Gosh, I had no idea immutability could be useful! :-)
>
> https://openlibra.com/en/book/functional-programming-in-py
o-change-values-in-a-tuple
> for more context.
>
> Currently, tuples have 2 public methods: index and count. replace would be
> similarly easy to implement and similarly useful.
>
> Furthermore, it would be a natural counterpart to nametuple's _replace method.
2022 at 1:55 AM, Stephen J. Turnbull
wrote:
> Game theorist here.
>
> wfdc via Python-ideas writes:
>
> > Do you see why it's useful to have immutability?
>
> Sure, it's potentially hashable. But I can't recall ever finding that
>
> useful in work
-in-a-tuple
>> for more context.
>>
>> Currently, tuples have 2 public methods: index and count. replace would be
>> similarly easy to implement and similarly useful.
>>
>> Furthermore, it would be a natural counterpart to nametuple's _replace
>> method.__
e%5C%28%5Cw%2B%5C%29&patternType=regexp
--- Original Message ---
On Saturday, March 12th, 2022 at 1:41 AM, Christopher Barker
wrote:
> Wow!
>
> Does anyone else see the irony in the fact that just a couple days ago, Chris
> A lamented that Python-ideas seemed to
> Imm
a good use-case for a dataclass.
>
> > > whether it would actually be more appropriate for a list instead
> >
> > Lists are not immutable, so they fail the criteria.
>
> Why?
>
> Do you see how you are still failing to show any actual code, and thus
>
> any ac
On Monday, March 14th, 2022 at 8:31 AM, Chris Angelico wrote:
> On Sat, 12 Mar 2022 at 08:53, wfdc via Python-ideas
>
> [email protected] wrote:
>
> > So do you propose getting rid of the tuple type entirely or not?
> >
> > Do you see why it's usefu
them.
--- Original Message ---
On Monday, March 14th, 2022 at 8:32 AM, Steven D'Aprano
wrote:
> On Fri, Mar 11, 2022 at 07:12:49PM +, wfdc via Python-ideas wrote:
>
> > > one Stack Overflow question, with a low number of votes
> >
> > Mind explain
r 11, 2022 at 01:38:57AM +, Rob Cliffe via Python-ideas wrote:
>
> > This could cause confusion because str.replace() has a completely
> >
> > different API.
>
> The old "painter.draw()" versus "gun_slinger.draw()" problem.
>
> It does exist, b
at 8:39 AM, Brendan Barnwell
wrote:
> On 2022-03-11 12:03, wfdc via Python-ideas wrote:
>
> > > I've used Python for 23+ years now. I've had occasion where I'd use this
> > > methods maybe in the low-tens of times.
> > >
> > > I'd ca
ker [email protected] wrote:
>
> > Wow!
> >
> > Does anyone else see the irony in the fact that just a couple days ago,
> > Chris A lamented that Python-ideas seemed to
> >
> > Immediately reject any new idea out of hand? And yes, Chris, you have
> >
>
> up the merge request) ping python-dev directly for a decision. If
>
> you're worried about coding style or exactly how the submission process
>
> works, [email protected] will give you help on that with a
>
> minimum of backseat driving.
>
> wfdc via
They are deliberately
>
> designed to be drop-in replacements for tuples.
>
> ChrisA
>
> _______
>
> Python-ideas mailing list -- [email protected]
>
> To unsubscribe send an email to [email protected]
>
> https://mail.python.org/mailman3/lists/
nt is that they are both sequences and structures.
>
> https://docs.python.org/3/library/collections.html#collections.namedtuple
>
> ChrisA
>
> ___
>
> Python-ideas mailing list -- [email protected]
>
> To
's the
> > whole point of namedtuple: to avoid doing that.
>
> The whole point is that they are both sequences and structures.
>
> https://docs.python.org/3/library/collections.html#collections.namedtuple
>
> ChrisA
>
> _______
g idea. Perhaps we can discuss it further.
>
> --- Original Message ---
>
> On Monday, March 14th, 2022 at 8:38 AM, Steven D'Aprano [email protected]
> wrote:
>
> > On Fri, Mar 11, 2022 at 01:38:57AM +, Rob Cliffe via Python-ideas wrote:
> >
> &
dentifiers.
> So again, what are the field names supposed to be if the datastructure is
> being treated as a sequence, of possibly arbitrary length?
--- Original Message ---
On Monday, March 14th, 2022 at 6:19 PM, Greg Ewing
wrote:
> On 15/03/22 6:14 am, wfdc via Python-id
OP sees it as an
>
> answered question.
>
> I've been keeping the tone as positive as possible, but honestly, I
>
> don't think this thread has much hope of being productive at this
>
> point, and if you hadn't called me out specifically, I would not have
>
, March 14th, 2022 at 7:04 PM, Chris Angelico wrote:
> On Tue, 15 Mar 2022 at 10:02, wfdc via Python-ideas
>
> [email protected] wrote:
>
> > See my previous response to Chris:
> >
> > > What are the named fields supposed to be if the datastructure is being
the work, but for those making the proposal.
>
> If we ask for examples, we expect you to do the work of curating some
>
> good examples, not just to dump a regex in our laps and tell us to
>
> search for them ourselves.
>
> The bottom line here is that we don't have to j
> think about 75% of the time "why are they doing this silly approach?" and 25%
> "this is easy enough as is." None of them made me think "I wish I had a
> method/function."___
Python-ideas mailing list -- pyth
FN:Anthony Flury
NICKNAME:Tony
N:Flury;Anthony;;;
TEL;TYPE=home;VALUE=TEXT:01206 391294
TEL;TYPE=cell;VALUE=TEXT:07743282707
UID:c00fc9c3-a56a-4584-8886-6466cf32b9c8
END:VCARD
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email
.
Instead I would propose that array multiplication by negative value throws an
error.
I would like to hear your opinions on this matter.
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
you expect an error but
get an empty list, is hard to debug. That is a tradeoff with a clear winner in
my opinion.
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https
programmers' part and Python's lack of strict typing. However, raising an
error on negative multiplication would immediately make it clear what is wrong,
instead of hiding it.
_______
Python-ideas mailing list -- [email protected]
To unsubscri
Unpickler)
as sh:
squared = lambda x: x ** 2
sh['test_key'] = squared
I could easily solve this problem I had while using the Shelve module. I
believe that shelve module will be a more useful module by adding support for
custom unpickler and pickler.
Kindest regards,
Furkan Onder_
cisions, but it seems if this really is only a
couple of lines, and all the test cases pass this (or something very
similar) should be a considered for 3.12.
Thank you Noah,
-- Original Message --
From: "Noah Kim"
To: [email protected]
Sent: Saturday, 11 Feb, 23 At 00:
here: https://github.com/R9295/cpython
Currently, it only prevents module imports in a very elementary manner but
perhaps it can be of use to spark a discussion for an implementation.
Looking forward to your thoughts,
Aarnav
___
Python-ideas mailing
295:cpython:policy
Regards,
Aarnav
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org
eny the request automatically
which makes sense in a server-side application.
I hope this answers your questions. I am happy to elaborate if not.
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to python-ideas-le...@p
rting them.
___
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/p
__. code is not necessary but just pointers.
Thanks and regards,
Aarnav
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Mess
t audit and run this (or atleast read the code)
since it's required to have a meaningful discussion, the overriding happens
before the module resolution itself so sys.path is irrelevant.
_______
Python-ideas mailing list -- [email protected]
To uns
ou provide me with an example or two? If I
understand it correctly, only FFI would be able to do so, am I right?
Regards,
Aarnav
_______
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https
1 - 100 of 1693 matches
Mail list logo