[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: built in to clear terminal

2020-12-28 Thread Mike Miller
On 2020-12-26 19:45, [email protected] 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-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-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: 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: 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: 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: [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: 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-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-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 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: 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: 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 -- [email protected] To unsubscribe send an emai

[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-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] 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

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] 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] 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] "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] 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] 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] 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] 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] 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] 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

[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

[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: 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-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-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: 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: 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-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-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: 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: 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: 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: 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: 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: PYTHONLOGGING env variable

2020-02-21 Thread Mike Miller
On 2020-02-21 08:45, [email protected] 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: 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: 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-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: 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: 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-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-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: 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: 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: 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: 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: 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-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-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

Re: [Python-ideas] A better interactive prompt

2016-10-25 Thread Mike Miller
Would recommend bpython, it is lighter-weight and accessible to newbies, in the sense that a manual is not needed. It just starts helping out as you type. http://bpython-interpreter.org/ ___ Python-ideas mailing list [email protected] https://m

Re: [Python-ideas] Is it Python 3 yet?

2017-02-06 Thread Mike Miller
Hmm, agreed. BTW, I think the current download page is *way* too complicated for new comers. There should be a giant button for the latest 3.x/64 (platform sniffed), and below it a more subtle button for the "LTS" 2.X/32. The rest of the choices and text should be pushed to another page marked

Re: [Python-ideas] Optional parameters without default value

2017-03-02 Thread Mike Miller
Agreed, I've rarely found a need for a "second None" or sentinel either, but once every few years I do. So, this use case doesn't seem to be common enough to devote special syntax or a keyword to from my perspective. But, I'll let you know my secret. I don't make my own sentinel, but rather u

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

2017-04-25 Thread Mike Miller
Agreed with Steven, although I do find myself a little more annoyed and bothered by a typical init than him I guess. Even so I didn't think the current proposals went far enough. To tilt the balance farther, to make it easier, let's go all the way! Instead of continuing duplication: >>> d

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

2017-04-25 Thread Mike Miller
On 2017-04-25 14:15, Brice PARENT wrote: But, any of these proposals, mine and yours, if you really need this to shorten the code writing time or vertical space only, is not a better idea than to propose a macro to your IDE editor, or a pull request if it's open source. Such a macro would gener

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

2017-04-26 Thread Mike Miller
On 2017-04-25 15:30, Erik wrote: All of the decorators (or other language tricks that modify the object's dict) suggested so far assume that ALL of the method's arguments are to be assigned. I do not want that. I want to be able to say: def __init__(self, foo, bar, baz, spam): self .= foo, b

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

2017-04-26 Thread Mike Miller
On 2017-04-26 04:12, Brice PARENT wrote: Why not simply do this : class MyClass: def _set_multiple(self, **kwargs): for key, value in kwargs.items(): setattr(self, key, value) def __init__(self, a, b, c): self._set_multiple(a=a, b=b, c=c) If the goal is to

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

2017-04-26 Thread Mike Miller
On 2017-04-25 15:05, Paul Moore wrote: It seems to me that the number of people for whom both of the following hold: 1. Writing out the assignments "longhand" is an unacceptable burden. 2. Using a decorator (which can be written directly in your project, doesn't even need to be an external depe

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

2017-04-26 Thread Mike Miller
Yes, I like it too. Removes the triple repetition, and has precedent in the other languages. On 2017-04-26 12:54, Jerry Hill wrote: On Tue, Apr 25, 2017 at 8:05 PM, Ryan Gonzalez wrote: def ___init__(self, self.attr): I'm not a python developer, I'm just a developer that uses python. That

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

2017-04-28 Thread Mike Miller
On 2017-04-28 06:07, Nick Coghlan wrote: …the root cause (writing imperative initialisers is still part of the baseline recommendation for writing classes, and we don't offer any supporting infrastructure for avoiding that directly in the standard library) For a *lot* of classes, what we want t

Re: [Python-ideas] Security: remove "." from sys.path?

2017-06-04 Thread Mike Miller
I'd like to throw some cold water on this one, for the same reason I always add "." to the path in my shell, when some well-meaning soul has removed it. Why? It's 2017 and I've not shared a machine since the 1980's. I use immutable containers in the cloud that are not at this particular risk

Re: [Python-ideas] + operator on generators

2017-06-27 Thread Mike Miller
On 2017-06-25 20:23, Steven D'Aprano wrote: > I have a counter-proposal: introduce the iterator chaining operator "&": > > iterable & iterable --> itertools.chain(iterable, iterable) > I like this suggestion. Here's another color that might be less controversial: iterable3 = iterable1

Re: [Python-ideas] + operator on generators

2017-06-27 Thread Mike Miller
On 2017-06-27 14:02, David Mertz wrote: iterable3 = iterable1.chain(iterable2) How do you chain it1, it2, it3, etc? Why not: iterable5 = iterable1.chain(iterable2, iterable3, iterable4) ? i.e. Couldn't a class method do this with itertools.chain() under the hood?

Re: [Python-ideas] + operator on generators

2017-06-27 Thread Mike Miller
On 2017-06-27 14:05, Brendan Barnwell wrote: Even if this "chain" only took one argument, you could do it1.chain(it2).chain(it3). But I don't see why it couldn't take multiple arguments as you suggest. Right, and as I forgot to mention, making it a built-in is an uphill battle with h

Re: [Python-ideas] namedtuple literals [Was: RE a new namedtuple]

2017-07-26 Thread Mike Miller
Many times in the olden days when I needed a bag o' attributes to be passed around like a struct I'd make a dummy class, then instantiate it. (A lot harder than the javascript equivalent.) Unfortunately, the modern Python solution: from types import SimpleNamespace as ns is only a few ch

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

2017-07-27 Thread Mike Miller
I've never liked that error message either: >>> object().foo = 'bar' Traceback (most recent call last): File "", line 1, in AttributeError: 'object' object has no attribute 'foo' Should say the "object is immutable," not writable, or something of the sort. On 2017-07-27 09:

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

2017-07-28 Thread Mike Miller
On 2017-07-27 18:02, Chris Angelico wrote: > As Ivan said, this is to do with __slots__. It's nothing to do with > immutability: >>> object().__slots__ Traceback (most recent call last): File "", line 1, in AttributeError: 'object' object has no attribute '__slots__' >>> object().__dict__ T

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

2017-07-28 Thread Mike Miller
That's a subclass. Also: >>> class A(list): __slots__ = () ... >>> >>> a = A() >>> a.foo = 'bar' Traceback (most recent call last): File "", line 1, in AttributeError: 'A' object has no attribute 'foo' -Mike On 2017-07-28 01:06, Antoine Rozo wrote: > If an object has no slots or dict and

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 [email protected] https://mail.python.org/mailman/listinfo/python-

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

[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] 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

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
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
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-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-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] 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] 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] 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 [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http:

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] 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] 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] 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-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
Interesting, thanks. On 2018-04-02 15:03, Guido van Rossum wrote: ___ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] 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-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-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] 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] 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-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] __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

[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

  1   2   >