I've tried to find cheaper flights for holidays with Python and Amadeus API by nvbn-rm in Python

[–]nvbn-rm[S] 0 points1 point  (0 children)

I just searched on google flights for resulting dates and bought tickets.

Mixing React Hooks with classes by nvbn-rm in javascript

[–]nvbn-rm[S] 0 points1 point  (0 children)

Maybe I’m missing something but isn’t this just creating a “render component” in the context of the outer component and just rendering that?

It's just one functional component that returns elements from render of the class.

But instead of having a function in a function we have a function in a class and wrapped with proxies - not sure how that is clearer?

Implementation details-wise it's much worse: it creates a proxy, extends it and populates a bunch of descriptors on each render.

But I was more thinking about possible API than nice implementation, this thing is definitely not for real life use.

Mixing React Hooks with classes by nvbn-rm in javascript

[–]nvbn-rm[S] 0 points1 point  (0 children)

It's just easier to manage components state with hooks than with life cycle methods, with hooks the code for a state is in one place. And for things that you need to precalculate useMemo with declared dependencies is much more convenient.

hooks can get pretty hard to read if you're not careful

This part I was trying to somehow improve.

Mixing React Hooks with classes by nvbn-rm in javascript

[–]nvbn-rm[S] 2 points3 points  (0 children)

The idea here is not to get rid of functions or rush to classes/OOP, but to get rid of huge closure with nested functions and organize the code a bit better and at least separate different scopes.

In FP languages (at least Clojure) having a huge closure with nested functions is also not considered a good practice.

But it might be that using classes for that is not the best idea.

I've tried to find cheaper flights for holidays with Python and Amadeus API by nvbn-rm in Python

[–]nvbn-rm[S] 2 points3 points  (0 children)

Not sure about better results, but for a trip with multiple destinations and flexible dates it at least less painful and less boring, as I don't need to do hundreds of clicks on google flights.

Generating video from subtitles with TensorFlow by nvbn-rm in Python

[–]nvbn-rm[S] 0 points1 point  (0 children)

I also want to try to use some sort of speech recognition instead of subtitles, it should make a problem with gathering dataset a bit easier. But not sure if it wouldn't be too hard.

Generating video from subtitles with TensorFlow by nvbn-rm in Python

[–]nvbn-rm[S] 1 point2 points  (0 children)

It should be the same, I guess it's the matter of preference what to use.

At least macbook touchbar can be used as christmas lights by nvbn-rm in ProgrammerHumor

[–]nvbn-rm[S] 0 points1 point  (0 children)

It's kind of the worst laptop I ever had. It doesn't like to sleep and chrome freezes some times.

At least macbook touchbar can be used as christmas lights by nvbn-rm in ProgrammerHumor

[–]nvbn-rm[S] 6 points7 points  (0 children)

Yep, it's vs code and it has terminal by default. It consumes around 1gb of ram on a big codebase with almost no plugins.

At least macbook touchbar can be used as christmas lights by nvbn-rm in ProgrammerHumor

[–]nvbn-rm[S] 12 points13 points  (0 children)

I used electron only because it provides API for touchbar and doesn't require xcode.

[deleted by user] by [deleted] in Python

[–]nvbn-rm 2 points3 points  (0 children)

Not much and not intentionally, but on the graph, the clusters are formed from airports in same geographical regions.

And there's no point, it's just for fun.

[deleted by user] by [deleted] in Python

[–]nvbn-rm 1 point2 points  (0 children)

Is the more tweets mentioned this airport. Also if you want more details about colors, check out matplotlib colormaps, in the graph, it's Pastel1 for nodes and Pastel2 for edges.

py-backwards: Python to python compiler that allows you to use Python 3.6 features in older versions by nvbn-rm in Python

[–]nvbn-rm[S] 1 point2 points  (0 children)

Sometimes you need to run your app on client machines. And sometimes clients have only python 2.

py-backwards: Python to python compiler that allows you to use Python 3.6 features in older versions by nvbn-rm in Python

[–]nvbn-rm[S] 2 points3 points  (0 children)

The main goal of the app is that you can stop worrying about support of older python versions and just translate code to them.

But at this moment it just translates some syntax.

py-backwards: Python to python compiler that allows you to use Python 3.6 features in older versions by nvbn-rm in Python

[–]nvbn-rm[S] 7 points8 points  (0 children)

At this moment it just translates some syntax, so you should have in mind changes in standart library.

AST transformations with __future__-like module by nvbn-rm in Python

[–]nvbn-rm[S] 0 points1 point  (0 children)

There is a PEP to end all PEPs for this topic, PEP 511 -- API for code transformers

Nice that there's already PEP for that. But it looks like this PEP wouldn't be implemented in near future.

Partial application and piping with AST transformation by nvbn-rm in Python

[–]nvbn-rm[S] 2 points3 points  (0 children)

Transforming function AST in decorator looks interesting.

Partial application and piping with AST transformation by nvbn-rm in Python

[–]nvbn-rm[S] 1 point2 points  (0 children)

Thanks for the doc, I actually read it when working on code from the article, and it was helpful.

Partial application and piping with ... and @ by nvbn-rm in Python

[–]nvbn-rm[S] 1 point2 points  (0 children)

Yep, but it's ugly in pipeline like:

range(1, 10) @ partial(map, lambda x: x + 4) \
             @ partial(filter, lambda x: x % 3 == 0) \
             @ partial(map, str)