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
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
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
> 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
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
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
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 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):
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
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
13 matches
Mail list logo