Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Asleep Style
Oct 20, 2010

Thanks for all the python posts. I had started just reading the official docs, sounds like I might as well just continue with that

Adbot
ADBOT LOVES YOU

Soricidus
Oct 21, 2010
freedom-hating statist shill

Carthag Tuek posted:

yea the stringly typed forward annotations are so bad

apparently cant be fixed without rewriting module import from the ground up

I thought they’d fixed it by just making them implicitly always be strings

Soricidus
Oct 21, 2010
freedom-hating statist shill
golang update: not only are they keeping their own code in the vendor directory, bits of it are also randomly scattered around other censored libraries

I thought go was supposed to be super strict about following conventions but it seems like directory structure is just do whatever the gently caress you like. why didn’t they just copy maven, “your source code goes here” is way easier to sell people on than “your preferred brace placement is a compile error”

e: censored was supposed to say vendored but I liked the autocorrect

MononcQc
May 29, 2007

Carthag Tuek posted:

yea the stringly typed forward annotations are so bad

apparently cant be fixed without rewriting module import from the ground up

To be fair though, if you do declare the type before using it, you don't have to switch to strings, right?

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Soricidus posted:

I thought they’d fixed it by just making them implicitly always be strings

idk maybe in 3.9? it doesnt work in 3.8.3

code:
[ carthag@Ono-Sendai.local:~/tmp ]$ python3 typetest.py 
Traceback (most recent call last):
  File "tmp.py", line 4, in <module>
    def log(value: StringOrInt) -> None:
NameError: name 'StringOrInt' is not defined
[ carthag@Ono-Sendai.local:~/tmp ]$ cat typetest.py
from typing import Union

# this type checks, but errors at runtime
def log(value: StringOrInt) -> None:
   print(value)

# this works though
def log(value: "StringOrInt") -> None: 
   print(value)

StringOrInt = Union[str, int]
[ carthag@Ono-Sendai.local:~/tmp ]$ python3 --version
Python 3.8.3

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



MononcQc posted:

To be fair though, if you do declare the type before using it, you don't have to switch to strings, right?

yeah that works

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



oh, actually it works if you put

from __future__ import annotations

so i guess its in 3.9 or 4.0

xtal
Jan 9, 2011

by Fluffdaddy
Type and constant declarations should be at the top of the file anyway so you can think of that as an accidental lint rule

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



xtal posted:

Type and constant declarations should be at the top of the file anyway so you can think of that as an accidental lint rule

sometimes you cant avoid referring to later declarations

code:
class Parent:
	child: Child

class Child:
	parent: Parent
empty forward declarations are ugly

Antigravitas
Dec 8, 2019

Die Rettung fuer die Landwirte:

Asleep Style posted:

Thanks for all the python posts. I had started just reading the official docs, sounds like I might as well just continue with that

I really like the official docs. I just wish they had a trove of "pythonic" patterns to show some of the stuff you can do with Python that aren't immediately obvious.

Like pathlib overloading the / operator to make assembling paths look more natural, which is both a hacky hack but also pretty neat. Python can be abused in so many crazy ways, it's pretty fun.

Sapozhnik
Jan 2, 2005

Nap Ghost
python is a clownshow

https://lwn.net/Articles/823292/

quote:

> Van Rossum said there was an element of "because we can" to the idea;

There is a whole lot of venting I could post in response to this right now, but I'm done. I'm just done.

quote:

Eventually the kindest thing you can do for any old horse is to take it out back and shoot it.

Python has the same fundamental defect as GNOME which is that its creators consider it to be a fun hobby to tinker with on the weekends, not something that third parties should be foolish enough to actually depend on and expect any sort of stability guarantees out of.

Cybernetic Vermin
Apr 18, 2005

yep, that's python alright. or actually there are two things at play at once:

1. just refusing to realize that their incredibly lovely implementation has very little value except as one minor link in the chain of enabling the entire ecosystem, especially the production software running on it. keeping your crap interpreter "clean" by breaking vast amounts of way more important software is insulting.
2. just hating the user. e.g. the classic where writing 'exit' in the repl having special code which exists only to tell the user that the repl fully understood what you meant to do, but that you are supposed to do it in another way (pressing ctrl+d). changing print back and forth falls mostly in this category.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
when I type exit in the repl (which I use like twice yearly) I always think of the "did you just tell me to go gently caress myself?" comic strip

Bored Online
May 25, 2009

We don't need Rome telling us what to do.
rust: the book had to take the first 50% to explain syntax before it could get to the first demo project.

FamDav
Mar 29, 2008

Phobeste posted:

