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 4y ago · link · parent

Yep. 3 generations of dell for me, every time a different problem. I miss my samsung ativ book.

Next one will be a framework laptop.

comment 4y ago · link · parent

Very useful, especially since CBV have terrible ergonomics. They have hidden code path, state and flow everywhere in their thousands methods, MRO to follow, they are verbose and hard to debug (good luck putting a breakpoint in the right place).

I miss generic function views, but you can almost use CBV like them: in your view fuction, do "return YourCBV.as_view(params)" and you are good to go. Much easier than subclassing.

Of course, with FastAPI, we know that there an even better API for that: DI. It's more composable, easier to follow, to test and with less side effects.

django-ninja (https://github.com/vitalik/django-ninja/) already offers a lot of that for Django, and I hope it will become a huge success. It is however, currently thinking of using classes somewhere to reuse init view code, so I made a proposal to extend the API design around more flexible approacheshttps://github.com/vitalik/django-ninja/issues/15#issuecomme...

I'm against OOP, I use it myself, but you should use it for what it's good at: multiple operations around a central state, crafting an api with __dunder__ methods, and namespacing related data and operations.

comment 4y ago · link · parent

I wonder if it listen to audio or use the video feed to record noises you make, or your pupils dilatation and evaluation the autonomous nervous system arousal that emerges from the reaction to the content.

Because time spent, scrolling rhythm and likes seem like too weak of a signal.

comment 4y ago · link · parent

> Ultimately though like other commenters have mentioned, the content can be pretty shallow compared to other media

My one time experience felt like browsing the youtube trending page continuously. Which I know must be something a lot of people like, because the videos in there have hundred of millions of views.

But this kind of content is the opposite of everything I enjoy. Does tik tok show a different face deep inside the algo tree?

comment 4y ago · link · parent

I understand that I probably have a niche taste, been a nerd and all, but still.

Maybe I'm not the target?

Do they have a lot of millennial users or is it mostly for the younger generation?

comment 4y ago · link · parent

I don't understand how it works for people.

I tried for what felt an eternity, and it kept showing me terrible content.

So I removed it.

Is there something that is not made to turn your brain into a sponge on tik tok ?

comment 4y ago · link · parent

There were already a lot of features like that:

- context manager

- decorators

- inline conditions

- else keywords in loops, which nobody knows even exist.

- raise from (empty, or with params).

- yield from (espacially with send())

- comprehension lists

- advanced unpacking. This is valid: (a, (b, *c)) = [1, {*range(4)}]

- advanced slicing. This is valid: foo[2:8:2] = bar[:4]

Most of which existed in Python 2 already !

But it has never been a problem before. Why ?

Because the community doesn't abuse features, it's part of the creed. But also because half of the python coders don't even know they exist (they are just trying to solve their problem, but dev is not their job), and are productive without it, so they just don't use it.

In fact, a lot of tutorials on the internet never even mention those.

Since the walrus came out, I used it once, and never saw it on a client code base.

But when the community do use the features, they usually make things better: decorators made flask/click what it is, slicing made numpy/pandas what it is, type hints made fastapi/pydantic what they are.

Those worries are mostly that: worries. They don't reflect what happens in practice.

comment 4y ago · link · parent

As a freelancer, for me, it's very nice.

But it's definitely more advantageous if you have cash to spare, and freedom in your work.

comment 4y ago · link · parent

- you can work anywhere in the house with your big screen. In the bed, then on the thread mill, then on the desk, then standing. No need to change the setup.

- you can use it in any luminosity. No reflection if you code, no big light to wake up people sleeping if you watch a movie.

- you can code in any posture, including on your back.

- you can go in nature and code, read, get into a meeting. I really want that. I miss the sun on my skin at the office.

- you can go in full immersion, with no visual distraction what so ever.

- you can have your big screen when traveling. Want to work near the beach in the south of France ? Sure your can, why wait for the holidays ? You can be productive in the hotel room with your full setup, and then enjoy a dip in the water then a lunch at the local cafe.

I wouldn't make it my only setup. It kills social interaction. I like my pen and paper. But the options are nice, if you can afford it.

It's definitely something to improve some aspects of work, not a shift. And you will enjoy it more if you are already fortunate to have money, and freedom in your work.

But there is a place for it.

comment 4y ago · link · parent

Yes, the video is a total cringe, I don't understand how they could imagine it would help them sell the thing.

But I could totally see myself going into the forest or the mountain in a remote area, and enjoy working remotely in nature. As long as I know there will be no humans around.

First, as you said, it's very awkward. It can already create social tensions to have hearphones on in public, so a whole mask...

But it's also dangerous. People are idiots, sometimes means, sometimes just clumsy. And I am an idiot. With my eyes free, I manage to do plenty of damage, breaking glasses, hitting people by mistake, pouring liquids in the wrong places. I know with a certainty I would cause trouble with a helmet on.

comment 4y ago · link · parent

Hence the "if confirmed :)".

comment 4y ago · link · parent

That's the total opposite for me.

The linux desktop is the killer feature. Why recode 30 years of a rich ecosystem when you can benefit from it now ?

You can use a web browser with all your extensions, code with a real local vs code, issue git commands in a terminal, watch any video with vlc / download them with youtube-dl / torrent them, get your emails with thunderbird, in a huuuuuge screen, open all my 1000 of different chats, play on steam while voicing on discord, query a postgres db, render a scene in blender, ssh to my work server and enjoy my ebook collection using calibre.

Why would I want a limited, badly supported, barely developed system?

comment 4y ago · link · parent

No, but you can wait a few days and reserve judgement until it's confirmed by several sources. It's not like it something you need or could act on.

Today, the news arrive fast, and the reaction to the news is instant.

On the other hand, after several years of covid crisis, my opinion on the whole thing is very much in flux, and when I discuss it with people, I don't give definitive statements, nor raise an outrage.

So yes, the reaction here seems it could be a problem... if confirmed :)

