/dpt/ - Daily Python Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

doc.rust-lang.org/1.4.0/book/dining-philosophers.html
ada-auth.org/standards/ada12.html
twitter.com/SFWRedditImages

Have you bought yourself a rad github t-shirt already?

Threadly reminder not to use Rust.
doc.rust-lang.org/1.4.0/book/dining-philosophers.html
struct Philosopher {
name: String,
}

impl Philosopher {
fn new(name: &str) -> Philosopher {
Philosopher {
name: name.to_string(),
}
}
}

fn main() {
let p1 = Philosopher::new("Judith Butler");
let p2 = Philosopher::new("Gilles Deleuze");
let p3 = Philosopher::new("Karl Marx");
let p4 = Philosopher::new("Emma Goldman");
let p5 = Philosopher::new("Michel Foucault");
}

Started reading the Rust book. It feels a bit restrictive but I think I'll get used to it

Do you prefer Plato or something?

He prefers Adolf Hitler for maximum edgyness

I want to program in many languages, some that don't have auto-completion in any IDE.
I also want to want to edit just regular files easily and possibly remotely.
Which editor/IDE is the best and easiest to extend to my liking?
Currently using emacs.

Can /dpt/ implement this function?

f : forall α β β' γ γ'. (β -> α -> β') -> (γ -> α -> γ') -> (β, γ) -> α -> (β', γ')

Nice try, Anitfa.

Notepad

(Neo)Vi(m) is the most suited to your need, but if you're already using Emacs, it's already peachy.

f a b (c, d) e = (a c e, b d e)

>neovim
splitter!

Yeah 'cause you have to be a retarded crypto-fascist to appreciate the value of the works of Marx.
I bet you don't even know that Marx wasn't a marxist.

