[Python-ideas] Re: Bare wildcard in de-structuring to ignore remainder and stop iterating (restart)

2022-06-20 Thread Mike Miller
On 2022-06-20 03:34, Paul Moore wrote: For the record, I think the islice solution is sufficient for this case. But I have needed this sort of thing occasionally, and islice The post above sums it up for me. We have next() for one to a few, islice for several to zillions, and a for-enumera

[Python-ideas] Re: Bare wildcard in de-structuring to ignore remainder and stop iterating (restart)

2022-06-19 Thread Mike Miller
My first thought was next(), which I use occasionally: >>> items = (i for i in range(9)) >>> items at 0x7f33251766d0> >>> first, second = next(items), next(items) # đź‘€ >>> first, second (0, 1) >>> tuple(items) (2, 3, 4, 5, 6, 7, 8) No imports needed. Is this

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

2022-04-06 Thread Mike Miller
On 2022-04-06 12:36, Paul Moore wrote: And if new syntax is a clear win even with such a library, then designing a language feature that enables better syntax for that library would still be possible (and there would be a clear use case for it, making the arguments easier to make). If folks

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

2022-03-14 Thread Mike Miller
On 2022-03-09 19:42, wfdc via Python-ideas wrote: Add a "replace" method to tuples that returnsa new tuple with the element at a given index replaced with a given value. Hmm, no one appears to have mentioned DateTime.replace(). Did I miss it? https://docs.python.org/3/library/datetime.h

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

2021-11-13 Thread Mike Miller
I like this idea and disappointed it always gets a negative reaction. One of my biggest peeves is this: import datetime # or from datetime import datetime Which is often confusing... is that the datetime module or the class someone chose at random in this module? A minor thorn that

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

2021-10-27 Thread Mike Miller
On 2021-10-25 15:59, Steven D'Aprano wrote: None of them are passed twice. Yes, the word "passed" misses the mark. *Moving* code from one place to another isn't *repeating* the code. I think that captures the problem nicely. This is already possible in a much clearer way. I'd still a

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

2021-10-25 Thread Mike Miller
On 2021-10-23 17:13, Chris Angelico wrote: def bisect_right(a, x, lo=0, hi=>len(a), *, key=None): Sounds like deferred execution could be useful, but I wanted to complain about the example above. I realize it is "just an example" but if I saw this in code, the first thing I'd do is a

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

2021-10-25 Thread Mike Miller
On 2021-10-25 11:27, Ethan Furman wrote: - `deferred` soft keyword "defer" please. This construct did not happen in the past, and it's shorter of course. -Mike ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an emai

[Python-ideas] Re: Changing The Theme of Python Docs Site

2021-05-04 Thread Mike Miller
On 4/29/21 11:06 PM, Abdur-Rahmaan Janhangeer wrote: > Greetings, > > A proposal to change the theme of the > Python docs. The current docs theme is decent I think. Liked your link to the masonite docs theme slightly better, though not hugely different. However! One thing that drives me

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

2021-04-09 Thread Mike Miller
On 2021-04-08 11:25, Chris Angelico wrote: On Fri, Apr 9, 2021 at 2:24 AM Paul Bryan wrote: Q. Safe to assume this would catch exceptions from both the call to `open` as well as the call to `open.__enter__`? No, not safe to assume. It's equally reasonable to define it as guarding only the

[Python-ideas] Re: Arrow functions polyfill

2021-02-25 Thread Mike Miller
On 2021-02-25 01:05, Steven D'Aprano wrote: On Wed, Feb 24, 2021 at 06:46:21PM -0800, Mike Miller wrote: Also, I don't believe the confusion mentioned was regarding syntax, but rather a word that most people have never heard before. When I started learning Python, back when 1.5 w

[Python-ideas] Re: [Python-Dev] Re: Have virtual environments led to neglect of the actual environment?

2021-02-25 Thread Mike Miller
On 2021-02-24 19:59, Christopher Barker wrote: I used to do that — for years. But it really did cause problems. The trick is that you have, say, your 57 apps all working. Then you need to update a package for one. As soon as you update, you have to go test your 57 apps, and if one of them is b

[Python-ideas] Re: Arrow functions polyfill

2021-02-24 Thread Mike Miller
On 2021-02-24 06:04, Random832 wrote: I have an objection to this: "def" is short for define, and a lambda does not produce a definition. This isn't just about saving keystrokes, and even if it were, saving only three would not be worth it for a syntax that is just as confusing as the existi

[Python-ideas] Re: [Python-Dev] Re: Have virtual environments led to neglect of the actual environment?

2021-02-24 Thread Mike Miller
On 2021-02-24 02:52, Stéfane Fermigier wrote: > I have currently 57 apps installed via pipx on my laptop, and the 57 > environments take almost 1 GB already. I never understood the fear around version conflicts. Perhaps it has to do with the decline of sys-admin skills over the years? So, th

[Python-ideas] Re: SimpleNamespace vs object

2021-02-22 Thread Mike Miller
On 2021-02-21 20:51, Chris Angelico wrote: In my mind, the current front-runners are: * namespace * ns * thing * mutableobject * mobject * attrobject * bunch Short and PascalCase please, to avoid collisions: * Stuff With credit to George Carlin. ;-) Some of these work as well, Kit is not

[Python-ideas] Re: Alternate lambda syntax

2021-02-15 Thread Mike Miller
On 2021-02-13 14:33, Christopher Barker wrote: On Fri, Feb 12, 2021 at 1:00 AM Brendan Barnwell > wrote:         The only thing that would be better than lambda is a less confusing keyword. There seems to be a frequent objection to the word "lambda" -- pe

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

2021-01-05 Thread Mike Miller
On 2021-01-05 20:07, Mikhail V wrote: I'd like to have an option to force the path separator for the "os.path.join()" method. The urljoin method was made for the URL use case: from urllib.parse import urljoin urljoin('http://www.cwi.nl/%7Eguido/Python.html', 'FAQ.html') 'http:/

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

2020-12-29 Thread Mike Miller
On 2020-12-29 15:07, Chris Angelico wrote: On Wed, Dec 30, 2020 at 9:57 AM Mike Miller wrote: Also, I'd argue the likelihood of a newbie clearing important work... is not very high. Disputed on the basis of having seen it all too often :) Note, I added the word *important* on pu

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

2020-12-29 Thread Mike Miller
On 2020-12-28 23:33, Stephen J. Turnbull wrote: The thing is, this is a destructive capability. In some cases it only clears the "screen" (whatever that means), which may cost you some diagnostics. Probably (but not always) you can recreate them by repeating a command from history. But in so

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

2020-12-28 Thread Mike Miller
On 2020-12-26 19:45, 2qdxy4rzwzuui...@potatochowder.com wrote: 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. >

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

2020-12-26 Thread Mike Miller
On 2020-12-22 14:01, Steven D'Aprano wrote: It seems to me that the primary use for this will be in the interactive interpreter. People are used to something like "cls" or "clear" from various shells. Using it in scripting is, I think, a secondary use-case. Given that, I think that like othe

[Python-ideas] Re: New feature

2020-10-18 Thread Mike Miller
On 2020-10-17 17:05, Eryk Sun wrote: CMD's CLS is implemented with three API calls: GetConsoleScreenBufferInfo to get the screen-buffer dimensions and default text attributes, ScrollConsoleScreenBufferW to shift the buffer out, and SetConsoleCursorPosition to move the cursor to (0,0). Would

[Python-ideas] Re: New feature

2020-10-18 Thread Mike Miller
On 2020-10-17 17:21, Eryk Sun wrote: On 10/16/20, Rob Cliffe via Python-ideas wrote: May I suggest it be called os.clearscreen()? I'd prefer shutil.clear_screen(). There's already shutil.get_terminal_size(). I know there's also os.get_terminal_size(), but its use isn't encouraged. Clear

[Python-ideas] Re: New feature

2020-10-15 Thread Mike Miller
On 2020-10-13 15:35, Guido van Rossum wrote: Can one of the educators on the list explain why this is such a commonly required feature? I literally never feel the need to clear my screen -- but I've seen this requested quite a few times in various forms, often as a bug report "IDLE does not s

[Python-ideas] Re: New feature

2020-10-13 Thread Mike Miller
On 2020-10-13 06:19, Stestagg wrote: For example, the pypi `console` library provides a method: `console.sc.reset()` that behaves similarly to `CLS` on windows and also appears to be fairly reliable cross-platform. Yes, there is more to it than appears at first glance. There is resetting t

[Python-ideas] Re: A new suggestion for Python

2020-09-30 Thread Mike Miller
On 2020-09-30 08:41, Jonatan wrote: instead of con = "some text here" con  = con.replace("here", "there") we could do con = "some text here" con .= replace("here", "there") (Your message had some odd formatting but thankfully there was a plain-text version included without the issue.) I

[Python-ideas] Re: FEATURE REQUEST: Make `logging` Module more Pythonic

2020-08-24 Thread Mike Miller
On 2020-08-24 09:25, Christopher Barker wrote: > I agree about the heavy rhetoric, but the OP has a good point. I have often > thought the same thing. Yes, many folks have. I've thought about it a bit myself. The logging package is comprehensive, mature, *very* flexible, and Java-esque. I've

[Python-ideas] Re: Python __main__ function

2020-05-30 Thread Mike Miller
On 2020-05-28 18:02, Greg Ewing wrote: If __name__ == '__main__': sys.exit(main(sys.argv[1:])) It's not clear that exiting with the return value of main() is the most Pythonic thing to do -- it's more of a C idiom that If you'd like a script to be uhh, highly-scriptable, returning one

[Python-ideas] Re: type hints : I'd like to suggest allowing unicode → as an alternative to ->

2020-05-22 Thread Mike Miller
On 2020-05-22 05:57, Joao S. O. Bueno wrote: render . However, that does not mean it will render ok as a single-cell character in a mono-spaced font - as the character "east asian width" property is marked as "A" (Ambiguous), Yes, though I'm sure no one is seriously proposing using wide, or c

[Python-ideas] Re: type hints : I'd like to suggest allowing unicode → as an alternative to ->

2020-05-21 Thread Mike Miller
On 2020-05-21 05:48, Joao S. O. Bueno wrote: Input _is_ hard or rare. Deal with it. Even the font is not uniformily configured across systems, and a glyph one does see here may not show properly on the terminal, or other Maybe long ago. My terminals support even color emoji, have for year

[Python-ideas] Re: type hints : I'd like to suggest allowing unicode → as an alternative to ->

2020-05-21 Thread Mike Miller
On 2020-05-20 14:56, Steven D'Aprano wrote: Not everyone is programming in a GUI environment all the time Well, I gave a number of examples to show there are many ways to do it. Not every example will work well for everyone. The best that works for your platform and tools should be chosen

[Python-ideas] Re: type hints : I'd like to suggest allowing unicode → as an alternative to ->

2020-05-20 Thread Mike Miller
On 2020-05-20 00:44, Chris Angelico wrote: If you think that a keyboard with fancy arrows on it will take off any quicker, you're extremely hopeful. While I'm not sure how useful this is in the long run, the oft mentioned drawback of "hard to type/view" Unicode chars isn't as insurmountable a

[Python-ideas] Re: About python3 on windows

2020-03-24 Thread Mike Miller
On 2020-03-24 11:58, Eryk Sun wrote: On 3/24/20, Mike Miller wrote: C:\Users\User>python3 (App store loads!!) If installed, the app distribution has an appexec link for "python3.exe" that actually works. C:\Python38>dir Volume in drive C has

[Python-ideas] Re: About python3 on windows

2020-03-24 Thread Mike Miller
On 2020-03-23 16:49, Brett Cannon wrote: Recently I've had to use a Windows VM for some stuff at work, where I installed Python 3 as well.  Every time I type python3 at the command-line (instead of python) to use the repl, it tries to load the Microsoft App Store! There is an opti

[Python-ideas] Re: About python3 on windows

2020-03-23 Thread Mike Miller
On 2020-03-23 10:59, Frédéric De Jaeger wrote: Hi all, There is a recurring problem Yep, that's a problem. I've built up a habit on Ubuntu where I type python3 a number of times a day, honed over several years. So far so good. Recently I've had to use a Windows VM for some stuff at work,

[Python-ideas] Re: PYTHONLOGGING env variable

2020-02-21 Thread Mike Miller
On 2020-02-21 08:45, jdve...@gmail.com wrote: Nice idea... in principle. But, what if my program has several loggers with several handlers each having its own logging info level? Would the Python's interpreter CLI argument (or the ENV variable) override all loggers and handlers logging level

[Python-ideas] Re: PYTHONLOGGING env variable

2020-02-20 Thread Mike Miller
On 2020-02-19 17:12, Bar Harel wrote: Another idea I've had that may be of use: PYTHONLOGGING environment variable. Setting PYTHONLOGGING to any log level or level name will initialize logging.basicConfig() with that appropriate level. Another option would be that -x dev or a different -x

[Python-ideas] Re: Annotated string literals

2020-02-04 Thread Mike Miller
On 2020-02-03 03:55, Soni L. wrote: On 2020-02-02 11:29 p.m., Eric V. Smith wrote: On 2/2/2020 8:28 PM, Soni L. wrote: It'd be cool to attach metadata to string literals that doesn't end up in the resulting string object. This metadata could be used by all sorts of tools, everything from lo

[Python-ideas] Re: Really long ints

2020-02-04 Thread Mike Miller
On 2020-02-04 02:37, Steven D'Aprano wrote: Sometimes I'm tempted to write numbers like that as follows: P = int('29674495668685510550154174642905332730771991' '79985304335099507553127683875317177019959423' '8596428121188033664754218345562493168782883') which is

[Python-ideas] Re: Suggestion for language addition

2019-12-04 Thread Mike Miller
On 2019-12-04 11:05, David Mertz wrote: I've often wanted named loops. I know approaches to this have been proposed many times, and they all have their own warts. E.g. an ad hoc pseudo code that may or may not match any previous proposal: for x in stuff as outer:     for y in other_stuff as

[Python-ideas] Re: Using 'with' with extra brackets for nicer indentation

2019-11-18 Thread Mike Miller
On 2019-11-18 11:24, Brendan Barnwell wrote: I agree.  I think this discussion wouldn't be necessary if there were a context manager that was like open() but opened the file in __enter__ and closed it in __exit__.  I would go so far as to say I think it would be a good idea to add such a

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

2019-11-12 Thread Mike Miller
On 2019-11-11 16:13, David Mertz wrote: I implemented this discussed arrow operator in vim with conceal plugin.  This is an example given in PEP 572.  It looks perfectly fine.  It also does not require ANY change to Python-the-language.  It just means that I can type ':' followed by '=' to get

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

2019-11-11 Thread Mike Miller
On 2019-11-10 12:50, Martin Euredjian via Python-ideas wrote: I have found that trying to explain the value of true notation to people who lack the experience and training is always a losing proposition.  I'm already regretting having started this thread, simply because I know how this works.

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

2019-11-06 Thread Mike Miller
On 2019-11-06 05:40, Andrew Barnert via Python-ideas wrote: While we’re at it, when you replace both = and := with an arrow, what do you do with += and the other augmented assignments? I can’t think of a single-character symbol that visually represents that meaning. If you leave it as + follo

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

2019-11-06 Thread Mike Miller
It's too late for this one, but I'd be open to allowing Unicode operators. It is always poo-poo'd here but there are numerous input solutions: - I enabled AltGr and a Compose key on my US keyboard, I can type symbols like ©, —, …, ø, ə, with two or three keystrokes, diacritics too: café. I

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-23 Thread Mike Miller
Other folks (and I earlier) have explained why we think | is the better choice, if less obvious. On 2019-10-22 21:41, Steven D'Aprano wrote: I think that is patronising to anyone, newbies and experienced programmers alike, who know and expect that merging dicts with an operator will have the sa

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-22 Thread Mike Miller
On 2019-10-18 10:23, Ricky Teachey wrote: but i'm -0 because i am very concerned it will not be obvious to new learners, without constantly looking it up, whether adding two mappings together would either: The big trade off I'm gathering from this mega-thread is that the |, |= operators are m

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-20 Thread Mike Miller
Definitely want this functionality. I'd ultimately be happy with any of the top operator spellings, with tradeoffs: + Is more obvious, especially to newcomers, consistent w. seq | Is more accurate (None or '') --> '', consistent w. set << Could learn it easily and say

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-17 Thread Mike Miller
+1 Been waiting a decade+ for this. Too bad it didn't get into 3.8. Nice work on the PEP. -Mike p.s. A another mentioned this existing syntax does allow non-string keys: >>> d1 = dict(one=1, two=2) >>> d2 = {'three':3, 4:4} >>> >>> {**d1, **d2} {'one': 1, 'two': 2, 'three': 3, 4: 4

[Python-ideas] Re: Custom string prefixes

2019-08-28 Thread Mike Miller
On 2019-08-28 01:05, Paul Moore wrote: However, I know of almost no examples of other languages that have added*user-definable* literal types (with the notable exception of Believe there is such a feature in modern JavaScript: https://developers.google.com/web/updates/2015/01/ES6-Template-S

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

2019-02-21 Thread Mike Miller
On 2/21/19 10:53 AM, Paul Ferrell wrote: I think the solution is for everyone to rotate their widescreen monitors 90° into a really tall portrait mode. :) Yep, that's what I do, but would prefer a squarer monitor so I could get two windows side by side on that one also. My old 1600x1200 4:3

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

2019-02-21 Thread Mike Miller
On 2/18/19 8:37 PM, Simon wrote: I'd like to propose an update to PEP8. Indeed, the 80 characters per line guideline is, I feel, outdated. Hi, I don't agree it is outdated. As someone who has a second 4k monitor in portrait mode to minimize scrolling (recommended), the ~80 char line limit

Re: [Python-ideas] Multi-line string indentation

2019-02-08 Thread Mike Miller
Thanks all, I'm willing to start work on a PEP, perhaps next week. Unless Marius would prefer to do it. One fly in the ointment is that I don't feel strongly about the choice of solution 1, 2, or last-minute entry. -Mike ___ Python-ideas mailing

Re: [Python-ideas] Multi-line string indentation

2019-02-07 Thread Mike Miller
Was: "Dart (Swift) like multi line strings indentation" This discussion petered-out but I liked the idea, as it alleviates something occasionally annoying. Am supportive of the d'' prefix, perhaps the capital prefixes can be deprecated to avoid issues? If not, a sometimes-optimized (or C-acc

Re: [Python-ideas] AMEND PEP-8 TO DISCOURAGE ALL CAPS

2019-02-01 Thread Mike Miller
On 1/30/19 6:07 PM, David Mertz wrote: On Wed, Jan 30, 2019, 4:23 PM Abe Dillon wrote: Consider thatmath.pi and math.e are constants that are not all caps, have you ever been tempted to re-bind those variables? I generally use 'from math import pi as PI

Re: [Python-ideas] AMEND PEP-8 TO DISCOURAGE ALL CAPS

2019-01-05 Thread Mike Miller
On 1/5/19 12:34 AM, Ivan Levkivskyi wrote: > There is. Mypy supports final names, final methods and whatnot > https://mypy.readthedocs.io/en/latest/final_attrs.html Believe this^^ is the best answer, unfortunately buried. Use typing hints for constants and tools that support them, and all-ca

Re: [Python-ideas] "while:" for the loop

2018-09-26 Thread Mike Miller
On 2018-09-25 17:46, Mikhail V wrote: I suggest allowing "while:" syntax for the infinite loop. I.e. instead of "while 1:" and "while True:" notations. I like this idea, and would have use for it. -Mike ___ Python-ideas mailing list Python-ideas@p

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

2018-09-17 Thread Mike Miller
On 2018-09-17 11:49, James Lu wrote: I agree completely. On Sep 17, 2018, at 1:16 PM, Anders Hovmöller wrote: It’s been almost a week since this “discussion” first started. Can we please stop this in the name of productive work on python-ideas? A better use of time might be to discuss mov

Re: [Python-ideas] REPL features

2018-08-22 Thread Mike Miller
On 2018-08-22 10:08, Antoine Pitrou wrote: On Wed, 22 Aug 2018 09:38:57 -0700 Chris Barker via Python-ideas On Tue, Aug 21, 2018 at 3:07 PM, Jonathan Fine wrote: Maybe this is something Python's REPL should do? To me it sounds fine to improve the REPL. Especially, being able to paste ex

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-22 Thread Mike Miller
I've often thought the same about "lambda." Although I've long since gotten used to the word, "def" without a function name seemed like a better choice, especially for beginners. +0.25 for proposal ONE However, parentheses should be allowed and lambda put on a long deprecation schedule. -M

Re: [Python-ideas] Give regex operations more sugar

2018-06-13 Thread Mike Miller
On 2018-06-13 06:33, Michel Desmoulin wrote: I often wished for findall and sub to be string methods, so +1 on that. Agreed, and there are a few string functions that could be extended (to take a sequence) to handle more cases that push folks to regex, perhaps earlier than they should.

Re: [Python-ideas] "Assignment expression" with function call-alike syntax

2018-05-23 Thread Mike Miller
On 2018-05-22 14:32, Kirill Balunov wrote: # in global scope everything works ok since locals is globals >>> while len( this( val = dummy() ) ) >= 0: ...     print(val) [0, 1] [0, 1, 2] [0, 1, 2, 3] Interesting! Although the example with a len() and mutable default ar

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

2018-05-21 Thread Mike Miller
On 2018-05-21 16:40, Steven D'Aprano wrote: Consider the link Chris sent above: https://insights.stackoverflow.com/survey/2018/#most-loved-dreaded-and-wanted The top six coincide with my list, plus TypeScript (superset of JS) and Python. I'm pretty happy with those chosen, considering. -Mik

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

2018-05-21 Thread Mike Miller
On 2018-05-21 16:50, Steven D'Aprano wrote: Your conclusion does not follow even from the limited sample of They're not going in the direction of assignment-expressions everywhere, but rather one built in to the if/while statement. Coffeescript could certainly be a good candidate, though fa

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

2018-05-21 Thread Mike Miller
On 2018-05-21 05:22, Juancarlo Añez wrote: > This is a good summary of the choices. I think the second one is a good compromise. More elegant, yet avoiding the problems with assignment-expressions available everywhere. It is true that := handles more (perhaps less-common) use cases, but s

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

2018-05-21 Thread Mike Miller
To clarify there were three main criteria, and one minor. Newer, popular/becoming industry standard, and designed to address shortcomings in previous generations. Finally, the limit of my energy when already working on a project. I also should have provided the link to the previous discussio

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

2018-05-20 Thread Mike Miller
For more background, this is the thread that inspired this one: https://mail.python.org/pipermail/python-dev/2018-April/153071.html -Mike ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas C

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

2018-05-20 Thread Mike Miller
You seem determined to throw out requirements when it suits. One of which was for newer languages. While this thread's original post was not so specific on that, in a previous post (I believe you read) defined that as created in the "last decade or so". The ones created to address shortcoming

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

2018-05-19 Thread Mike Miller
On 2018-05-19 16:00, Chris Angelico wrote: But you can't put a comparison after the assignment, if it's part of the syntax of the 'if' statement. That's not how grammar works. So you have two options: either the ONLY thing you can capture is the condition value (which you already know to be trut

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

2018-05-19 Thread Mike Miller
On 2018-05-19 06:41, Steven D'Aprano wrote: Details follow below. Thanks for this, had some more time to read it more closely. Correct me if I'm probably wrong, but most of these are not used by many. Except perhaps: - Typescript, which is constrained by a compatibility goal with JavaScri

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

2018-05-19 Thread Mike Miller
On 2018-05-18 19:14, Chris Angelico wrote: Yes, largely because it's insufficient for all but a small handful of situations. I mentioned that in the previous email. I'd argue that they are the bulk of occurrences, that's why they've been chosen as the compromise in those languages. Once the

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

2018-05-19 Thread Mike Miller
On 2018-05-18 18:10, Chris Angelico wrote: The bit that you tag on as an afterthought is actually critically important here. You have two options: 1) The 'as' is part of the syntax of the 'if' and 'while' statements; or This first choice appears the more conservative compromise that several h

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

2018-05-19 Thread Mike Miller
Also meant to mention, I didn't pick them specifically in advance to match a goal. I was mildly surprised at their similar design on that front. -Mike ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/pytho

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

2018-05-19 Thread Mike Miller
On 2018-05-19 06:41, Steven D'Aprano wrote: Thanks for writing up the summary, but you have picked a very narrow subset of new languages. One might even say a biased subset. How about these new languages? Certainly. I chose basically on whether it was well used (popular), I'd heard about it,

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

2018-05-18 Thread Mike Miller
Background: While the previous discussions about assignment-expressions (PEP 572) (abbreviated AE below) have been raging one thing that was noticeable is that folks have been looking back to C for a solution. But how are newer languages solving the problem today? Believe Ryan brought this up f

Re: [Python-ideas] __dir__ in which folder is this py file

2018-05-06 Thread Mike Miller
On 2018-05-06 19:13, Nick Coghlan wrote: Specifically, the ones I'd have in mind would be: - dirname (aka os.path.dirname) - joinpath (aka os.path.join) - abspath (aka os.path.abspath) Yes, I end up importing those in most scripts currently. Just "join" has worked fine, although I could imagi

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

2018-04-15 Thread Mike Miller
On 2018-04-12 18:03, Guido van Rossum wrote: It's a slippery slope indeed. While having to change update() alone wouldn't worry me, the subclass constructors do seem like they are going to want changing too, and that's indeed a bit much. So let's back off a bit. Not every three lines of code ne

Re: [Python-ideas] PEP 572: Assignment Expressions (post #4)

2018-04-13 Thread Mike Miller
On 2018-04-13 08:44, Steven D'Aprano wrote: So my position is: - "as" is more Pythonic and looks nicer; Yes, perhaps if typing annotations had not chosen the colon but used a whitespace delimiter instead, adding a few more colons to the source would not be an issue. But in combination, it

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

2018-04-12 Thread Mike Miller
While we're on the subject, I've tried to add dicts a few times over the years to get a new one but it doesn't work: d3 = d1 + d2 # TypeError Thinking a bit, set union is probably a better analogue, but it doesn't work either: d3 = d1 | d2 # TypeError Where the last value of any du

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

2018-04-11 Thread Mike Miller
Ok, we can haggle the finer details and I admit once you learn the syntax it isn't substantially harder. Simply, I've found the dict() a bit easier to mentally parse at a glance. Also, to add I've always expected multiple args to work with it, and am always surprised when it doesn't. Would n

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings, take three!

2018-04-10 Thread Mike Miller
If anyone is interested I came across this same subject on a blog post and discussion on HN today: - https://www.hillelwayne.com/post/equals-as-assignment/ - https://news.ycombinator.com/item?id=16803874 On 2018-04-02 15:03, Guido van Rossum wrote: IIRC Algol-68 (the lesser-known, more complic

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

2018-04-10 Thread Mike Miller
On 2018-04-09 04:23, Daniel Moisset wrote: In which way would this be different to {**mapping1, **mapping2, **mapping3} ? That's possible now, but believe the form mentioned previously would be more readable: dict(d1, d2, d3) -Mike ___ Pytho

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings, take three!

2018-04-02 Thread Mike Miller
Interesting, thanks. On 2018-04-02 15:03, Guido van Rossum wrote: ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Dart like multi line strings identation

2018-04-02 Thread Mike Miller
On 2018-04-02 11:40, MRAB wrote: OTOH, it's not like it's causing a problem. Well, not a big one, but there are arguments for keeping a language as simple as possible. Also every time an idea comes up for a string prefix, the combinatorial issue comes up again.  If we could factor out an

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings, take three!

2018-04-02 Thread Mike Miller
Yes, I first came across := when learning (Turbo) Pascal in the early 90's. However golang managed to screw it up—it only works there as a "short declaration AND assignment" operator. You can't use it twice on the same variable! Boggles the mind how experienced designers came up with that one

Re: [Python-ideas] Dart like multi line strings identation

2018-04-01 Thread Mike Miller
On 2018-04-01 05:36, Steven D'Aprano wrote: You are right that many of the prefixes can be handled by the same code: rfd rfD rFd rFD rdf rdF rDf rDF Rfd RfD RFd RFD Rdf RdF RDf RDF frd frD fRd fRD fdr fdR fDr fDR Frd FrD FRd FRD Fdr FdR FDr FDR drf drF dRf dRF dfr dfR d

Re: [Python-ideas] New PEP proposal -- Pathlib Module ShouldContain All File Operations -- version 2

2018-03-23 Thread Mike Miller
On 2018-03-23 13:47, Jason Maldonis wrote: I’ve found it odd that there doesn’t even seem to be acknowledgment among longtime python users that the current hodgepodge is pretty dysfunctional for new users. I'll acknowledge it too, just that after X years it becomes second nature as

Re: [Python-ideas] New PEP proposal -- Pathlib Module Should Contain All File Operations -- version 2

2018-03-19 Thread Mike Miller
On 2018-03-18 10:55, Paul Moore wrote: Should Path() have methods to access all file operations? No, (Counterexample, having a Path operation to set Windows ACLs for a path). Agreed, not a big fan of everything filesystem-related in pathlib, simply because it doesn't read well. Having them

Re: [Python-ideas] An alternative to PEP 572's Statement-Local Name Bindings

2018-03-04 Thread Mike Miller
Yes, thanks: [ f(y), g(y) for x, h(x) as y in things ] Dyslexics untie! On 2018-03-04 19:45, Chris Angelico wrote: ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http:

Re: [Python-ideas] An alternative to PEP 572's Statement-Local Name Bindings

2018-03-04 Thread Mike Miller
On 2018-03-03 16:51, Greg Ewing wrote: 2018-03-03 8:40 GMT+01:00 Nick Coghlan :    pairs = [(f(y), g(y)) for x in things with bind(h(x)) as y] I don't mucn like "with bind(h(x)) as y" because it's kind of like an abstraction inversion -- you're building something complicated on top of somethi

Re: [Python-ideas] Complicate str methods

2018-02-07 Thread Mike Miller
+1 I have the need for one or two of these in every project (of a certain size) and have to come up with solutions each time with the re module or a loop. Not a fan of regex's for trivial tasks, or those that require a real parser. On 2018-02-03 14:04, Franklin? Lee wrote: __

Re: [Python-ideas] Logging Levels

2017-11-29 Thread Mike Miller
Hi, IMHO the prior decision(s) are too conservative. Reading the bugs, we can see lots of folks reinventing the wheel with common use cases for no good reason. I also gave examples in the log4j, docs, and web apps world that these levels are recognized needs. An addition would represent a ve

Re: [Python-ideas] Logging Levels

2017-11-29 Thread Mike Miller
send to stdout. And with a new-file template, it isn't a burden to set it and argparse up in new scripts. (--verbose etc) -Mike On 2017-11-28 20:45, Nick Coghlan wrote: On 29 November 2017 at 06:46, Mike Miller wrote: Hi, the reason I use note is that I want it to be output by defau

Re: [Python-ideas] Logging Levels

2017-11-28 Thread Mike Miller
I think the resistance to trace is that it splits an existing level into two, supporting "level inflation." The current level name of critical is similar, describing not just an error, but a really big error! Note (as described here), handles an additional use case. I don't consider it leve

Re: [Python-ideas] Logging Levels

2017-11-28 Thread Mike Miller
Hi, the reason I use note is that I want it to be output by default. So it must be above warning, or perhaps the default level changed. (i.e. There is no need for note if it has the same effect as info. We already have info.) -Mike On 2017-11-28 12:31, Guido van Rossum wrote: OK, that's a

Re: [Python-ideas] Logging Levels

2017-11-28 Thread Mike Miller
Thanks, will do, after some time for folks to comment further. One question was how will the level integer id affect custom levels defined by applications? If a clash could cause an issue, perhaps adding it above the last one at 100(?) makes more sense. -Mike On 2017-11-28 11:45, Guido van

Re: [Python-ideas] Logging Levels

2017-11-28 Thread Mike Miller
Yes, I remember now. However, it still outputs with the level name of critical: >>> logging.fatal('hello') CRITICAL:root:hello On 2017-11-28 11:52, Mario Corchero wrote: Not sure if that is what you meant, but here is already "FATAL" which is indeed an alias of CRITICAL: >>> logging.FATA

[Python-ideas] Logging Levels

2017-11-28 Thread Mike Miller
Hi, I use the logging module extensively for even the simplest scripts, one of the reasons there's been less difficulty moving to Python 3 at work. One of the "nano features" I've often added to its config is the addition of a custom log level. Never mentioned it before because of its trivia

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

2017-11-27 Thread Mike Miller
Hmm, I didn't like the options below because they say to me, "consume everything:" x, y, * = iterable x, y, ... = iterable Believe the question behind the idea was, how to grab a couple items and then *stop?* If the syntax route is chosen, I'd expect something that tells me it is go

Re: [Python-ideas] namedtuple nit...

2017-07-28 Thread Mike Miller
Nice. Ok, so there are different dimensions of mutability. Still, haven't found any "backdoors" to object(), the one I claimed was immutable. -Mike ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-

  1   2   >