Better HN
topnewbestaskshowjobs
Log inSign up

BiteCode_dev

24,628 karma · joined Oct 21, 2019 (7y ago) · 5,512 submissions

I write to save you time and effort when dealing with Python:

https://www.bitecode.dev/

Email: contact at bitecode.dev

Submissions

comment 6y ago · link · parent

Nobody can setup a list of allowed topics, controversies or debates for society without destroying its ability to grow: any rule will eventually lead to censor a valid point.

20 years ago, when you talked about mass surveillance, you were a paranoid conspirationist or a crook.

70 years ago, when spoke against the vietnam war, you were anti-patriotic or a communist.

Not to mention we can be wrong now, or right now but wrong in the future.

comment 6y ago · link · parent

I concur, this book is a terrible way to introduce anybody to Python.

I imagine they want to teach general programming skills, and hence want to give you a "way to think" that is low level enough to let you work with any language, using Python as a pseudo-code to demonstrate it.

This approach is doomed to fail.

It's much better to teach the language properly, then introduce other languages as a comparison point, if this is what you want.

I don't get the stellar reputation of this text, maybe it was great when it was written for Scheme, but as-is, I can't see most of my students even finding the motivation to reading it.

comment 6y ago · link · parent

Relativity.

I just can't grok it.

I can't understand how time would flow differently depending of your speed.

I don't get why C is a constant no matter the referential, for any other object the speed is relative to your referential. I just don't see how those 2 are compatible.

comment 6y ago · link · parent

We already have hunger despite our industry producing too much food.

The problem is political and economical, not technical.

comment 6y ago · link · parent

Ok, so the dev who knows 5 languages, a bit about database, git and sysadmin has been hired to do one job. On this job, one must learn the entire stack, including docker, in a few months, while still reaching the deadline.

The dev won't be paid more.

The company won't spend more resources.

Time is short, talent scarce, customers in a hurry.

What do you think will happen?

This is the software industry in a nutshell.

comment 6y ago · link · parent

Youtube is not a public service, it's not a democratic discussion platform and it's not neutral in any way.

It's a for profit advertised funded private video streaming site.

People use it to have debates, but that works as long is it's providing more value than trouble to google.

comment 6y ago · link · parent

> My view is that people here are far too trusting of those in authority, and in particular counter-terrorist police and security services personnel.

I always though "brainwashed by TV" was an exaggeration. But the more I discuss with people, the more I realize they think the police/hospital/army/court works like on TV.

E.G: they expect that if there is a murder, an NCIS like team with try to find the murderer, or if they get strange like disease, some Dr House will be assigned to find the solution, or that judge are impartial and mayors are competent to deal with the solutions their city require. The reality is that people are average human being with limited resources everywhere. They are lazy, have ego, have a small budget, are tired, have an agenda, have bosses and politics, etc.

"authority, and in particular counter-terrorist police and security services personnel" is no different.

comment 6y ago · link · parent

Well, if you have a 100 billions of dollar that sits doing nothing like Apple does, spending it to get a new competitive advantage may make sense. They can do what no other computer manufacturers can no in that position.

comment 6y ago · link · parent

But the stack in JS is a terrible burden in itself, and people only accept it because we have no realistic alternative to JS on the most popular plateform in the world: the web browser.

PHP doesn't have this accidental monopoly: you can use a language that doesn't require discipline and tooling to make something decent.

Bottom line, PHP is better than it used to be. But the technical debt remains, and it's easy to avoid if you can, so we do.

I started with PHP, but I have no reason to go back to it. It has no benefit and is worth it only if you have already a massive PHP code base, or a pool of PHP devs you need to employ.

comment 6y ago · link · parent

> Right, but the point of a high-quality distribution is that this complicated hard work only needs to be done once (per package, updated for upstream changes obviously) by your distribution's package maintainer.

Sure it works for a sysadmin, but it's not matching at all how regular people are using their computer.

It means you can only use packages that are part of the official repo and:

- it's hard to get in those official repo

- it takes a lot of time

- it assumes free software

- if your app embeds its own dependancies, it's usually rejected by default

- it's a bottleneck for publication (the repo team is limited in resources)

- you have no control over updates

- you can't make people pay for software that are in those repos

