[Python-ideas] Add extend_const action to argparse

2020-04-22 Thread python
d655ef0ab2 _______ 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/py

[Python-ideas] Re: Add _KB, _MB, _GB to numeric literals

2020-10-14 Thread python
Sorry for the late response on this. I tried to respond earlier but was stymied by issues with the mailing list server. The last time this was discussed I was the one to raise the suggestion. You can find the start of the thread: 25 Aug 2016: SI scale factors in Python https

[Python-ideas] Re: Native support for units [was: custom literals]

2022-04-04 Thread python
, there are two reasons to consider adding both SI scale factors and unit in Python itself. First, SI scale factors have been an international standard way of specifying real value for over 50 years, and use of SI scale factors results in numbers that are more compact and easier to read than using

[Python-ideas] Restricting access to sensitive APIs with a permission model like Deno

2023-02-26 Thread python--- via Python-ideas
shell. A command line argument parser library should not use network, ffi nor filesystem. Deno, a runtime for Typescript contains an interesting implementation of a permissions model for APIs. I strongly think Python could benefit from such functionality and hacked together a quick experiment

[Python-ideas] Re: Restricting access to sensitive APIs with a permission model like Deno

2023-02-26 Thread python--- via Python-ideas
Could you elaborate on how Python code can easily bypass that sort of restriction? >From my understanding, you can only do so with importlib by reading the raw >source and evaluating it. In that case, I can just restrict importlib? Same >with the open function which is from the

[Python-ideas] Re: Restricting access to sensitive APIs with a permission model like Deno

2023-02-26 Thread python--- via Python-ideas
With Python being a language heavily utilized in server and end-user applications, I would take a different approach for both. I have to admit I haven't thought much about the "normal user" in this case and focused primarily on developers. Perhaps developers shipping an appli

[Python-ideas] Re: Restricting access to sensitive APIs with a permission model like Deno

2023-02-26 Thread python--- via Python-ideas
rting them. ___ 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/p

[Python-ideas] Re: Restricting access to sensitive APIs with a permission model like Deno

2023-02-26 Thread python--- via Python-ideas
__. code is not necessary but just pointers. Thanks and regards, Aarnav ___ 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/ Mess

[Python-ideas] Re: Restricting access to sensitive APIs with a permission model like Deno

2023-02-27 Thread python--- via Python-ideas
Have you looked at the diff? It's not "1000+" commits as you claim. It's 17 commits with most being README changes. The base is not the master branch but the 3.11.0 release. https://github.com/python/cpython/compare/3.11...R9295:cpython:policy I do not see why you canno

[Python-ideas] Re: Restricting access to sensitive APIs with a permission model like Deno

2023-02-27 Thread python--- via Python-ideas
Thank you for your insight. >I hope you are at least aware that over the years various multi-year attempts >to create Python sandboxes ultimately failed to the point of being altogether >abandoned. Yes I am, I have looked at pysandbox and RestrictedPython and I believe my approac

[Python-ideas] Re: Restricting access to sensitive APIs with a permission model like Deno

2023-02-27 Thread python--- via Python-ideas
I really appreciate the pointers, thank you. I will look into them. ___ 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: Restricting access to sensitive APIs with a permission model like Deno

2023-02-27 Thread python--- via Python-ideas
Makes sense, will do so. ___ 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

[Python-ideas] asymcio.TimerHandle.done()

2018-10-23 Thread reg . python
I'm rewriting an existing python program using a 3rd party async library to standard asyncio. That library allows one to check if a timer created with: timer = loop.call_later(delay, callback) is active, i.e. not cancelled and the scheduled callback not executed yet. I'm mi

[Python-ideas] Adding a .find() method to list

2022-05-07 Thread python-ideas
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

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2022-12-25 Thread shironeko . python
ntax. I do think that being able to reference other arguments is very useful in it's own right and would go a long way in helping to solve the None check problem brought up in PEP 505 even more cleanly. _______ Python-ideas mailing list -- pyth

[Python-ideas] Re: Add symlinks option at shutil.move parameters

2019-12-24 Thread python-ideas--- via Python-ideas
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 -- python-ideas@python.org To

[Python-ideas] Re: Segmentation of string

2019-12-24 Thread python-ideas--- via Python-ideas
res ___ 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

[Python-ideas] Re: Segmentation of string

2019-12-24 Thread python-ideas--- via Python-ideas
i = 0 for size in sizes: elem.append(it_true[i:i+size]) i += size res.append(elem) return res _______ Python-ideas

[Python-ideas] Re: Add "elif" to "for_stmt" and "while_stmt"

2019-12-24 Thread python-ideas--- via Python-ideas
There's already: for i in range(j): if i > 5: ... else: ... else: ... ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.o

[Python-ideas] Re: Segmentation of string

2019-12-25 Thread python-ideas--- via Python-ideas
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/python-ideas@python.org/message/E452LQGA3XKU5ADPTG54XP36ENXDZN2B/ ___ Python-ideas mailing list -- python

[Python-ideas] Re: Segmentation of string

2019-12-25 Thread python-ideas--- via Python-ideas
nations(range(1, len_it), n-1) ) _______ 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-ideas@python.org/message/KYM

[Python-ideas] Re: Moving PEP 584 forward (dict + and += operators)

2019-12-25 Thread python-ideas--- via Python-ideas
put objects. Maybe I want to support also dict. In this way writing such function is much more hard. _______ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mai

[Python-ideas] Re: Renaming json.load()

2019-12-25 Thread python-ideas--- via Python-ideas
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-

[Python-ideas] Re: Moving PEP 584 forward (dict + and += operators)

2019-12-25 Thread python-ideas--- via Python-ideas
Andrew Barnert wrote: > On Dec 25, 2019, at 14:57, python-ideas--- via Python-ideas > python-ideas@python.org 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

[Python-ideas] PEP for experimental/provisional features

2021-02-07 Thread sascha.schlemmer--- via Python-ideas
Reading the latest discussion about PEP 622/634-636 on the Python Dev mailing list, I've noticed there appears to be confusion about what `__future__` imports are supposed to be used for. Multiple people in that thread (and probably elsewhere in one of the many many threads about these

[Python-ideas] Re: PEP for experimental/provisional features

2021-02-07 Thread sascha.schlemmer--- via Python-ideas
> it's subject to change in future releases; you'll need to change > your code accordingly if it changes > because it's language change, it's unlikely you can conditionally > choose which syntax to use based on the version of Python being used > you enable it ex

[Python-ideas] Re: Alternate lambda syntax

2021-02-14 Thread anthony.flury via Python-ideas
On 12/02/2021 07:32, Paul Sokolovsky wrote: Hello, On Fri, 12 Feb 2021 18:26:53 +1100 Chris Angelico wrote: On Fri, Feb 12, 2021 at 6:24 PM Paul Sokolovsky wrote: ... And on the 2nd thought, that won't work. The reason it works in JS is that it doesn't have tuples. In Pyth

[Python-ideas] Re: Fwd: [Python-Dev] Suggestion About Python Syntax

2021-03-03 Thread anthony.flury via Python-ideas
Dear Anthony, Greetings from another Anthony (although my friends call me Tony). Thank you for your suggestion about changes to the Python Syntax. The Idea of having curly braces with blocks of code has been considered many times, and every time it has not been accepted. When you do enough

[Python-ideas] allow initial comma

2021-03-12 Thread roland.puntaier--- via Python-ideas
I had posted this as https://github.com/python/peps/issues/1867 The discussion so far is below. Please make some arguments. The major point to me is, that the symmetry is broken, which leads to extra editing actions, like removing the comma in the first line. I guess, this was the reason to

[Python-ideas] Python Idea - extension of 'with'