Why does it have String and str type?
Why do you need to specify -> return-type instead of just having the return type after closing ) and ) { meaning void?
If you are defining fields in the struct declaration why do you need specify fn for the new in the implementation?

>let
>let
>let
Why is there million lets and why do they need = after let, shouldn't it be pretty obivious that value comes after symbolname?

Brothers, we have to unite against the real enemy!

Nvi.

You fucker.

I wanted /dpt/ to argue about me not saying what the function should do

String is a variable length string, &str is a reference to a fixed size array of chars.

And let is needed because denoting initialization from declaration is useful to both scoping flexibility (which is important in a RAII language) and compiler optimization.

>Why does it have String and str type?
162
down vote
accepted

String is the dynamic heap string type, like Vec: use it when you need to own or modify your string data. (It is the replacement for the old ~str type, which has now been removed.)

str is now just always a (immutable1) sequence of UTF-8 bytes (of unknown length) somewhere in memory. Since the size is unknown, one can only handle it behind a pointer, meaning that str most commonly2 appears as &str: a reference to some UTF-8 data, normally called a "slice". A slice is just a view onto some data, and that data can be anywhere, e.g.

in static storage: a string literal "foo" is a &str, where the data is hardcoded into the executable and loaded into memory when the program runs.
inside a heap allocated String: String dereferences to a &str view of the String's data.

on the stack

>Why do you need to specify -> return-type instead of just having the return type after closing ) and ) { meaning void?
I don't see anything wrong with it
>let
>let
>let
Actually pretty nice. let (x,y,z) = (23,1,-34);

I cannot see the correlation between Karl Marx and programming.

Stop trying then.

Congrats, you figured out why is a troll.

That's me dumb fuck.

Introspection is a wonderful thing.

Of course, since you are the only one who cares

Antifa x 2

> Why does it have String and str type?
The same reason C++ has std::string, std::string_view and char* - one own the string, and other doesn't.
> Why do you need to specify -> return-type instead of just having the return type after closing ) and ) { meaning void?
I have no idea why -> is needed, but you can omit it and it means (), i.e. void.
> If you are defining fields in the struct declaration why do you need specify fn for the new in the implementation?
I don't understand the question, are you talking about fields not being public by default? Because you can use put `pub` in front to make them.
> Why is there million lets
Because this is not an assignment but a declaration. The same reason you need to write `int` in `int a = 10;` in C.
> and why do they need = after let, shouldn't it be pretty obivious that value comes after symbolname?
Why do people use punctuation? It makes texts easier to read.

...

Have fun throwing fire bombs at police officers while wearing Ray-Ban sunglasses.

No I am an uncucked true aryan popularist globalist journalist nationalist with a recipe to save the near extinct white people from cultural degradation coming from outer space and reptiles

Because the language is failed by design. Obviously Rust shills like won't acknowledge it and come up with poor excuses.

SOMEONE GIVE ME GOOD PROJECT TO WORK ON AND NOT SOME TIMEWASTER TRIVIAL SHIT

>> Why is there million lets
>Because this is not an assignment but a declaration. The same reason you need to write `int` in `int a = 10;` in C.
>> and why do they need = after let, shouldn't it be pretty obivious that value comes after symbolname?
>Why do people use punctuation? It makes texts easier to read.

Meanwhile in superior lisp
(let ((
x 1
y 2
z 3)))

>Because the language is failed by design
Are you really an uneducated? Ada has 8 string types

(((okay)))
time elapsed: 2 hours

>ada being shit somehow make rust any better
ok buddy

Ada is from the 80's. So is C++.
One might think that new languages would learn from the mistakes made in previous languages.

That's not what I meant, idiot. You simple are too dense to understand. Why do you have bools when you got ints? Why do you need ints when you got longs? They have differences

But you, being the obvious patrician that you are, won't dignify these "poor excuses" by an answer, for of course you couldn't be wrong.

Well, you can do
let (a, b, c) = (1, 2, 3);

if you *really* wish to.

>representing data ownership in the type system is a bad thing

These brain dead idiots don't even understand what ownership means

>not passing everything by reference like a Java-toddler and relying on GC to collect it
>a mistake
Whatever you say, pajeet.

If property is theft, then surely using Rust is criminal?

>String::from("antifa")
>"antifa".to_string()
>"antifa".into()
>&str
Great langauge. Too bad I'm too stupid do understand all of it :^)

>Too bad I'm too stupid
I know. I bet you also watch watered down shows like anime too.

Some people never grow past the age of 12.

Are you having a mental break down now that your shitty arguments ran out?

Nice try Proudhon.

I bet you only only read books because you're so intellectual.

uguu

We, however, don't have to guess on the fact that you don't read books. It's pretty evident.

>1.4.0
Why are you linking to outdated docs?

It's really a shame that helicopters didn't yet exist in Marx's time, otherwise he could have been thrown out of one into a large body of water.

Who do you mean with 'we'? Your Anitfa friends? Also, reading Marx's manifesto doesn't make you smart.

If by "Anitfa friends" you mean people that have the attention span of reading a book, yes why not

>Sup Forumstards derailing the thread
>again
Can you not, please?

Das Kapital is the only useful one anyways.

But here's something you ought to read ada-auth.org/standards/ada12.html

Sup Forums shit doesn't only ruin thread, it ruins a board too.

I've never thought that Antifa members and sympathizers were able to read. I guess they're just as intellectual as Karl Marx.

It ruined this whole site desu.
The influx of newfag since the election has really put the last nail in the coffin of all boards, including Sup Forums ironically.

>Meanwhile in superior lisp
>(let ((
x 1
y 2
z 3)))
Now this is boyond sad, it's tragedy

It started with the fappening. Election gave it a real boost. Now that plebbit banned their containment subreddit, Sup Forums is pretty much the facebook for edgy kids these days.

lul dude redbill me on 4chen xD

Normally I wouldn't care and just go away, but atechan and lainchan are ded as fuck these days.

Hacker culture is finally dead.

C A N C E R
A
N
C
E
R

>tfw the normies kicked us from even Desolation Row

What really saddens me is that probably some of these scum of the earth is shitposting in Sup Forums as I write this.
I bet the neo nazi cancer ITT is one of those.

Watch you mouth boy. You're pro diversity goyim. Remember that.

FUCK OFF!

Dubs confirm, gas all non programmers, thread war now.

Wow, rude. I didn't expect that from Antifa.

Property is indeed theft and I can prove it.
As an example let's consider the case of food.
Let a thing belong to you if and only if you've earned it.
A food is, of course, a thing.
Let earning a thing mean working as hard to have it as you would have had to work to make it. (Trivially, if you have made a thing, you have of course worked this hard by an axiom of identity, and so you have earned it.)
If you have worked as hard to have a food as you would have had to work to make it (from scratch, of course) then you have expended the calories in that food.
If everyone justly earned everything they ate, everyone would starve very quickly.
The human race is not extinct.
Therefore, property is theft.

Science is not really popular these days. Millennial are more interested in using the technologies, not researching them.

This is what you get when a nation gives up critical thinking and starts slurping all the hot garbage they are fed by the media --left and right

Why don't you fuck off back to your day care board you useless fucking piece of filth?

>Millennial are more interested in using the technologies, not researching them.
That's because scientific research is so poorly paid, and nowadays people have five or six figures of student debt to pay off.

I'm willing to bet most americans think science is some sort of black magic done by "the liberals".

I'll enjoy watching Americans fall off the cliff

I'm builing a shitty version of M/Monit because I didn't know it existed until recently.

Features
- HTTPS with client auth
- JSON-lines logging format, allows you to log arbitrary data alongside time/values
- Automatic actions when data is bad or overdue (e.g. no hearbeat from system X for Y hours)
- Easy plugin system for automatic loggers like CPU/HTTP response/bitcoin price/whatever

>student debt
Can't wait for that bubble to burst. The whole wide world is going to be in shambles, but the US will never recover.

Why do you get so upset when Antifa is mentioned? You even called me a neo-nazi. I'm thoroughly shocked.
To make things up, I'll send you the manifesto of another great philosopher: Adolf Hitler. They say he's on par with Karl Marx.

Most Americans outright deny many scientifically proven facts.

> Science is not really popular these days. Millennial are more interested in using the technologies, not researching them.
This was always the case, stop romanticizing the past. If anything, people were even more stupid back then due to worse education.

>makes a thread about programming political on the getgo
>B-but I was only pretending to be retarded
Fuck off, seriously.

Right after I finish my degree.

somebody PLEASE help me

>people were even more stupid back then
Are you implying anything changed?

People were less educated, true, but they weren't as anti-intellectual.

A few decades back, being a scientist was not only a high paying job but the shit people aspired to do.

Most Americans believe tap waters make frogs gay
LMAO

>Therefore, property is theft.
I realize now that this conclusion may seem obtuse.
The point I'm making here is that the extreme example of fairness I propose as a definition of property (owning = earning, earning = expending energy equal to that necessary to create from scratch) is unrealistic, and is not the actual definition we use.
However, it's the only definition that's truly fair.
Since the definition we use must by necessity fall short of this definition, and by extent of true fairness, our definitions of property are therefore UNfair.
An unfair definition of property is akin to theft.
In this, I have proven that "property," as we know it, is theft. (From mother nature, in particular.)
However, I have also proven that theft (from mother nature) is necessary for survival and there is fundamentally no alternative.

It's hard, but it's definitely possible.
Try and make a list of all the instructions you can use, then of all the ones you need, and then write pseudo-instructions to replace the ones you can't use directly.

>People were less educated, true, but they weren't as anti-intellectual.
This

I worry there's a whole barrel of shit waiting to explode. Student debt, house prices, personal debt, mass job automation just around the corner, aging population needing social security and medicare (or equivalents in other countries)

Wow, you already told me to fuck off twice. That makes it even more rude.
Did you know that Karl Marx was the founding father of two other great philosophers? Maybe you've heard of Joseph Stalin and Mao Zedong.

Shellcode which does what exactly?
Either way, just go look at how amd64 instructions are encoded and see what you can produce with that.

Have you ever had the feel of "I don't belong here"?
Now is the time.

Educational standards are higher, more people have college degrees.
>they weren't as anti-intellectual.
They were, creationism and flat earth aren't new things.
>shit people aspired to do
What's your source tho? How do you compare such things? Back then and right now there are people who are genuinely interested in science and people who think the Earth if flat. If anything, it's better now because you can make fun of the latter on the internet.

Nah, it's pretty comfy. Too bad there was a sudden influx of Rust "academics" from Reddit.

I don't actually see any reason not to use Rust. Care to elaborate?

Thanks for the tips, I'll make a list of instructions that fall within 0x20-0x7e

The shellcode is just supposed to open a shell, the target program uses setuid

Academics are welcome.

>people who think the Earth if flat
But it is. Along some axes.
Just not the four we're familiar with.