- you may want/need to package the software yourself or for yourself

On my computer I have a huge number of softwares that I have not installed from the repos:

puslsms, vscode, telegram, dynalist, veracrypt, signal, discord, antidote, bitwarden firefox developper, guitar, stremio, pop corn time, dukto, photoflare, sublime text, table plus and sublime merge

I think using the simple act of spreading this argument is a demonstration of how remote one can get from the vast diversity of the user base.

comment 6y ago · link · parent

Genuine question: why would you want that? Isn't that the role of the file system or the data transport?

comment 6y ago · link · parent

I understand the hate for snap (and flatpak) and I personally use deb as much as I can, but they are the right move.

Yes, right now it's a subpar experience.

But you need to deploy it now to be able to improve on it and have it as the default in the future.

And I believe it's a better future, because:

- packaging a deb is difficult. I've done it, and it's a lot of complicated hard work you get to repeat for every release for anything that is not a simple program. Snap and flatpak are very easy to build and support accross releases. This will increase the number of software that will be provided to Linux. In fact, it already has.

- the permissions model we have on our phones is very hard to replicate on Linux, yet something like this proves more and more necessary. SELinux and Apparmor are too low level. Snap and flatpak make it easy to make sandboxed app and request permissions by abstracting those. What's more, they make it ovious for the user to know that the apps it uses are sandboxed and the permissions they use.

It will take a few years before we get a streamlined experience with snap and flatpak, and it will be at the cost of a bit of performance and disk space. For now they feel bloated, are not necessarily more secure, and are less well integrated.

But in the end, it will make the Linux ecosystem more user friendly.

comment 6y ago · link · parent

No, you just wrap it in a Future.

comment 6y ago · link · parent

For even more fun, use async def + await, and you save yourself the while loop since that what the asyncio.run() does for you.

comment 6y ago · link · parent

Besides, serious projects in Go do use additional tools for creating task queues because they need to handle various stages of persistence, error handling, serialization, workflow, etc. Which are not stuff you want to write by hand yourself.

If you don't need all that, then it's not a problem in Python either. You don't even need asyncio, you can just use a ThreadPool or a ProcessPool, dump stuff with pickle/shelve/sqlite3 and be on your way.

comment 6y ago · link · parent

> In most other languages you can get away with just running tasks in the background for a really long time before you need spin up a distributed task queue

In Python too:

    # or ThreadPoolExecutor depending of the type of work
    from concurrent.futures import ProcessPoolExecutor, as_completed

    with ProcessPoolExecutor(max_workers=2) as executor:

        a = executor.submit(any_function)
        b = executor.submit(any_function)

        for future in as_completed((a, b)):
            print(future.result())
Any task you would put in celery would be a good candidate for being first passed to a process pool executor.

No, the real reason we use celery is that it solves many problems at once:

  - it features configurable task queues with priorities
 
  - it comes as an independent service accessible from multiple processes

  - its activity can be inspected and monitored with stuff like flower

  - it has the ability to create persistent queues that survive restart

  - error handling is backed in, they are logged and won't break your process
 
  - it offers an optional result backend for persisting results and errors
 
  - many distribution and error handling strategies can be configured

  - tasks are composable, can depend on each others or be grouped

  - celery also does recurring tasks, and better than cron

  - you can start tasks from other languages than Python
Now some People use celery when they should use a ProcessPool, because they don't know it exists. But that's hardly because of the language: you didn't seem to know about it either.

It is true that Python concurrency story is not comparable to something like Go, Erlang or Rust, but very common use cases are solved.

In the same way, we can perfectly use shelves instead of redis.

We use redis beacuse it solves many problems at once:

    - it's very performant on a single machine, and can be load balanced if needed

    - it has expiration baked in

    - it offers many powerful data structures 

    - it embeds numerous strategies to deal with persistence and resilience

    - it's accessible from multiple processes, and multiple languages

    - its ecosystem is great, and it's hugely versatile
It's almost never a bad choice to add redis for your website. It's easy to setup, cheap to run, and and it shines to manage sessions and caching for any service with up to a few million users a day.

Once you are at it, why not later use it for other stuff, like storing the result of background tasks, log stream, geographical pin pointing, hyperlolog stats, etc. ? There are so many things it does better than your DBMS, faster, easier or for less resources.

