Calvin Spealman wrote:
You know what, I /can't/ think of other good examples than slightly
improved decorators. So, maybe its not that great an idea if it can't be
applied to at least a few more use cases.
The class version might be useful for things like namedtuple
that dynamically create cla
On Thu, Oct 25, 2018 at 08:44:44AM -0400, Calvin Spealman wrote:
> On Wed, Oct 24, 2018 at 4:41 PM Steven D'Aprano wrote:
[...]
> > I *think* you are proposing the following syntax. Am I right?
> >
> >
> > return def (func):
> > # body of func
> >
> > which is equivalent to:
> >
> > def func:
On Thu, Oct 25, 2018 at 7:41 AM Calvin Spealman wrote:
>
> On Thu, Oct 25, 2018 at 9:28 AM Anders Hovmöller
> wrote:
>
>> [Calvin]
>> > The point is not saving a line or typing, but saving a thought.
>> Expressing the intent of the factory function more clearly.
>>
> [...]
> You know what, I *c
On Thu, Oct 25, 2018 at 9:28 AM Anders Hovmöller
wrote:
>
> > The point is not saving a line or typing, but saving a thought.
> Expressing the intent of the factory function more clearly.
>
> Could you give some other usage examples?
>
> To me it seems like a nicer and less confusing way to creat
> The point is not saving a line or typing, but saving a thought. Expressing
> the intent of the factory function more clearly.
Could you give some other usage examples?
To me it seems like a nicer and less confusing way to create decorators is
warranted but could then be more specialized an
On Wed, Oct 24, 2018 at 4:41 PM Steven D'Aprano wrote:
> On Wed, Oct 24, 2018 at 09:18:14AM -0400, Calvin Spealman wrote:
> > I'd like to suggest what I think would be a simple addition to `def` and
> > `class` blocks. I don't know if calling those "Assignment Blocks" is
> > accurate, but I just
On 25/10/2018 02:15, Virendra Tripathi wrote:
In addition to what GVR wrote, a generator function would have to have its
own syntax - backward compatibility would be another issue.
No it wouldn't. This is about returning the function/generator/class
itself, not its results.
I still don't th
The idea is okay, but I'm not keen about the syntax, because it
doesn't read well as English. Currently "def" can be read as
the verb "define", but "return define" doesn't make sense.
Maybe it would be better as a pseudo-decorator:
@return
def f(args):
...
But I'm inclined to ag
In addition to what GVR wrote, a generator function would have to have its
own syntax - backward compatibility would be another issue.
Virendra Tripathi
Santa Clara, CA
415-910-4955
trip...@gmail.com
On Wed, Oct 24, 2018 at 2:31 PM Greg Ewing
wrote:
> Calvin Spealman wrote:
>
> > def ignore
Calvin Spealman wrote:
def ignore_exc(exc_type):
return def (func):
> ...
Something very similar has been suggested before, you might
like to review the previous discussion.
--
Greg
___
Python-ideas mailing list
Python-ideas@python.org
On Wed, Oct 24, 2018 at 09:18:14AM -0400, Calvin Spealman wrote:
> I'd like to suggest what I think would be a simple addition to `def` and
> `class` blocks. I don't know if calling those "Assignment Blocks" is
> accurate, but I just mean to refer to block syntaxes that assign to a name.
> Anyway,
On Wed, Oct 24, 2018 at 7:55 AM Rhodri James wrote:
> On 24/10/2018 15:04, Calvin Spealman wrote:
> > My idea is not "assignment blocks" those already exist. `def` and `class`
> > blocks are both syntaxes that assign to some name. I'm just using the
> term
> > to refer to them as a group.
> >
> >
On 24/10/2018 15:04, Calvin Spealman wrote:
My idea is not "assignment blocks" those already exist. `def` and `class`
blocks are both syntaxes that assign to some name. I'm just using the term
to refer to them as a group.
The proposal is just being able to return them. These two examples become
My idea is not "assignment blocks" those already exist. `def` and `class`
blocks are both syntaxes that assign to some name. I'm just using the term
to refer to them as a group.
The proposal is just being able to return them. These two examples become
equivalent:
def ignore_exc(exc_type):
ret
Would you mind providing a bit more details about your proposal?
What exactly are those "Assignment Blocks" supposed to do?
If I understand your proposal correctly you want this:
def my_func():
return def():
print("abc")
to be the same as this:
def my_func():
def inner_func():
I'd like to suggest what I think would be a simple addition to `def` and
`class` blocks. I don't know if calling those "Assignment Blocks" is
accurate, but I just mean to refer to block syntaxes that assign to a name.
Anyway, I propose a combined return-def structure, and optionally also
allowing a
16 matches
Mail list logo