News for hackers. Stuff that matters.
Re:Brython – A Python 3 implementation for client-side web p... by red_hare on Monday July 06, 2020 @09:48AM (#23747801)
I will never understand python API developers obsession with overloading the operator magic methods.

Apache Beam is one of the worst offenders to me. The recommended method is to connect your functional transforms when building your pipeline as if it were a series Bash commands piped together (overloading bitwise OR). Who thought “oh, you know what language and API is synonymous with ‘write a large complicated amount of business logic in me’, Bash.”

Re:Brython – A Python 3 implementation for client-side web p... by pyuser583 on Monday July 06, 2020 @10:08AM (#23747987)
Your comment made me smile because Apache Beam is one of my favorite tools, but it seems nobody outside Spotify has had heard of it.

The bitwise operation dunder methods have no definition outside of integers. So they’re basically freebies to do what you want with.

Honestly I think the Apache Beam API makes a lot of sense.

Re:Brython – A Python 3 implementation for client-side web p... by red_hare on Monday July 06, 2020 @04:21PM (#23752294)
To be clear, I love Beam. It runs all of my startups stream and batch processing.

I just think the Java API's version...

    pipeline = pipeline
      .apply("FirstTransform, MyFirstParDo())
      .apply("SecondTransform, MySecondParDo())
is much clearer than the Python version...

    pipeline = (
        pipeline
        | "FirstTransform" >> MyFirstParDo()
        | "SecondTransform" >> MySecondParDo()
    )
Re:Brython – A Python 3 implementation for client-side web p... by pyuser583 on Monday July 06, 2020 @11:20PM (#23755371)
Agreed. I prefer the Java version, for a number of reasons. Scio is even better. But the bitwise operations make sense python wise.
Re:Brython – A Python 3 implementation for client-side web p... by pushingice on Monday July 06, 2020 @10:20AM (#23748147)
This is because it started out as a Google project. There is an internal time-series framework there called Monarch that does the same thing for composing operations.
Re:Brython – A Python 3 implementation for client-side web p... by heavyset_go on Monday July 06, 2020 @11:37AM (#23749021)
I have to agree with this sentiment.
Re:Brython – A Python 3 implementation for client-side web p... by patrickserrano on Monday July 06, 2020 @10:33AM (#23748292)
Oh man, I ran into that when I made my first contribution to our internal Airflow project and was just like wtf is happening.
Re:Brython – A Python 3 implementation for client-side web p... by recov on Monday July 06, 2020 @11:28AM (#23748928)
To be fair it's pretty nice when you get used to it as I doubt you're going to be using bit shifts much.
Re:Brython – A Python 3 implementation for client-side web p... by red_hare on Monday July 06, 2020 @04:24PM (#23752329)
It's fine. But there are some unintuitive edge cases.

Like, for example, if you have tasks A, B, C, and D you can do...

    A >> (B, C) >> D
but not...

    (B, C) >> A >> D
you have to write...

    D << A << (B, C)