It's such fantastic software really.

But no, nothing prevents you in Python to create a queue manually and serialize it manually. It's just more work for less features.

comment 6y ago · link · parent

With all those websites preventing you to use tor, you can use tor to connect to this, and this to connect to whatever you need.

comment 6y ago · link · parent

> I guess to flip the question, what's the benefit of using a static HTML file over React, other than a 10kb footprint?

KISS

comment 6y ago · link · parent

This is one of the reason I don't like to put application logic directly in the database.

It makes everything harder: caching, testing, abstracting, balancing, etc.

comment 6y ago · link · parent

Yes, the type system is clearly not well integrated.

My point is, I'd rather have a not so perfect one when I need it, that None at all.

And most of the time I don't need one.

comment 6y ago · link · parent

Schema validation is more than type checking, and has been very well solved by libraries like marshmallow and pydantic for a long time. I don't think the comparison holds.

comment 6y ago · link · parent

What attitude?

comment 6y ago · link · parent

Yes. Flutter is a killer app.

But then again, Django as well.

comment 6y ago · link · parent

I used to dislike type hints for Python because:

- I was afraid it would change the language culture

- It was not comfortable to use

- The idea and design was, as you said, bizarre

- Use use a dynamic language, why the hell would I want that?

Years after the fact, I'm really happy about it.

First, most of my Python code don't use them, so Python stays python. But if I ever need them, there are here.

Of course, you could argue I should just use a language that has been designed for that since I need type. But that's missing the point: I don't usually start using hints. I code regular Python, because it's awesome. I just sometimes add type hints after the fact as a bonus.

The ability to do that is fantastic, even if the type system is far from perfect.

I want to code with Python most of the time anyway. I personally have very few use cases for another language, doing mostly web stuff.

Type hints are still very verbose, and convoluted, although it will get better with 3.9 thanks to 2 PEP targeting type hints ergonomics. So sure, it's never going to fit perfectly, but I'm glad it's here.

Now for a JSON schema, I guess it's the same deal. You use JSON because it fits your use case, and one day you realize your situation could now benefit from more robustness, and you add it to the mix.

Again, you could argue you should have though of that at the beginning, but projects don't have frozen requirements, they evolve. And often, you want to start lean, because it will most probably stays that way, and otherwise would be so costly the project would never grow to a point you would need robustness.

Now in this particular case, this lib is not just checking type, but also arbitrary logic. And making sure data is consistent is necessary no matter how dynamic or static your language is. There is a limit to the constraints your type system can represent.

comment 6y ago · link · parent

Fnac and darty now have a so called "marketplace", like amazon, which means resellers. Some friends of mine ordered a Vitamix blender, which was from a reseller. The later just ordered it on amazon, and sent to him.

I find it hilarious, and a bit sad at the same time.

comment 6y ago · link · parent

As a french, I'm ok if amazon suspends deliveries.

We have plenty of other websites to order from: fnac, darty, ruducommerce, cdiscount, etc.

This is going to be good for the french economy, and a good message to american giants that they are not above the law.

comment 6y ago · link · parent

Recession in rich a country push people into poverty as well. In a country where health care is privatized, you die from being poor.

So recession in the US will lead to people dying.

comment 6y ago · link · parent

Yes, but most people don't like their job, and don't want to be productive in it. On HN, we have a lot of passionate people, but as soon as I go into the corporate world or the administrations, the feedback people give changes a lot.

comment 6y ago · link · parent

Exactly.

IT is the far west. There are few educational requirements, and hiring laws specific to our craft. It's a very young field, unlike medicine or architecture, and we just beginning to establish professional standards on the job.

The fact most people see it as magic and can't evaluate it at all doesn't help.

Anecdotally, I've seen many programmers that can't code.

Remember that 2 dev projects out of 3 fail, for a clusters of reasons. And when it doesn't, there is sometimes a few hard kernel of devs that are doing most of the important part of the job, fixing other's mess on the fly, or just plainly doing it for them.

So those bad programmers can go from failure to failure, and never be blamed for it.

But honestly, it it weren't that way, I couldn't have entered the field. I've been given my chance more than once, and I've screwed up many times, before even becoming a decent professional.

1
167168169
184