comment 4y ago · link · parent

Yes, they are a problem too.

But, you know they are here.

They can be turned off.

They require an internet connection.

They are not meant for tracking, and intent is important.

They provide other features than tracking.

They are expensive, and battery don't last. People won't use them to track their ex wife for months.

It's like comparing a gun and a knife. Sure, you can kill with a knife, but it's harder, and initially the knife is made for cutting carrots.

comment 4y ago · link · parent

No, but I do think an intro to programming should be done without math. You can mix them later, once the students know what's up.

comment 4y ago · link · parent

> Actually, I have, because I've done a fair bit of embedded development

Can't argue there :)

> Factoring a quadratic by hand is something I expect a CS major to know how to do

Agreed, I'm more concern about teaching programming while asking such a task. Once you have solid foundation, you can have valuable insights by doing this exercise about float based maths, moving variables around, naming things, translating maths to code. But before that, I think it would hinder learning.

> And someone who knows how to factor a quadratic by hand knows a number of formulaic (suboptimal) steps to perform it-- the exact kind of things that's easiest to translate to code before you have gotten into that mindset of explicit thinking.

I disagree, because it takes 2 abstracts things and mix them together. It's a harsh first step. As a teacher, I get better results when I map coding to some concrete reality first. Later on, yes, you can mix.

> I'm teaching a secondary student to program right now. In his core math class he's doing a lot of trig. In turn, we're doing a whole lot of exercises like "make these dots chase the other dot using atan2 and sin/cos".

This is what I'm talking about. I have terrible results with those for anybody who doesn't really love maths. But creating small games and analysis the text of their favorite song are instant hits.

comment 4y ago · link · parent

Yes, but I doubt you had write code to factor a quadratic equation because it's a solved problem and you have libs that will do it for you.

Imagine if you had been given an exercise of such a low level nature for every single topic you might touch in IT in the future. You would have had to code a function to do UTF8 decoding, JPEG rendering, TCP/IP error correction, font rasterization, ray tracing, PEG parsing, an USB driver, data diffing, model training, etc.

Also, you don't learn much about programming by creating a function to factor a quadratic equation. You seldom learn about types, side effects, algo complexity, or even about collections, iteration, branching, memory, debugging, etc.

You just learn to badly translate a very specific, narrow problem to the language you use.

comment 4y ago · link · parent

> should Apple be doing these measures at all?

Apple no, but law makers should require a licence to use those. This is not a tech that anybody should be able to use on a whim. Too much potential for abuses.

Not to mention the more there are, the bigger the cake for a nation that want to get control of the biggest offline spying network of all time. Somebody is going to crack that thing sooner or later. There will be an NSO for airtags.

comment 4y ago · link · parent

Espacially sinced a lot of people use their phone way more than their computer (if they have one), and multitasking on the phone is extra hard.

comment 4y ago · link · parent

That's assuming policies are made for the good of society, and not the good of the policy makers.

comment 4y ago · link · parent

https://0bin.net

There is no analytics. No ads. It just sits there, costing a few $ in hosting and doing it's thing. It's been running for years, just for the sake of it.

comment 4y ago · link · parent

Oh yes, the problem are the ads.

Even subtitle ads break your focus from the content, give bad incentives, unfair leverage, etc.

If ads were not here, most junk content in the internet would not exist because people would not pay 20 cents to see it. They pay to see it with ads, because it's a price they don't pay consciously, nor can they assess the consequences clearly.

I'm for the total and complete ban of ads. A content can't exist without it? Ask people to pay. If they don't, it means it didn't have real value. Let it die.

Worse, ads create a huge asymmetry of power in the favor of those who already have it. If you can throw a lot of money to ads, you can gain on the competition. Local small shops can't do that, so ads promotes way more coca cola than organic carrots.

Besides, the people publishing ads have an agenda that almost never align with the customers interest. People say there are ads they want to see, but the reality is that even those ads are not trying to make you more knowledgeable. They try to sell you something.

We have thousands of communities of experts in stuff, testers, consumers, bloggers, than can inform you. You don't need ads to know about something.

Society as a whole would be better without it.

Newspaper would be more objective, streets would be more beautiful, content would be more qualitative.

What about all those youtubers that couldn't exist without ads ?

99.99999% of them are crap. The youtube frontpage is a trash can.

A minority is good, but in the new adsless society, some of them would survive in a different way. Some would not, but the benefits are more important. Just like the US didn't keep thralls because "think of the economy".

Finally, the ads lead to websites to promote engagement at all cost, which fuels fake news, outrages, and tribalism on social medias. Ads are a burden to the human species.

And I say that... as a person who gets a lot of revenue from ads.

comment 4y ago · link · parent

> Because let’s say it, everybody loves YAML. YAML is everywhere.

Nope. Nope, nope, nope.

I know a lot of people, including myself, who hates YAML with a passion.

First, they hate the format itself. It's very easy to introduce hard-to-find typos. Plus it has multiple versions, no way to tell which one you use, and depending of the parser that ends up eating the file, you may get weird results. It's way worse then just the "Norway problem". Typically, a bad monday morning could look like this:

    >>> import yaml
    >>> yaml.safe_load(''' 
        port_mappings: 3333:33
        alternative_port_mapping: 3333:33,
        countries: [FR, US, UK, NO, IT] 
        1 : 1,0
        2: 01
        3: 1.0
        4: 1O
        5: 0b1
        6: 0x1
        7: 0i1
        8: hey,
        8.0: oh,
        version: [3.1, "3.1", 3.10, "3.10"]
    ''')

Which may turn into this:

    {
        'port_mappings': 200013,
        'alternative_port_mapping': '3333:33,',
        'countries': ['FR', 'US', 'UK', False, 'IT'],
        1: '1,0',
        2: 1,
        3: 1.0,
        4: '1O',
        5: 1,
        6: 1,
        7: '0i1',
        8: 'oh,',
        'version': [3.1, '3.1', 3.1, '3.10']
    }
It's a terrible, terrible format, that has too much variability, and way too many foot guns. Especially since typo-writing humans are supposed to edit those with their little clumsy hands.

But worse, YAML is mostly declarative, so no complex system can be described in it. Here we come to the second reason people may hate it: it's usually turned into an even worse DSL.

A very limited, badly designed, half documented and tested DSL with almost no tooling to write or debug the stuff. And each project has a different DSL, of course.

Take Ansible. If your playbook is more than 10 lines, it becomes a pain to write because you are basically using a programming language embedded into a markup language. You have no print() or breakpoint to dive into the mess it does. It has to reinvent ways to pass values around since there are no functions with references to parameters nor return values.

Mind you, this DSL calls Python under the hood, so they could have just exposed a declarative, idempotent Python API, but no. The entire world was required to recreate syntax highlighting, snippets, go-to-definition and so on for it. Which will never be good compared to the infra for real languages.

There are few reasons to decide to use YAML, apart from "this is the only rich format supported out of the box by this system that has comments". Which I totally get, but still.

If one can, use JSON, TOML or XML depending of the case, if we need only values.

And if we need more than values, let's either define a clean, restricted API with a full blown programming language, or, if the use case requires it, use CUELang (https://cuelang.org/).

CUELang is cleaner than YAML on all points, even for just data. It can provide a schema, can validate the data with that schema. It can embed logic. It can import and export from YAML and JSON so you stay compatible with the entire devops world.

And it's not Turing complete, but has useful constructs to repeat, branch and reuse code.

comment 4y ago · link · parent

So it doesn't, and it's not about the type system. Any decode operation in python 3 raise an exception or return string.

It's about the runtime error handling making it mandatory to deal with the error and won't let you panic at run time for this specific error.

comment 4y ago · link · parent

How does the type system knows the bytes are utf8 and not CP850?

comment 4y ago · link · parent

I don't have one team, I'm a freelancer, I meet 2 teams each month. I have a large sample to generalize from.

comment 4y ago · link · parent

Nowadays, passing bytes to any os function returns bytes objects, not unicode. You'll get string if you pass string objects though, and they will be using utf8 surrogate escaping.

comment 4y ago · link · parent

> Sounds like a team problem,

You had a good team. I had a great mum. Some people have great doctors.

> It just shifts from "let's change this flag in yapf" to "let's switch to yapf because black looks ugly and gives us no options".

If the practice doesn't match the theory, I'd rather trust the practice.

1
103104105
184