2021-04-08 Thread anthony.flury via Python-ideas
inally` clauses (or just `except` and `else` - do we need `finally` here). -- Anthony Flury *Moble*: +44 07743 282707 *Home*: +44 (0)1206 391294 *email*: anthony.fl...@btinternet.com <mailto:anthony.fl...@btinternet.com> <>___ Python-ideas ma

[Python-ideas] Re: Python Idea - extension of 'with'

2021-04-09 Thread anthony.flury via Python-ideas
lt;mailto:anthony.fl...@btinternet.com> <>___________ 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 htt

[Python-ideas] List comprehension operators

2021-12-14 Thread a.kolpakov2010--- via Python-ideas
It would be awesome to be able to create a list with just: li = [1—100] or li = [1 .. 100] ___ 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] Applications user/system directories functions

2021-12-15 Thread JGoutin via Python-ideas
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. _____

[Python-ideas] Re: Applications user/system directories functions

2021-12-15 Thread JGoutin via Python-ideas
, but provides more dirs on it. _______ 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/p

[Python-ideas] Re: Mapping unpacking assignment

2022-02-06 Thread layday--- via Python-ideas
This feature is far more useful in JS because JS objects double up as mappings - Python dataclasses/attrs models/Pydantic models/named tuples/who knows what are all represented by (typed) objects in JS/TS. As soon as you want to describe your data e.g. by encoding it in a dataclass you'

[Python-ideas] Re: Mapping unpacking assignment

2022-02-06 Thread layday--- via Python-ideas
erefore well-defined APIs), which is why it has wider applicability in JS. _______ 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/ M

[Python-ideas] Re: Mapping unpacking assignment

2022-02-06 Thread layday--- via Python-ideas
ponding to your message. ___ 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-i

[Python-ideas] Missing expandvars equivalent in pathlib

2022-02-10 Thread anthony.flury via Python-ideas
0 EMAIL;PREF=1:anthony.fl...@btinternet.com 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

[Python-ideas] Comparison operator support (>= and <=) for type

2019-06-14 Thread eminbugrasaral--- via Python-ideas
`, 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 -- python-ideas@python.org To

[Python-ideas] Add a `dig` method to dictionaries supporting the retrieval of nested keys

2019-08-29 Thread None via Python-ideas
und, avoiding `KeyError`. Thoughts? _______ 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.py

[Python-ideas] Re: Add a `dig` method to dictionaries supporting the retrieval of nested keys

2019-09-03 Thread None via Python-ideas
://www.davidhaney.io/npm-left-pad-have-we-forgotten-how-to-program/). I really believe that a nested key retrieval mechanism should be a first-class offering of the standard library. It is extremely common in the Python ecosystem to find developers working with data sets comprised of nested data

[Python-ideas] Python should take a lesson from APL: Walrus operator not needed

2019-11-05 Thread martin_05--- via Python-ideas
During a recent HN discussion about the walrus operator I came to realize yet another advantage of notation. I used APL professionally for about ten years, which made it an obvious source of inspiration for an example that, in my opinion, demonstrates why the Python team missed a very valuable

python-ideas@python.org

2019-11-18 Thread ivanov_chris--- via Python-ideas
ch is a very common operation and does not behave like Set.union. > Examples: > x = ("I love") > y = ("this idea ") > z = ("posted on November ") > a = 18 > print (x & y & z & a) # prints I love this idea posted on November 18 Quot

[Python-ideas] Re: Asyncio Future.set_result_threadsafe

2020-02-13 Thread Brianvanderburg2 via Python-ideas
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-

[Python-ideas] Control adding script path/CWD to sys.path

2020-02-24 Thread Brianvanderburg2 via Python-ideas
This is just an idea, which may not in practice be a major problem but can at times be an inconvenience.  I thought I had posted this in the "python -m" thread a little while back but checking my history it does't appear I did, I do apologize if this is a duplicate. When running

[Python-ideas] Re: Control adding script path/CWD to sys.path

2020-02-26 Thread Brianvanderburg2 via Python-ideas
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

[Python-ideas] is a

