[Python-ideas] Re: Allowing non-ASCII bracket and quote characters in source code

2022-01-18 Thread 2QdxY4RzWzUUiLuE
On 2022-01-18 at 12:07:15 +1100, Steven D'Aprano wrote: > I would be more sympathetic to this idea if: > 1. I knew how to easily type all those brackets on the keyboard, > without having to use a GUI character picker. That's between you and your OS. I believe all the major ones have ways to

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

2021-12-11 Thread 2QdxY4RzWzUUiLuE
On 2021-12-12 at 17:28:23 +1300, Greg Ewing wrote: > On 11/12/21 1:22 pm, Christopher Barker wrote: > > Darn — the P and A are swapped there. > > "Argument" and "actual" both start with "A" -- does that help? Then Parameters must be Potential (before they become Actualized as Arguments)?

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

2021-12-10 Thread 2QdxY4RzWzUUiLuE
On 2021-12-10 at 17:24:22 -0500, "Eric V. Smith" wrote: > [0]: Or arguments, I can never remember which is which: someone needs > to invent a memorable mnemonic device. Pass Arguments Accept Parameters (I don't know. I just made that up. For some reason, the fact that functions have "formal

[Python-ideas] Re: Should Python enforce Type-checking in the future?

2021-12-10 Thread 2QdxY4RzWzUUiLuE
On 2021-12-10 at 20:20:05 +, deavid wrote: > A lot of you are referring to scripting, learning, and other ways of > using Python that would be badly impacted. I already acknowledged that > these exist (or at least I didn't notice here any other that I wasn't > aware), and that's why I

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

2021-12-05 Thread 2QdxY4RzWzUUiLuE
On 2021-12-06 at 02:15:36 +1100, Chris Angelico wrote: > On Mon, Dec 6, 2021 at 1:48 AM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > > > On 2021-12-05 at 20:30:53 +1100, > > Chris Angelico wrote: > > [...] > > > https://pyauth.github.io/pyotp/#time-based-otps > > > > I agree. *Not*

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

2021-12-05 Thread 2QdxY4RzWzUUiLuE
On 2021-12-05 at 20:30:53 +1100, Chris Angelico wrote: > On Sun, Dec 5, 2021 at 5:41 PM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > Also FWIW, I still think that if you're doing (b) or (c), then you're > > *not* doing default values anymore, you're moving pieces of the logic or > > the

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

2021-12-04 Thread 2QdxY4RzWzUUiLuE
On 2021-12-01 at 17:16:34 +1100, Chris Angelico wrote: > *PEP 671: Syntax for late-bound function argument defaults* > > Questions, for you all: > > 1) If this feature existed in Python 3.11 exactly as described, would > you use it? No. I understand the arguments (pun intended) for the

[Python-ideas] Re: Adding pep8-casing-compliant aliases for the entire stdlib

2021-11-11 Thread 2QdxY4RzWzUUiLuE
On 2021-11-12 at 14:43:07 +1100, Steven D'Aprano wrote: > On Thu, Nov 11, 2021 at 10:06:45PM -0500, Ricky Teachey wrote: > > > Is there a standard idiom-- perhaps using a type-hint-- to signal to the > > IDE/linter that my user-defined class is intended to be used as a > > function/factory, and

[Python-ideas] Re: PEP 671: Syntax for late-bound function argument defaults

2021-10-30 Thread 2QdxY4RzWzUUiLuE
On 2021-10-31 at 14:56:36 +1100, Chris Angelico wrote: > On Sun, Oct 31, 2021 at 2:43 PM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > > > On 2021-10-30 at 18:54:51 -0700, > > Brendan Barnwell wrote: > > > > > On 2021-10-30 18:29, Chris Angelico wrote: > > > > > > Right. That is a very real

[Python-ideas] Re: PEP 671: Syntax for late-bound function argument defaults

2021-10-30 Thread 2QdxY4RzWzUUiLuE
On 2021-10-30 at 18:54:51 -0700, Brendan Barnwell wrote: > On 2021-10-30 18:29, Chris Angelico wrote: > > Right. That is a very real difference, which is why there is a very > > real difference between early-bound and late-bound defaults. But both > > are argument defaults. > > I don't

[Python-ideas] Re: PEP 671: Syntax for late-bound function argument defaults

2021-10-26 Thread 2QdxY4RzWzUUiLuE
On 2021-10-27 at 13:47:31 +1100, Chris Angelico wrote: > On Wed, Oct 27, 2021 at 1:15 PM Brendan Barnwell > wrote: > > > > On 2021-10-26 17:41, Christopher Barker wrote: > > > Python used to be such a simple language, not so much anymore :-( > > > > I quite agree, and I feel like this

[Python-ideas] Re: PEP 671: Syntax for late-bound function argument defaults

2021-10-25 Thread 2QdxY4RzWzUUiLuE
On 2021-10-26 at 12:51:43 +1100, Chris Angelico wrote: > On Tue, Oct 26, 2021 at 12:40 PM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > > > On 2021-10-26 at 12:12:47 +1100, > > Chris Angelico wrote: > > > The difference between early evaluation and late evaluation is that > > > one retains

[Python-ideas] Re: PEP 671: Syntax for late-bound function argument defaults

2021-10-25 Thread 2QdxY4RzWzUUiLuE
On 2021-10-26 at 12:12:47 +1100, Chris Angelico wrote: > On Tue, Oct 26, 2021 at 11:44 AM Rob Cliffe via Python-ideas > wrote: > > I prefer 1). Easier to understand and debug in examples with side-effects > > such as > > def f(a := enter_codes(), b = assign_targets(), c :=

[Python-ideas] Re: Syntax for late-bound arguments

2021-10-23 Thread 2QdxY4RzWzUUiLuE
On 2021-10-24 at 13:23:51 +1100, Steven D'Aprano wrote: > On Sat, Oct 23, 2021 at 02:54:54PM -0700, 2qdxy4rzwzuui...@potatochowder.com > wrote: > > [...] > > > The function header is a syntactic construct - the "def" line, any > > > decorators, annotations, etc. > > > > If you mean that def

[Python-ideas] Re: Syntax for late-bound arguments

2021-10-23 Thread 2QdxY4RzWzUUiLuE
On 2021-10-24 at 06:54:36 +1100, Chris Angelico wrote: > On Sun, Oct 24, 2021 at 6:18 AM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > > The expression would be evaluated in the function's context, having > > > available to it everything that the function has. Notably, this is NOT > > > the

[Python-ideas] Re: Syntax for late-bound arguments

2021-10-23 Thread 2QdxY4RzWzUUiLuE
On 2021-10-24 at 03:07:45 +1100, Chris Angelico wrote: > def bisect(a, x, lo=0, hi=None): > if lo < 0: > raise ValueError('lo must be non-negative') > if hi is None: > hi = len(a) > > It's clear what value lo gets if you omit it. It's less clear what hi > gets. And the

[Python-ideas] Re: Implementing string unary operators

2021-10-19 Thread 2QdxY4RzWzUUiLuE
On 2021-10-20 at 11:48:30 +1100, Chris Angelico wrote: > TBH swapcase is a bit of a minefield if you don't know what language > you're working with. [...] > The most logical "negation" of a string would be reversing it, which > WOULD be... well, reversible. But that doesn't need an operator,

[Python-ideas] Re: Implementing additional string operators

2021-10-13 Thread 2QdxY4RzWzUUiLuE
On 2021-10-14 at 04:34:24 +1100, Chris Angelico wrote: > On Thu, Oct 14, 2021 at 2:21 AM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > > > On 2021-10-14 at 00:00:25 +0900, > > "Stephen J. Turnbull" wrote: > > > > > Chris Angelico writes: > > > > > > > +1, although it's debatable whether it

[Python-ideas] Re: Implementing additional string operators

2021-10-13 Thread 2QdxY4RzWzUUiLuE
On 2021-10-14 at 00:00:25 +0900, "Stephen J. Turnbull" wrote: > Chris Angelico writes: > > > +1, although it's debatable whether it should be remove suffix or > > remove all. I'd be happy with either. > > If by "remove all" you mean "efefef" - "ef" == "", I think that's a > footgun.

[Python-ideas] Re: dict_items.__getitem__?

2021-10-06 Thread 2QdxY4RzWzUUiLuE
On 2021-10-06 at 08:52:22 -0600, Finn Mason wrote: > I'm not a huge fan. Sure, dicts are ordered now, but I doubt that many > people use that feature. I honestly still think of them as unordered > ;) +1 on still think of mappings as unordered (but finding myself screaming Get Off My Lawn more

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

2021-09-12 Thread 2QdxY4RzWzUUiLuE
On 2021-09-12 at 07:28:53 -0700, Guido van Rossum wrote: > What about asserts that are not used for testing, but as classic > “unless there’s a bug, this should hold”? Those may not want to incur > the extra cost. I was actually thinking exactly the opposite: this would more useful in

[Python-ideas] Re: PEP8 mandatory-is rule

2021-08-31 Thread 2QdxY4RzWzUUiLuE
On 2021-08-31 at 11:15:22 -0700, Nick Parlante wrote: > As mentioned, PEP8 is formally for narrow cases, and includes > disclaimers about not applying it mechanically, reflecting a basic > reasonableness. Nothing to complain about there. > As a practical matter, the IDEs just default to having

[Python-ideas] Re: We should have an explicit concept of emptiness for collections

2021-08-23 Thread 2QdxY4RzWzUUiLuE
On 2021-08-23 at 21:06:46 -, Tim Hoffmann via Python-ideas wrote: > - Re bool: As experienced python users we are used to translate `if > not users` to "if users is empty" or "if we have no users", but it > *is* less explicit than `if users.is_empty()`. I mentally translate "if not users"

[Python-ideas] Re: Notation for subscripts.

2021-08-13 Thread 2QdxY4RzWzUUiLuE
On 2021-08-13 at 23:18:29 +1100, Matsuoka Takuo wrote: > Given a subscriptable object s, the intended rule for the notation for > getting an item of s seems that, for any expression {e}, such as > "x, ", > s[{e}] > (i.e., s[x, ] if {e} is "x, ") means the same as > s[({e})] If e is an

[Python-ideas] Re: slices syntactic sugar

2021-08-12 Thread 2QdxY4RzWzUUiLuE
On 2021-08-12 at 14:05:23 -, eloi.riv...@aquilenet.fr wrote: > This is how slices are used in the python standard library, indeed, > but that does not stop me from interpreting the slices as "inclusive > by default" in my library. The inconsistency with the rest of the > python standard

[Python-ideas] Re: slices syntactic sugar

2021-08-12 Thread 2QdxY4RzWzUUiLuE
On 2021-08-12 at 08:56:22 -, eloi.riv...@aquilenet.fr wrote: > Hi. I am working on a kinda-ORM library, which usage often implies to request > data within specific ranges: > > Foobar.search( > attr1="foo", > attr2=gt(10), > attr3=between(42, 50) > ) > > The

[Python-ideas] Re: Argparse.add_argument() argument for additional functionallity

2021-08-08 Thread 2QdxY4RzWzUUiLuE
On 2021-08-08 at 21:37:28 -, Hasan Aliyev wrote: > For example we can have one ArgumentParser instance, for (windows, linux), > (community edition, pro edition) apps. It could give ability to show and be > able to run only allowed commands based on version of os, app or some other >

[Python-ideas] Re: Pattern matching in python function headers

2021-08-08 Thread 2QdxY4RzWzUUiLuE
On 2021-08-08 at 11:30:20 +0400, Abdulla Al Kathiri wrote: > ... if we write “case” before “def” similar to “async” before “def” in > async function it should be clear we are doing pattern matching. The > function will be named case function. > > case def fib(0): > return 0 > > case def

[Python-ideas] Re: C API for converting Python integers to/from bytes sequences

2021-08-08 Thread 2QdxY4RzWzUUiLuE
On 2021-08-08 at 09:41:34 +0100, Barry Scott wrote: > What is mixed endian? I would guess that its use would be application > specific - so I assume you would not need to support it. Not AFAIK application specific, but hardware specific: https://en.wikipedia.org/wiki/Endianness#Mixed

[Python-ideas] Re: Pattern matching in python function headers

2021-08-06 Thread 2QdxY4RzWzUUiLuE
On 2021-08-06 at 21:57:47 +1000, Steven D'Aprano wrote: > On Thu, Aug 05, 2021 at 09:39:44AM +0100, Sam Frances wrote: > > def fib(0): > > return 0 > > > > def fib(1): > > return 1 > > > > def fib(n): > > return fib(n-1) + fib(n-2) > > I think that there is something rather

[Python-ideas] Re: writelines2?

2021-07-13 Thread 2QdxY4RzWzUUiLuE
On 2021-07-13 at 14:11:15 -, sandhoners...@gmail.com wrote: > Maybe (to be consistent with other functions like print), end= since > that would allow even custom line endings As it stands, writelines is consistent with readlines. Both preserve newlines. All else being equal, the following

[Python-ideas] Re: Extension methods in Python

2021-06-20 Thread 2QdxY4RzWzUUiLuE
On 2021-06-20 at 12:18:24 -, Johan Vergeer wrote: > After working with Kotlin for a while I really started to like the > idea of extension methods. I delivers a great way to extend the > language without having to add features to the language itself. I disagree with the premise that such a

[Python-ideas] Re: Add static variable storage in functions

2021-05-27 Thread 2QdxY4RzWzUUiLuE
On 2021-05-28 at 12:22:22 +1000, Chris Angelico wrote: > [...] calculate something once and reuse the value, because you know > that it won't change (or don't care if it changes) [...] > (Some day I'll learn how to do this in real life. Why can't I buy just > one egg, and then reuse the same

[Python-ideas] Re: Add static variable storage in functions

2021-05-27 Thread 2QdxY4RzWzUUiLuE
On 2021-05-27 at 22:33:25 +1000, Steven D'Aprano wrote: > Aside from globals, which we agree are Considered Harmful, you've > suggested two alternative implementations: > > - something with closures; > > - hidden state in an object with a `__call__` method. > > Closures are cool, but the

[Python-ideas] Re: Introduce constants in Python (constant name binding)

2021-05-26 Thread 2QdxY4RzWzUUiLuE
On 2021-05-26 at 12:53:32 -, Shreyan Avigyan wrote: > I've already given one. Since Python is dynamically typed changing a > critical variable can cause huge instability. Want a demonstration? > Here we go, > > import sys > sys.stdout = None > > Now what? Now how can we print anything?

[Python-ideas] Re: New Idea: A safe keyword to execute the following statement in a failsafe mode.

2021-05-23 Thread 2QdxY4RzWzUUiLuE
On 2021-05-24 at 01:34:29 +1000, Steven D'Aprano wrote: > On Sun, May 23, 2021 at 06:52:38PM +0530, Shivam Saini wrote: > > > After all, python is known for one liners and this would be an another > > great one liner if implemented. > > Python isn't known for one-liners. You might be thinking

[Python-ideas] Re: Add support for private variables, methods and functions in Python

2021-05-23 Thread 2QdxY4RzWzUUiLuE
On 2021-05-23 at 16:30:35 +0200, Marco Sulla wrote: > On Sun, 23 May 2021 at 14:50, Chris Angelico wrote: > > > > On Sun, May 23, 2021 at 10:42 PM Marco Sulla > > wrote: > > > > > > On Sun, 23 May 2021 at 14:35, Chris Angelico wrote: > > > > > > > > On Sun, May 23, 2021 at 10:30 PM Marco

[Python-ideas] Re: Add support for private variables, methods and functions in Python

2021-05-06 Thread 2QdxY4RzWzUUiLuE
On 2021-05-06 at 18:34:55 -, Shreyan Avigyan wrote: > Chris: > > I'm not sure about other people, but I have never, not once, used > > @property as a means of controlling access. So giving me another way > > to do something that I am not, and don't want to, do... isn't much of > > an

[Python-ideas] Re: String comprehension

2021-04-30 Thread 2QdxY4RzWzUUiLuE
On 2021-05-01 at 03:05:51 -, Valentin Berlier wrote: > Also I haven't seen anyone acknowledge the potential performance > benefits of string comprehensions. The "".join() idiom needs to go > through the entire generator machinery to assemble the final string, > whereas a decent

[Python-ideas] Re: String comprehension

2021-04-30 Thread 2QdxY4RzWzUUiLuE
On 2021-04-30 at 14:14:50 -0400, David Álvarez Lombardi wrote: [...] > new = c"x.lower() for x in old if x in HARDCODED_LIST" # filter-in chars > that appear in earlier-defined HARDCODED_LIST and convert to lower > new = c"x for x in old if not x.isprintable()" # filter-in > non-printable

[Python-ideas] Re: Iterable scalar values returning itself ones?

2021-04-15 Thread 2QdxY4RzWzUUiLuE
On 2021-04-16 at 04:03:33 +1000, Chris Angelico wrote: > So brace-left, brace-right is "{}" but compose, brace-left, > brace-right is "∅". If absolutely every Python programmer had this > available, it might be enough to distinguish empty dict from empty > set. But if an empty set is

[Python-ideas] Re: Change the exception type and message raised when _curses is not found

2021-04-04 Thread 2QdxY4RzWzUUiLuE
On 2021-04-04 at 18:05:12 -, Shreyan Avigyan wrote: > When importing the curses module, be it on Windows or Darwin or > UNIX-based OS or any other platform, if the _curses module is not > found then just a ModuleNotFoundError is raised. But this error is not > very informational in case of

[Python-ideas] Re: allow initial comma

2021-03-12 Thread 2QdxY4RzWzUUiLuE
On 2021-03-12 at 11:02:50 -0500, Ned Batchelder wrote: > I think the only reason anyone ever used leading commas to begin with > was because of languages that didn't allow a final trailing comma.  In > those worlds, to keep the editing smooth, people moved the commas to > the beginning of the

[Python-ideas] Re: Make list.reverse() more flexible

2021-03-05 Thread 2QdxY4RzWzUUiLuE
On 2021-03-05 at 16:27:27 -, Vincent Cheong wrote: > Currently, list.reverse() only works for an entire list. If one wants > to reverse a section of it 'in-place', one needs to slicing which > makes the space complexity no longer O(1). One can also manually make > a loop and do the reversal

[Python-ideas] Re: SimpleNamespace vs object

2021-02-20 Thread 2QdxY4RzWzUUiLuE
On 2021-02-20 at 13:44:21 -0500, David Mertz wrote: > Cheeseshop! But then it would never contain the attribute I ask for, and throw a different exception every time! ;-) ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an

[Python-ideas] Re: Alternate lambda syntax

2021-02-18 Thread 2QdxY4RzWzUUiLuE
On 2021-02-18 at 18:10:16 +0400, Abdulla Al Kathiri wrote: > I will be very happy if those versions of Callable and anonymous > functions exist in Python right now. See how elegant that would look > like.. > > def func(x: int, y: int, f: (int, int) -> int) -> int: > return f(x, y)

[Python-ideas] Re: SimpleNamespace vs object

2021-02-17 Thread 2QdxY4RzWzUUiLuE
On 2021-02-18 at 06:21:19 +1100, Chris Angelico wrote: > On Thu, Feb 18, 2021 at 1:53 AM Ricky Teachey wrote: > > > > I would personally love for SimpleNamespace to get a shorter name and > > become a built-in. > > Okay. Let's start bikeshedding. If SimpleNamespace were to become a >

[Python-ideas] Re: Adding `open_text()` builtin function. (relating to PEP 597)

2021-01-24 Thread 2QdxY4RzWzUUiLuE
On 2021-01-25 at 00:29:41 +1100, Steven D'Aprano wrote: > On Sat, Jan 23, 2021 at 03:24:12PM +, Barry Scott wrote: > > > I think that you are going to create a bug magnet if you attempt to auto > > detect the encoding. > > > > First problem I see is that the file may be a pipe and then you

[Python-ideas] Re: timeit improvement idea: add an option to measure a script execution time

2021-01-10 Thread 2QdxY4RzWzUUiLuE
On 2021-01-10 at 18:38:12 +0100, Alex Prengère wrote: > Today I had a quite simple need, I am unsure about the best way to do > it, and saw a possible improvement for the *timeit *module. > > I have about 30 Python scripts and I want to measure precisely their > execution times, without

[Python-ideas] Re: pathlib enhancements

2021-01-09 Thread 2QdxY4RzWzUUiLuE
On 2021-01-10 at 05:03:08 +1100, Chris Angelico wrote: > On Sun, Jan 10, 2021 at 4:51 AM Stephen J. Turnbull > wrote: > > > > Joseph Martinot-Lagarde writes: > > > > > One remark about this : .tar.gz files are the exception rather than > > > the rule, and AFAIK maybe the only one ? > > > >

[Python-ideas] Re: An option to force the path separator for the "os.path.join()" method.

2021-01-05 Thread 2QdxY4RzWzUUiLuE
On 2021-01-06 at 07:07:30 +0300, Mikhail V wrote: > I'd like to have an option to force the path separator for the > "os.path.join()" method. > E.g. if I run the script on Windows, but I generate, say, an URL, I'd > find it convenient > to use the same method, but with an explicit flag to "join"

[Python-ideas] Re: Standard tool for iterating over recursive data structures?

2021-01-01 Thread 2QdxY4RzWzUUiLuE
On 2021-01-01 at 16:34:15 +1100, Steven D'Aprano wrote: > This isn't so much an idea for Python, as a request for ideas to solve a > problem in Python. [examples of recurive data snipped] > The built-ins handle these cases okay. Likewise the copy.deepcopy > function takes care to avoid

[Python-ideas] Re: str.isfloat()

2020-12-27 Thread 2QdxY4RzWzUUiLuE
On 2020-12-27 at 19:55:39 -0300, "Joao S. O. Bueno" wrote: > I tried to make clear this should be in addition to that - But yes, I > failed to mention in my message that I think such a function would > mostly benefit beginners learning around with "input" and "print" - it > is painful to

[Python-ideas] Re: built in to clear terminal

2020-12-26 Thread 2QdxY4RzWzUUiLuE
On 2020-12-27 at 13:24:34 +1100, Steven D'Aprano wrote: > But the ctrl-L trick has no discoverability. It took me close to > twenty years of using Linux before I discovered it, and I still don't > remember to use it when I need it. The first time a sysadmin added readline to one of our work

[Python-ideas] Re: Move semantics

2020-11-27 Thread 2QdxY4RzWzUUiLuE
On 2020-11-27 at 14:32:11 +0100, Antoine Pitrou wrote: > On Fri, 27 Nov 2020 07:32:17 -0500 > 2qdxy4rzwzuui...@potatochowder.com > wrote: > > > > I come from old(er) school (1980s, 1990s) embedded systems, and who > > "owns" a particular mutable data structure and how/where it gets mutated > >

[Python-ideas] Re: Move semantics

2020-11-27 Thread 2QdxY4RzWzUUiLuE
On 2020-11-27 at 10:38:06 +0200, Serhiy Storchaka wrote: > 26.11.20 19:07, Guido van Rossum пише: > > This reminds me of something in C++. Does it exist in other languages? > Indeed, this is a term from C++. In older C++ you could pass argument > by value, which makes a copy, and by reference,

[Python-ideas] Re: PEP 634-636: Mapping patterns and extra keys

2020-11-15 Thread 2QdxY4RzWzUUiLuE
On 2020-11-15 at 19:11:15 +1100, Steven D'Aprano wrote: > On Sat, Nov 14, 2020 at 10:17:34PM -0800, Guido van Rossum wrote: > > > It’s a usability issue; mappings are used quite differently than sequences. > > Compare to class patterns rather than sequence patterns. > > I'm keeping an open

[Python-ideas] Re: execute function on iterator items without changing or consuming iterator

2020-10-25 Thread 2QdxY4RzWzUUiLuE
On 2020-10-25 at 16:34:14 +, George Harding wrote: > some_iter = map(lambda x: x if print(x) else x, some_iter) > > The tuple has a ~50% overhead, the case statement ~15%, compared to the > generator. def print_first(x): print(x) return x new_iter = map(print_first,

[Python-ideas] Re: TextIOWrapper support for null-terminated lines

2020-10-24 Thread 2QdxY4RzWzUUiLuE
On 2020-10-24 at 12:29:01 -0400, Brian Allen Vanderburg II via Python-ideas wrote: > ... Find can output it's filenames in null-terminated lines since it > is possible to have newlines in a filename(yuck) ... Spaces in filenames are just as bad, and much more common: $ touch 'foo bar'

[Python-ideas] Re: Call a function at invocation

2020-10-22 Thread 2QdxY4RzWzUUiLuE
On 2020-10-22 at 20:04:14 -0400, Michael Smith wrote: > 1. Being able to call two different functions from the same module. (AND) > 2. Being able to call some functions that exist today without modification > or rearrangement. (AND) > 3. Being able to invoke these things from python without

[Python-ideas] Re: Regular Expression | re - Support String List Input Type List[str]

2020-09-28 Thread 2QdxY4RzWzUUiLuE
On 2020-09-28 at 23:10:24 -, Giang Le wrote: > I would like to propose an idea for the regular expression module > re.search(Pattern, Input) to support List[str] input type. > So it will return a matched object list if the input is a string > list. Otherwise, it will return a normal matched

[Python-ideas] Re: Suggestion: annotated exceptions

2020-09-25 Thread 2QdxY4RzWzUUiLuE
On 2020-09-25 at 13:44:36 +0100, Samuel Colvin wrote: > 2. We should have some easy way to say "let this error propagate", > rust uses very nice question mark at the end of a line syntax, python > could use something similar one day, until then a magic comment, > wrapper function or context

[Python-ideas] Re: Minor contributions to PEPs (Was: PEP 637 - support for indexing with keyword arguments)

2020-09-23 Thread 2QdxY4RzWzUUiLuE
On 2020-09-23 at 23:28:11 +0100, Henk-Jaap Wagenaar wrote: > >>> a[3] # returns the fourth element of a > > has the comment unfinished. I guess it should say list or something > similar.] Yes, I agree: it looks like it's broken, but it's okay. a[3] returns the fourth element of a

[Python-ideas] Re: Curious : Why staticmethod if classmethods can do everything a static method can?

2020-09-12 Thread 2QdxY4RzWzUUiLuE
On 2020-09-12 at 14:07:57 +1000, Cameron Simpson wrote: > Dan, I should preface this by saying I don't substantially disagree > with you, I just work differently and want to show how and why. > The beauty here is that you have the same pattern of > classname.transcribe_value(value) to use

[Python-ideas] Re: Curious : Why staticmethod if classmethods can do everything a static method can?

2020-09-11 Thread 2QdxY4RzWzUUiLuE
On 2020-09-12 at 09:57:10 +1000, Cameron Simpson wrote: > So, consider: > > @classmethod > def func(cls, foo): > print(foo) > > A linter will warn you that "cls" is unused. With a static method: > > @staticmethod > def func(foo): > print(foo) > > a linter will

[Python-ideas] Re: argparse.py in version 3.8.2 Action=Custom ActionClass needs an option to have methods

2020-09-10 Thread 2QdxY4RzWzUUiLuE
On 2020-09-10 at 11:45:37 -, rangap...@gmail.com wrote: > Got the argparse() in version 3.8.2 and above the action=CusotmClass > can have a user defined custom subclass and override the functionality > in the def __init__() method. Along with this can we also have a built > in custom

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

2020-08-28 Thread 2QdxY4RzWzUUiLuE
On 2020-08-28 at 08:41:04 -0400, Regarding "[Python-ideas] Re: What about having a .get(index, default) method for arrays like we have for dicts?," Richard Damon wrote: > On 8/28/20 8:24 AM, David Mertz wrote: > > > > As a side note, I don't really get why everyone else thinks a > > try/except

[Python-ideas] Re: use type hints and slices to specify a valid numerical range, example: `Angle = int[0:361]`

2020-08-08 Thread 2QdxY4RzWzUUiLuE
On 2020-08-08 at 18:53:36 -0400, David Mertz wrote: > ... my discovery was that "LLVM figures out Gauss' simplification and > does it in constant time no matter the N. After that I looked at the > LLVM bytecode to see, "Yup, it does." The optimizer is pretty smart > about variations in writing

[Python-ideas] Re: Changing item dunder method signatures to utilize positional arguments (open thread)

2020-08-05 Thread 2QdxY4RzWzUUiLuE
On 2020-08-04 at 10:58:51 -0400, Todd wrote: > My main issue with this is that, in my opinion, dunders are not > something a beginner should be messing with anyway. By the time > someone is experienced enough to start working on this, they are also > experienced enough to understand that

[Python-ideas] Re: Idea: Extend "for ... else ..." to allow "for ... if break ..." else

2020-07-29 Thread 2QdxY4RzWzUUiLuE
On 2020-07-29 at 07:09:05 -0700, Guido van Rossum wrote: > I honestly and strongly believe that we should do nothing here. Python > thrives because it is relatively simple. Adding new syntax to deal > with looping special cases makes it less simple, and encourages a bad > coding style (nested

[Python-ideas] Re: Thoughts about implementing object-compare in unittest package?

2020-07-29 Thread 2QdxY4RzWzUUiLuE
On 2020-07-29 at 14:26:25 +0900, "Stephen J. Turnbull" wrote: > 2qdxy4rzwzuui...@potatochowder.com writes: > > > in order to foil suck attacks. > > Typo of the Year candidate! (It was a typo, right?) Call it a Freudian slip of the fingers. ___

[Python-ideas] Re: Thoughts about implementing object-compare in unittest package?

2020-07-28 Thread 2QdxY4RzWzUUiLuE
On 2020-07-28 at 15:58:58 -0700, Christopher Barker wrote: > But a dict always has a LOT fewer buckets than possible hash values, > so clashes within a bucket are not so rare, so equality needs to be > checked always -- which is what I was missing. > And while it wouldn't break anything, having

[Python-ideas] Re: default parameter in fuctions to clean up flow

2020-07-28 Thread 2QdxY4RzWzUUiLuE
On 2020-07-28 at 11:04:25 -0300, "Joao S. O. Bueno" wrote: > Anyway, that is feasible via a decorator. > Since it can't be done the wya you are proposing as is, since > having a function as a default argument is valid Python > (and the function is not called) - and > having new syntax for this

[Python-ideas] Re: Faster object representation for UIs

2020-07-24 Thread 2QdxY4RzWzUUiLuE
On 2020-07-24 at 15:10:46 -, Gábor Bernát wrote: > ... Sometimes users have many really large objects, and when debugger > is trying to show them in Variables View (=show their string > representation) it can takes a lot of time. We do some tricks, but > they not always work. It would be

[Python-ideas] Re: Add builtin function for min(max())

2020-07-04 Thread 2QdxY4RzWzUUiLuE
On 2020-07-05 at 12:18:54 +0900, "Stephen J. Turnbull" wrote: > Which suggests the question: Is there a commonly used equivalent for > complex numbers? How would that work? Complex numbers are unordered, but I suspect that you know that. Dan ___

[Python-ideas] Re: Add builtin function for min(max())

2020-07-04 Thread 2QdxY4RzWzUUiLuE
On 2020-07-04 at 20:33:36 +0100, Regarding "[Python-ideas] Re: Add builtin function for min(max())," Henk-Jaap Wagenaar wrote: > On Sat, 4 Jul 2020 at 19:58, Christopher Barker wrote: > > > Hmm. > > > > > > Since NaN is neither greater than nor less that anything, it seems the > > only correct

Re: [Python-ideas] Why is design-by-contracts not widely

2018-09-28 Thread 2qdxy4rzwzuuilue
On 9/28/18 12:45 PM, Steven D'Aprano wrote: On Tue, Sep 25, 2018 at 09:59:53PM +1000, Hugh Fisher wrote: C and Python (currently) are known as simple languages. o_O That's a usage of "simple" I haven't come across before. Especially in the case of C, which is a minefield of