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-ideas Cod

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

2018-09-30 Thread Ken Hilton
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
ue, 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-08 Thread Ken Hilton
mply 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 mailing list Python-ideas@python.org ht

[Python-ideas] With expressions

2018-08-02 Thread Ken Hilton
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
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
tr would also have __rmatmul__ "56str1" >>> content = "foobar" >>> content @= "bazbang" >>> content @= "running out of ideas" >>> content 'foobarbazbangrunning out of ideas' However, the operator does

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

[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

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-ideas Code of

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

2018-05-24 Thread Ken Hilton
s 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/listinfo/p

[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

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
Error, 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 are your thoughts? ​Sharing,

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

2018-05-17 Thread Ken Hilton
hu, 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 raise a ValueError. (Assuming bytestrings, since again, I'm dropping text strings.) ​Sharing ideas​ , Ken ​ Hilton​ ; _

[Python-ideas] String and bytes bitwise operations

2018-05-17 Thread Ken Hilton
>>> b'HELLO' ^ b'world' b'?*> +' (All of this applies to other bitwise operators, of course.) Compatibility issues are a no-brainer - currently, bitwise operators for strings raise TypeErrors. Thanks. Suggesting, Ken ​ Hilton​ ; ___

[Python-ideas] Yet another idea for assignment expressions

2018-05-02 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

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:

[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

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

2018-04-28 Thread Ken Hilton
n 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​ ; ___ Python-ide

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

2018-04-28 Thread Ken Hilton
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
ting 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 expression values should raise TypeError. What are your thoughts? ​Regards , Ken ​ Hilton​ ; _