[Yury Selivanov ]
> This is interesting. Even "as is" I prefer this to PEP 572. Below are some
> comments and a slightly different idea inspired by yours (sorry!)
That's fine :-)
> It does look like a function call, although it has a slightly different
> syntax. In regular calls we don't allow po
On 28 April 2018 at 02:18, Eric Snow wrote:
> On the plus side, it means one less thing for programmers to do. On
> the minus side, I find the imports at the top of the file to be a nice
> catalog of external dependencies. Implicitly importing submodules
> would break that.
>
> The idea might b
Hi Tim,
This is interesting. Even "as is" I prefer this to PEP 572. Below are some
comments and a slightly different idea inspired by yours (sorry!)
On Fri, Apr 27, 2018 at 10:41 PM Tim Peters wrote:
[..]
> As an expression, it's
> "local" "(" arguments ")"
> - Because it "looks like" a f
A brain dump, inspired by various use cases that came up during the
binding expression discussions.
Idea: introduce a "local" pseudo-function to capture the idea of
initialized names with limited scope.
As an expression, it's
"local" "(" arguments ")"
- Because it "looks like" a function c
On Fri, Apr 27, 2018 at 04:24:35PM -0400, Wes Turner wrote:
> if ((1) or (x := 3)):
> if ((y := func(x)) if x else (x := 3))
Wes, there is *absolutely nothing new* here. This sort of error is
already possible in Python.
Do you see a lot of code like:
if (1 or sequence.append(3) or sequence
When I teach decorators, I start with a "logged" decorator example:
https://uwpce-pythoncert.github.io/PythonCertDevel/modules/Decorators.html#an-example
def logged_func(func):
def logged(*args, **kwargs):
print("Function {} called".format(func.__name__))
if args:
> On 2018 Apr 27 , at 9:05 a, Steven D'Aprano wrote:
>
> Actually, I think I can think of a way to make this work, if we're
> willing to resurrect some old syntax.
>
> On Fri, Apr 27, 2018 at 09:27:34PM +1000, Steven D'Aprano wrote:
>> I think that this is either a great idea or pointless, dep
On Fri, Apr 27, 2018 at 5:14 AM, Nick Coghlan wrote:
> Taking this idea in a completely different direction: what if we were
> to take advantage of PEP 451 __spec__ attributes to enhance modules to
> natively support implicit on-demand imports before they give up and
> raise AttributeError? (Essen
On Thu, Apr 26, 2018 at 7:51 AM, Nick Coghlan wrote:
> On 26 April 2018 at 23:37, Paul Moore wrote:
>> What are the benefits of this over a simple "import "?
>
> Forcing submodule imports would be the main thing, as at the moment,
> you have to choose between repeating the base name multiple time
On 27/04/2018 12:14, Nick Coghlan wrote:
> On 27 April 2018 at 01:22, Serhiy Storchaka wrote:
>> I think this special cases isn't special enough to introduce a special
>> syntax.
>
> While I'm mostly inclined to agree, I do think it would be nice to
> have a clean spelling for "ensure this modu
I've had a 'dprint' in sitecustomize for years. It clones 'print' and adds
a couple of keyword parameters, 'show_stack' and 'depth', which give
control over traceback output (walks back up sys._getframe for 'depth'
entries). It returns the final argument if there is one, otherwise None.
It can be
Actually, I think I can think of a way to make this work, if we're
willing to resurrect some old syntax.
On Fri, Apr 27, 2018 at 09:27:34PM +1000, Steven D'Aprano wrote:
> I think that this is either a great idea or pointless, depending on what
> the built-in actually does.
>
> If all it does i
On Fri, Apr 27, 2018 at 9:27 PM, Steven D'Aprano wrote:
> Obviously dp() would have to be magic. There's no way that I know of for
> a Python function to see the source code of its own arguments. I have no
> idea what sort of deep voodoo would be required to make this work. But
> if it could work,
On 27 April 2018 at 21:27, Steven D'Aprano wrote:
> Obviously dp() would have to be magic. There's no way that I know of for
> a Python function to see the source code of its own arguments. I have no
> idea what sort of deep voodoo would be required to make this work. But
> if it could work, wow,
I think that this is either a great idea or pointless, depending on what
the built-in actually does.
If all it does is literally the debug print function you give:
> # "debug print": prints and then returns its argument
> def dp(obj):
> print(repr(obj))
> return obj
then it is just a tr
On 27 April 2018 at 01:22, Serhiy Storchaka wrote:
> I think this special cases isn't special enough to introduce a special
> syntax.
While I'm mostly inclined to agree, I do think it would be nice to
have a clean spelling for "ensure this module is fully imported, but
don't bind it locally".
Ri
Hi all,
This came up in passing in one of the PEP 572 threads, and I'm curious
if folks think it's a good idea or not. When debugging, sometimes you
have a somewhat complicated expression that's not working:
# Hmm, is func2() returning the right thing?
while (func1() + 2 * func2()) < func3():
Serhiy Storchaka wrote:
27.04.18 02:12, Greg Ewing пише:
import display, event, mixer in pygame
I read this as
import display, event, mixer in pygame
pygame.display = display
pygame.event = event
pygame.mixer = mixer
del display, event, mixer in pygame
It's meant to
18 matches
Mail list logo