2020-05-01 Thread gbs--- via Python-ideas
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

[Python-ideas] Enhancement: Adding support for private and name mangled type hints in dataclasses module

2020-08-23 Thread zachb1996--- via Python-ideas
I have a proposal for an addition to the dataclasses module that I think would make it easier to use private and name mangled variables. One of the benefits of the dataclass decorator is that it helps lessen the amount of code when you just need a simple constructor. A common pattern in python

[Python-ideas] Re: Enhancement: Adding support for private and name mangled type hints in dataclasses module

2020-08-24 Thread zachb1996--- via Python-ideas
While I agree that this is a subset of the idea of having a different attribute name, I think this naming convention is very common, and is even referenced in the python documentation. Which is why I think it would warrant being built in as opposed to using an InitVar. So the way attrs deals

[Python-ideas] Re: Suggestion: annotated exceptions

2020-09-26 Thread sascha.schlemmer--- via Python-ideas
milar function except EveryArithmeticErrorYouCanThinkOf: # very bad design imho. print('ooops something went wrong') ``` >From a cultural perspective (with python traditionally not being written in >this style) I think writing code like this at the level of internal library >co

[Python-ideas] Re: Suggestion: annotated exceptions

2020-09-26 Thread sascha.schlemmer--- via Python-ideas
ne passes `b=0` to `div.` > Worse, because types in Python use subtyping, I can pass an int that > does something you don't expect: > class MyWeirdInt(int): > def __truediv__(self, other): > if other == 0: > import loging > logging.logg(&

[Python-ideas] Re: Suggestion: annotated exceptions

2020-09-26 Thread sascha.schlemmer--- via Python-ideas
> From a cultural perspective (with python traditionally not being written in > this style) > I think writing code like this at the level of internal library code (that > the user of the > library will not see when using the library) is perfectly fine. >From a cultural perspe

[Python-ideas] propose index heap

2020-11-01 Thread master_lee via Python-ideas
Index heap is essential in efficient implementation of Dijkstra's algorithm, Prim's algorithm and other variants, I have implemented a concise version at https://github.com/yutao-li/libheap , I think it would be useful to have it in stdlib ____

[Python-ideas] Re: A python_include() for cgi programming

2020-11-26 Thread Voltron via Python-ideas
I know what your getting at, this will work if you want to have variables in the included file in scope in the caller of 'include', just insert it as normal python. Though I prefer this version as it is simpler and less error prone. with open('myfile.py') as f: exec(f.re

[Python-ideas] Simon's ideas [Was: How to respond to trolling (Guido van Rossum)]

2017-01-12 Thread Guyzmo via Python-ideas
ting noise. Please, would be kind enough to keep discussing this on python-list (aka comp.lang.python) where it belongs? And eventually, once discussion settles on realistic changes that /can/ be added to python you might want to submit a PEP: http://legacy.python.org/dev/peps/pep-0001/ To quot

Re: [Python-ideas] A more readable way to nest functions

2017-01-28 Thread zmo via Python-ideas
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

Re: [Python-ideas] A more readable way to nest functions

2017-01-29 Thread zmo via Python-ideas
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

Re: [Python-ideas] Fwd: Define a method or function attribute outside of a class with the dot operator

2017-02-10 Thread Guyzmo via Python-ideas
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 Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

[Python-ideas] Optional argument to fnmatch functions treat * and ** differently

2017-02-28 Thread Aaron via Python-ideas
y to be accepted into the standard library, before I start working on a patch. I have seen people raise the question of how to achieve this in a number of places. Somebody has also forked the Python 2 standard library fnmatch module to implement this as a standalone library: https://github.com/k

Re: [Python-ideas] Expose a child factory using MappingProxyType in builtins

2017-02-28 Thread lucas via Python-ideas
gt;> >>>> -Joseph >>>> >>>>> On Feb 28, 2017, at 7:17 AM, Michel Desmoulin < >>>> desmoulinmic...@gmail.com> wrote: >>>>> >>>>> We have the immutable frozenset for sets and and tuples for lists. >>>>>

Re: [Python-ideas] π = math.pi

2017-06-01 Thread Guyzmo via Python-ideas
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

[Python-ideas] + operator on generators

2017-06-25 Thread lucas via Python-ideas
ce itself), but by seeing the sources, i imagine that i could do something like the list_concat function at Objects/listobject.c:473, but in the Objects/genobject.c file, where instead of copying elements i'm creating and initializing a new chainobject as described at Modules/itertoolsmodule.c:1792

[Python-ideas] Add a replace method to tuples

2022-03-10 Thread wfdc via Python-ideas
-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._____

[Python-ideas] Re: Add a replace method to tuples

2022-03-10 Thread wfdc via Python-ideas
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

[Python-ideas] Re: Add a replace method to tuples

2022-03-10 Thread wfdc via Python-ideas
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

[Python-ideas] Re: Add a replace method to tuples

2022-03-11 Thread wfdc via Python-ideas
> one Stack Overflow question, with a low number of votes Mind explaining why you say 159 is a "low number of votes" for a StackOverflow question on Python? According to https://stackoverflow.com/questions/tagged/python, this puts it in the top 3031 / 1908740 = 0.00159 = 0.1

[Python-ideas] Re: Add a replace method to tuples

2022-03-11 Thread wfdc via Python-ideas
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

[Python-ideas] Re: Add a replace method to tuples

2022-03-11 Thread wfdc via Python-ideas
> 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

[Python-ideas] Re: Add a replace method to tuples

2022-03-11 Thread wfdc via Python-ideas
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 > > python-ideas@python.org wrote: > > > > But humans can be confused by "replace" having a totally different API in > &g

[Python-ideas] Re: Add a replace method to tuples

2022-03-11 Thread wfdc via Python-ideas
> 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 call the purpose rare at best. This comment is useless without a base rate. What's the base rate for comparable methods that *are* part o

[Python-ideas] Re: Add a replace method to tuples

2022-03-11 Thread wfdc via Python-ideas
rd library) and pointing out where > the proposed new feature would demonstrably improve the readability or > maintainability of parts of the code. That's something we can work with. Do you have particular examples that demonstrate the kind of evidence that would satisfy you? > Y

[Python-ideas] Re: Add a replace method to tuples

2022-03-11 Thread wfdc via Python-ideas
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? > &

[Python-ideas] Re: Add a replace method to tuples

2022-03-11 Thread wfdc via Python-ideas
> 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-

[Python-ideas] Re: Add a replace method to tuples

2022-03-11 Thread wfdc via Python-ideas
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 -- python-ideas@python.org To unsubscribe send an email to py

[Python-ideas] Re: Add a replace method to tuples

2022-03-11 Thread wfdc via Python-ideas
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

[Python-ideas] Re: Add a replace method to tuples

2022-03-11 Thread wfdc via Python-ideas
Wrong. If you're not willing to make substantive contributions to this thread, I suggest you refrain from posting further. --- Original Message --- On Friday, March 11th, 2022 at 4:42 PM, David Mertz, Ph.D. wrote: > So it appears the "problem" this is intended t

[Python-ideas] Re: Add a replace method to tuples

2022-03-11 Thread wfdc via Python-ideas
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

[Python-ideas] Re: Add a replace method to tuples

2022-03-11 Thread wfdc via Python-ideas
rticular technique > that can be useful for solving some problems. > > This is probably a clear enough example of the XY-problem as to be worth > adding to the Wikipedia article on that topic. > > We sometimes see other similar proposals to e.g. "solve" the "prob

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread wfdc via Python-ideas
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__

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread wfdc via Python-ideas
me, is a pretty insulting thing to say Not at all. It's appropriate given the tone and content of the post it's addressed to. > to someone who, I would guess, has been using Python for decade(s) longer > than you have. 1. On what basis? You don't know who I am. 2. How

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread wfdc via Python-ideas
Now read what you said earlier: > So it appears the "problem" this is intended to solve is "Python isn't > Haskell." > But Haskell exists, and this is a non-problem looking for a solution. A bizarre incongruence, right? --- Original Message --- On F

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread wfdc via Python-ideas
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.

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread wfdc via Python-ideas
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

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread wfdc via Python-ideas
-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.__

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread wfdc via Python-ideas
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

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread wfdc via Python-ideas
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

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread wfdc via Python-ideas
On Monday, March 14th, 2022 at 8:31 AM, Chris Angelico wrote: > On Sat, 12 Mar 2022 at 08:53, wfdc via Python-ideas > > python-ideas@python.org wrote: > > > So do you propose getting rid of the tuple type entirely or not? > > > > Do you see why it's usefu

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread wfdc via Python-ideas
> I would think that at least is obvious: the top voted Python question on > StackOverflow currently has 11891 votes. This is two orders of magnitude less. Like I said, this puts it in the top 3031 / 1908740 = 0.00159 = 0.159% of Python questions by vote count. That's not "

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread wfdc via Python-ideas
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

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread wfdc via Python-ideas
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

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread wfdc via Python-ideas
2B%5C%29%5Cs*%5Cw%2B%5C%5B%5Cw%2B%5C%5D%5Cs*%3D%5Cs*%5B%5Cw%5C.%5D%2B%5Cs*%5B%5Cw%5C.%5D%2B%5Cs*%3D%5Cs*tuple%5C%28%5Cw%2B%5C%29&patternType=regexp --- Original Message --- On Monday, March 14th, 2022 at 8:56 AM, Chris Angelico wrote: > On Mon, 14 Mar 2022 at 23:54, Christopher Bar

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread wfdc via Python-ideas
and you don't need our advice for that I assume. > > I suggest you give up on this list, write the code, make sure it's > > well-documented, and submit a merge request. If you don't get a timely > > response (ie, after a decent interval for the relevant folks to pick

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread wfdc via Python-ideas
They are deliberately > > designed to be drop-in replacements for tuples. > > ChrisA > > _______ > > 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] Re: Add a replace method to tuples

2022-03-14 Thread wfdc via Python-ideas
nt is that they are both sequences and structures. > > https://docs.python.org/3/library/collections.html#collections.namedtuple > > ChrisA > > ___ > > Python-ideas mailing list -- python-ideas@python.org > > To

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread wfdc via Python-ideas
'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 > > ___

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread wfdc via Python-ideas
g idea. Perhaps we can discuss it further. > > --- Original Message --- > > On Monday, March 14th, 2022 at 8:38 AM, Steven D'Aprano st...@pearwood.info > wrote: > > > On Fri, Mar 11, 2022 at 01:38:57AM +, Rob Cliffe via Python-ideas wrote: > > > &

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread wfdc via Python-ideas
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

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread wfdc via Python-ideas
> On Tue, 15 Mar 2022 at 05:37, Christopher Barker python...@gmail.com wrote: > > > > there has STILL been no answer to the questions of "why not > > > > > > use namedtuple" and "why not use a dataclass", > > > > The OP may not have, but I at

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread wfdc via Python-ideas
, March 14th, 2022 at 7:04 PM, Chris Angelico wrote: > On Tue, 15 Mar 2022 at 10:02, wfdc via Python-ideas > > python-ideas@python.org wrote: > > > See my previous response to Chris: > > > > > What are the named fields supposed to be if the datastructure is being

[Python-ideas] Re: Add a replace method to tuples

2022-03-14 Thread wfdc via Python-ideas
--- Original Message --- On Monday, March 14th, 2022 at 7:51 PM, Steven D'Aprano wrote: > On Mon, Mar 14, 2022 at 04:38:48PM +, wfdc wrote: > > > > I would think that at least is obvious: the top voted Python > > > > > > question on StackOverfl

  1   2   3   4   5   6   7   8   9   10   >