Yeah it makes sense the default_factory argument in the field object could be
utilized to support early bound defaults.
> On 26 Nov 2021, at 10:42 PM, Christopher Barker wrote:
>
> dataclasses use Field objects that can be created automatically, but also you
> can specify them if you need to
I like the "obj -> func1 -> func2” idiom If func1 and func2 take only one
argument.
If func1 takes two arguments (arg1, arg2), it would be like the following:
obj -> func1(arg2) -> func2.
Suppose you want to insert the returned object not as a first argument. We
could do something like the f
> > But I guess since method chaining (for collection pipeline) is more
> > commonplace across many languages, it might be easier to catch on.
> We should be careful about the terminology. Method chaining and
> pipelining are related, but independent, design patterns or idioms:
Noted and thank yo
On Sat, Nov 27, 2021 at 02:58:07AM -, Raimi bin Karim wrote:
> This syntactic sugar imo is powerful because it's not limited to iterables
> but generalises to possibly any object.
Indeed. There is no reason to limit pipelines to only collections, any
object which can be transformed in any w
> To me, the most natural syntax looks like this:
> value | function *args, **kwargs
> equivalent to `function(value, *args, **kwargs)` but of course we've
> already used the pipe for bitwise-or and set intersection. `>>` would be
> another equally good operator. I don't really like `|>` as an op
> I'm somewhat ambivalent about this pattern. Sometimes I find it
> readable and natural, other times it doesn't fit my intuition for the
> problem domain.
Like any other pattern, you don't have to subscribe to it and use it
to solve every problem. A pattern is just another tool in your toolbox
tha
On Fri, Nov 26, 2021 at 07:40:43PM +, Paul Moore wrote:
> On Fri, 26 Nov 2021 at 14:39, Raimi bin Karim wrote:
>
> > So this is more of a heartfelt note rather than an objective one — I would
> > love
> > my fellow Python programmers to be exposed to this mental model, and that
> > could onl
On 11/26/2021 7:36 PM, Greg Ewing wrote:
On 27/11/21 11:34 am, Eric V. Smith wrote:
Would adding something to the Iterator ABC really also add it to my
class Foo?
...
As a consequence, there is strong pressure to keep the number of
required methods to a minimum. It also means that adding re
On Fri, Nov 26, 2021 at 4:12 PM Eric V. Smith wrote:
> Another note: I'm not recommending it, but we could add a bunch of things
> to the Iterator ABC, and then it could be available everywhere.
>
> Is that true? I'm genuinely curious.
>
> I have lots of code with is the logical equivalent of:
>
On 27/11/21 11:34 am, Eric V. Smith wrote:
Would adding something to the Iterator ABC really also add it to my
class Foo?
No, your class would need changing to inherit from the Iterator ABC.
This is a big problem in general with "just add it to the ABC" ideas.
A huge number of existing classe
On 11/26/2021 1:59 PM, Christopher Barker wrote:
Just a note here:
On Fri, Nov 26, 2021 at 6:37 AM Raimi bin Karim
wrote:
to improve readability of chaining lazy
functions (map, filter, etc.) for iterables.
I think there is a slight misperception here. I've seen the term lazy
used
Ah yes, it's pipeop ! https://pypi.org/project/pipeop/
On Fri, 26 Nov 2021 at 22:39, Evpok Padding wrote:
> > . In fact, I'd be
> > pretty certain that something like this probably already exists on
> > PyPI, but I wouldn't know how to find it.
>
> It's supported with several syntaxes in macropy
> . In fact, I'd be
> pretty certain that something like this probably already exists on
> PyPI, but I wouldn't know how to find it.
It's supported with several syntaxes in macropy (
https://pypi.org/project/MacroPy/) but I remember seeing it in a more
serious (for lack of a better term) package t
On 26Nov2021 16:00, eyalgr...@gmail.com wrote:
>i wonder whether:
>
>from myutils import myprint as print
>
>or
>
>_print = print
>print = myprint
>
>is really the pythonic way?
Well, I prefer the former - short and clear. You can always get the
"old" print from the builtins module. In the setup
On Fri, 26 Nov 2021 at 14:39, Raimi bin Karim wrote:
> So this is more of a heartfelt note rather than an objective one — I would
> love
> my fellow Python programmers to be exposed to this mental model, and that
> could only be done by implementing it in the standard library.
I'm somewhat ambi
Just a note here:
On Fri, Nov 26, 2021 at 6:37 AM Raimi bin Karim
wrote:
> to improve readability of chaining lazy
> functions (map, filter, etc.) for iterables.
I think there is a slight misperception here. I've seen the term lazy used
a couple times, and at least once in contrast to list comp
dataclasses use Field objects that can be created automatically, but also
you can specify them if you need to do something special. And one of the
special things you can do is set a default constructor -- I'm sure that
could be extended to support early bound defaults.
-CHB
On Thu, Nov 25, 2021
> You've never used the interactive interpeter? *wink*
All of the responses here have been really helpful to read, but this line is
the clearest. I'm almost certain I have used this syntax in the interpreter,
but I spend so much time in editors I forgot about that use case.
Thanks for the clari
On Sat, Nov 27, 2021 at 3:03 AM wrote:
>
> i wonder whether:
>
> from myutils import myprint as print
>
> or
>
> _print = print
> print = myprint
>
> is really the pythonic way?
Seems fine to me, what's unpythonic about it?
> my use case for multiple files on top of the stdout, is when using e.g
i wonder whether:
from myutils import myprint as print
or
_print = print
print = myprint
is really the pythonic way?
my use case for multiple files on top of the stdout, is when using e.g. wandb
which is a popular ML dashboard and experiment logging platform. i want to
write my log file both
On Sat, Nov 27, 2021 at 1:39 AM Raimi bin Karim wrote:
> So this is more of a heartfelt note rather than an objective one — I would
> love
> my fellow Python programmers to be exposed to this mental model, and that
> could only be done by implementing it in the standard library.
I'm not certain
(Fyi I am both 'Remy' and 'Raimi bin Karim', I don't know how that happened).
📌Goal
Based on the discussion in the past few days, I’d like to circle back to my
first
post to refine the goal of this proposal: to improve readability of chaining
lazy
functions (map, filter, etc.) for iterables. T
22 matches
Mail list logo