it's true and you can tell because like with web microservices doing anything useful with standard unix command line tools requires building an elaborate ramshackle structure of bullshit

i want to meet the person who tried to emulate pipes in soa

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



pokeyman posted:

when I type exit in the repl (which I use like twice yearly) I always think of the "did you just tell me to go gently caress myself?" comic strip

:same:

tho im starting to build muscle memory for ctrl-d (i usually get to "ex" before remembering), but it will take a while yet considering how rarely i use it

Xarn
Jun 26, 2015
I like it, because I don't get weird behaviour dependent on whether I declared an exit variable or not. If you want REPL that tries to implement DWIM at the cost of surprising behaviour, IPython is one install command away.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Corla Plankun posted:

i don't get why people want typed python. if you need help keeping track of the typed of objects, your script is too big and you should switch to a big boy language imo

because they failed to switch to a big boy language 10 years ago and it's easier to add types to python than to rewrite in a different language

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



where's tef to tell us to delete our code

Jerry Bindle
May 16, 2003
"if you need types your script is too big" has the same feel to it as arguing your calculator doesn't need a decimal point because any mathematician worth his salt can keep track of where the decimal point should be. anyways python is bad, don't use it.

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost
python remains the best plang and on balance its a deec lang, its just that the balance is composed of a buncha best in the industry deals and a buncha absolutely crap deals. highs are very high, lows are very low

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man

Carthag Tuek posted:

where's tef to tell us to delete our code

i actually unironically looked up that article and recommended it to a coworker who was stuck in design paralysis and it worked great. thanks tef

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Phobeste posted:

i actually unironically looked up that article and recommended it to a coworker who was stuck in design paralysis and it worked great. thanks tef

thef

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Jerry Bindle posted:

"if you need types your script is too big" has the same feel to it as arguing your calculator doesn't need a decimal point because any mathematician worth his salt can keep track of where the decimal point should be. anyways python is bad, don't use it.

eh, not really. not having a decimal point doesn't actually make things easier when you don't need it. dynamic types do simplify things sometimes.

Jerry Bindle
May 16, 2003
yeah dynamic types do simplify the process of loving up and doing things wrong

Jerry Bindle
May 16, 2003
sorry i'm losing my mind and i'm just being an rear end in a top hat. python is fine, dynamic types are fine, hell even dynamic scoping is fine. everything is fine. the important part of computers is solving human problems.

Private Speech
Mar 30, 2011

I HAVE EVEN MORE WORTHLESS BEANIE BABIES IN MY COLLECTION THAN I HAVE WORTHLESS POSTS IN THE BEANIE BABY THREAD YET I STILL HAVE THE TEMERITY TO CRITICIZE OTHERS' COLLECTIONS

IF YOU SEE ME TALKING ABOUT BEANIE BABIES, PLEASE TELL ME TO

EAT. SHIT.


Jerry Bindle posted:

sorry i'm losing my mind and i'm just being an rear end in a top hat. python is fine, dynamic types are fine, hell even dynamic scoping is fine. everything is fine. the important part of computers is solving human problems.

nah you're right this time imo

even Python and Javascript (well typescript) both moved to static typing for non-clownshoes stuff

just about everything you might want to do with dynamic typing you can do with polymorphism instead, except controlled

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost
the secret of computer touchin is that it always starts as clownshoes stuff

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003
there is no good reason to use dynamic typing. none. i will die on this hill

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



bob dobbs is dead posted:

the secret of computer touchin is that it always starts as clownshoes stuff

true. never write a prototype, it will immediately become your production system

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost
"there is no such thing as a prototype"

Jerry Bindle
May 16, 2003

DELETE CASCADE posted:

there is no good reason to use dynamic typing. none. i will die on this hill

there doesn't need to be a good reason

Jerry Bindle
May 16, 2003
like, in racket dynamic typing is fine because you're already doing case analysis on all the parameters anyways. and if you're doing racket you're jerking off at a east coast university or in france somewhere, or something. it doesn't matter. you don't need to have a reason to do this. you just do it and smile.

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003
if you're using racket then you should be using typed racket

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

The secret is to only have one type, bytes

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



taqueso posted:

The secret is to only have one type, bytes

:wrong: its bits

Progressive JPEG
Feb 19, 2003

nibbles

animist
Aug 28, 2018
I thought it was sets

or lambdas??

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

I should be able to link verilog or vhdl with my normal code

Adbot
ADBOT LOVES YOU

brap
Aug 23, 2004

Grimey Drawer
if you write a prototype for demo purposes, and then you demo the prototype to management, you will end up shipping that prototype, so i don’t think you should write things as if you will get the luxury of throwing them away.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply