Re: [Python-ideas] Option of running shell/console commands inside the REPL

2019-02-01 Thread Ken Hilton
Hi, As a workaround/alternative, you can just do >>> import os >>> os.system('dir') Sincerely, Ken Hilton; ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python

[Python-ideas] Make None a subclass of int [alternative to iNaN]

2018-09-29 Thread Ken Hilton
, int) is True I know this is a crazy idea, but I thought it could have some merit, so why not throw it out here? Sharing, Ken Hilton; ___ 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] Add .= as a method return value assignment operator

2018-09-27 Thread Ken Hilton
not an issue, though, since Python is not PHP. Anyway, I fully support this idea. Sincerely, Ken Hilton; ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

[Python-ideas] Make "yield" inside a with statement a SyntaxError

2018-08-07 Thread Ken Hilton
that results are undefined when doing so; this will simply make it more obvious that suspending execution in a with block is not meant to happen, and convert undefined behavior into a straight-up SyntaxError. What are your thoughts? Sharing, Ken Hilton;

[Python-ideas] With expressions

2018-08-02 Thread Ken Hilton
range(4)] grid[i][i] = 4 Is this a good idea? Are there some subtleties I've failed to explain? Please let me know. Sharing, Ken Hilton ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

[Python-ideas] Make import an expression

2018-07-14 Thread Ken Hilton
math).tan(math.radians(45)) #math.radians is valid because (import math) binds "math" to the current scope What are your thoughts? Sharing, Ken Hilton; ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

[Python-ideas] Dedicated string concatenation operator

2018-06-20 Thread Ken Hilton
>>> 56 @ "str1" #str would also have __rmatmul__ "56str1" >>> content = "foobar" >>> content @= "bazbang" >>> content @= "running out of ideas" >>> content 'foobarbazbangrunn

[Python-ideas] Multiple replacement in one call [was: Give regex operations more sugar]

2018-06-14 Thread Ken Hilton
Just changing the subject line here, to keep things on topic Sincerely, Ken; -- Forwarded message - Date: Thu, 14 Jun 2018 17:29:03 +1000 From: Steven D'Aprano To: python-ideas@python.org ​​ Subject: Re: [Python-ideas] Give regex operations more sugar Message-ID: <20180614072902.

[Python-ideas] Give regex operations more sugar

2018-06-13 Thread Ken Hilton
Hi all, Regexes are really useful in many places, and to me it's sad to see the builtin "re" module having to resort to requiring a source string as an argument. It would be much more elegant to simply do "s.search(pattern)" than "re.search(pattern, s)". I suggest building all regex operations int

Re: [Python-ideas] Let try-except check the exception instance

2018-05-31 Thread Ken Hilton
caught(exc) finally: if always is not None: always() Perhaps you could make use of this? Suggesting, Ken Hilton; ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python

Re: [Python-ideas] Make asyncio.get_event_loop a builtin

2018-05-24 Thread Ken Hilton
? As far as I know, "async def" is a shorthand for @asyncio.coroutine def and "await" is short for "yield from". Sincerely, Ken Hilton; ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/

[Python-ideas] Make asyncio.get_event_loop a builtin

2018-05-22 Thread Ken Hilton
Hi all, Just a simple idea I wanted to bring forth. Although I know that you get a lot more asyncio control by importing the asyncio module itself, I'd like to see a way to make simple asynchronous applications without ever importing asyncio itself. To that end, I propose making asyncio.get_event_

Re: [Python-ideas] String and bytes bitwise operations

2018-05-18 Thread Ken Hilton
dea. ​Thinking, Ken Hilton;​ ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

[Python-ideas] Make keywords KEYwords only in places they would have syntactical meaning

2018-05-18 Thread Ken Hilton
visionError, lambda: 0/1) 0.0 >>> import asyncio as await #this is already currently legal, but will not be in the __future__ >>> async def async(def): ... return await await.get_event_loop().run_in_executor(None, def) ... >>> And so on. What

Re: [Python-ideas] String and bytes bitwise operations

2018-05-17 Thread Ken Hilton
gs. > But XORing bytes seems perfectly reasonable. Bytes are numbers, even if we display them as ASCII characters. My thought exactly. On Thu, 17 May 2018 22:20:43 +1000, Steven D'Aprano wrote: > What if the strings are unequal lengths? (out-of-order quote lol) Then the operators would ra

[Python-ideas] String and bytes bitwise operations

2018-05-17 Thread Ken Hilton
string: >>> 'HELLO' ^ 'world' '?*> +' or bytestring: >>> b'HELLO' ^ b'world' b'?*> +' (All of this applies to other bitwise operators, of course.) Compatibility issues are a no-brainer - curre

[Python-ideas] Yet another idea for assignment expressions

2018-05-01 Thread Ken Hilton
Hi all, I've been following the discussion of assignment expressions and what the syntax for them should be for awhile. The ones that seem to crop up most are the original spelling, :=, the "as" keyword (and variants including it), and the recently "local" pseudo-function idea. I have another ide

Re: [Python-ideas] A way to subscript a single integer from bytes

2018-05-01 Thread Ken Hilton
Whoops! Never seen that before. Nothing I searched up pointed me to it. Sorry for wasting your time! Ken; -- Sincerely, Ken; ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: htt

[Python-ideas] A way to subscript a single integer from bytes

2018-05-01 Thread Ken Hilton
Hi all, So I'm pretty sure everyone here is familiar with how the "bytes" object works in Python 3. It acts mostly like a string, with the exception that 0-dimensional subscripting (var[idx]) returns an integer, not a bytes object - the integer being the ordinal number of the corresponding charact

Re: [Python-ideas] A "local" pseudo-function

2018-04-28 Thread Ken Hilton
actually almost equivalent to defining an anonymous function and executing it immediately, i.e. this: (lambda x=5: x*x)() would be equivalent to this: local (x=5) { return x * x } both evaluating to 25. Just some random thoughts! Sincerely, Ken ​ Hilton​ ; __

Re: [Python-ideas] Should __builtins__ have some kind of pass-through print function, for debugging?

2018-04-28 Thread Ken Hilton
- i.e. "end", "file", and so on. IMO it should, as the only difference is that "dprint" returns its first argument while "print" returns None. But what are your thoughts? Sincerely, Ken ​ Hilton​ ; ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

[Python-ideas] Idea: Importing from arbitrary filenames

2018-04-13 Thread Ken Hilton
d? Allowing the error to pass through would almost certainly be unexpected behavior; attempting to use a parent class's __str__ method would take more time and more processing power (though it would eventually reach "object"'s __str__ method and succeed). Therefore, non-string exp