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
Notorious b.s.d.
Jan 25, 2003

by Reene

Xarn posted:

I think Python is better because Perl and Perl culture encourages terse and clever code. :colbert:

you have not seen what i have seen done in python list comprehensions

Adbot
ADBOT LOVES YOU

cinci zoo sniper
Mar 15, 2013




yeah i forgot to mention “pythonic code” in response to that

AggressivelyStupid
Jan 9, 2012

python is pretty neat

AggressivelyStupid
Jan 9, 2012

AggressivelyStupid posted:

python is pretty neat

wow username post combo!!!

Share Bear
Apr 27, 2004

Symbolic Butt posted:

python is also arguably becoming more perl-like with features like assignment expressions in 3.8

'{}'.format()? PFFT CRUFT.

Let's use f'{}', much cleaner.

it's so loving dumb

quote:

python list comprehensions

those fuckin rule, i love them, but i usually leave a comment with a link to the official python docs about what's going on

Share Bear fucked around with this message at 22:42 on Jul 10, 2019

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Xarn posted:

I think Python is better because Perl and Perl culture encourages terse and clever code. :colbert:

may your code pour like rivers from your fingers, drowning every reader in its impossible length, breadth, and depth
every expression, line, file, module, volume composed without the tiniest spark of cleverness
staggering in both its vastness and the gaping incuriousness of its crude construction
"given enough eyeballs, all bugs are shallow", you mumble to yourself as you repeatedly copy and paste a ten-thousand line function, "simple is better than complex"
may your verbosity blot out the sun itself

Notorious b.s.d.
Jan 25, 2003

by Reene

Share Bear posted:

i usually leave a comment with a link to the official [...] docs about what's going on

this is often a sign you have hosed up badly

Notorious b.s.d.
Jan 25, 2003

by Reene

Internet Janitor posted:

may your code pour like rivers from your fingers, drowning every reader in its impossible length, breadth, and depth
every expression, line, file, module, volume composed without the tiniest spark of cleverness
staggering in both its vastness and the gaping incuriousness of its crude construction
"given enough eyeballs, all bugs are shallow", you mumble to yourself as you repeatedly copy and paste a ten-thousand line function, "simple is better than complex"
may your verbosity blot out the sun itself

pretty sure this was the design manifesto for golang

luchadornado
Oct 7, 2004

A boombox is not a toy!

Notorious b.s.d. posted:

this is often a sign you have hosed up badly

those are the times when you passive aggressively rewrite it like a sane person and say "oops must've got stomped in a merge"

or just tell them to stop being clever

FlapYoJacks
Feb 12, 2009
I like Python, it's cool and good.

Notorious b.s.d.
Jan 25, 2003

by Reene

ratbert90 posted:

I like Python, it's cool and good.

good post/av combo here

animist
Aug 28, 2018
why doesn't everyone just write APL

life←{↑1 ⍵∨.∧3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵}

mystes
May 31, 2006

Share Bear posted:

'{}'.format()? PFFT CRUFT.

Let's use f'{}', much cleaner.

it's so loving dumb
The worst thing about python is that it was supposed to be a simple language where there was one way to do everything, but now it's starting to get to c++ levels of cruft.

Share Bear
Apr 27, 2004

Notorious b.s.d. posted:

this is often a sign you have hosed up badly

i write docs that assume someone hasn't seen all the parts of the language, especially when it's not explicit what is going on

code:
new_list = [
   item
   for things
   in basket
   if item == 'food'
]

is not the clearest logic if you're junior or, more commonly in my experience, never touch python

Share Bear fucked around with this message at 23:32 on Jul 10, 2019

Soricidus
Oct 21, 2010
freedom-hating statist shill

Share Bear posted:

'{}'.format()? PFFT CRUFT.

Let's use f'{}', much cleaner.

it's so loving dumb


those fuckin rule, i love them, but i usually leave a comment with a link to the official python docs about what's going on

list comprehensions aren’t bad but they should have forbidden putting multiple fors in them because neither order is obviously correct and the one they picked doesn’t match my intuition

my homie dhall
Dec 9, 2010

honey, oh please, it's just a machine
biggest python peeve for me is that they made map/reduce/filter such a pain to use

Sapozhnik
Jan 2, 2005

Nap Ghost
I am on my hands and knees, begging the software developer community to learn the word "summary" and then utilize it in place of the phrase "too long; didn't read"

:razz: TL;DR: Zoinkies automagically rewrites your code from scratch to continuously deploy 420% more unicorn fart emojis on your cli progress bar! ftw! :razz:

Sapozhnik
Jan 2, 2005

Nap Ghost
idk what this has to do with programming languages, world is a gently caress

suffix
Jul 27, 2013

Wheeee!
current hipste status: mad about floats and that disingenious crank gustafson

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

animist posted:

why doesn't everyone just write APL

life←{↑1 ⍵∨.∧3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵}

nowadays in dyalog apl you could write

life ← U ∊⍨ ⊢∘⊂⌺3 3

the core enhancement is the use of a relatively new operator ⌺ (read "stencil") which generalizes the idea of carving up a matrix into uniform-shaped possibly-overlapping tiles, reducing over each tile, and then gluing the results back together; this makes it much easier to express the idea of a neighbor count. several interesting variations can be found here

Kazinsal
Dec 13, 2011

Internet Janitor posted:

nowadays in dyalog apl you could write

life ← U ∊⍨ ⊢∘⊂⌺3 3

the core enhancement is the use of a relatively new operator ⌺ (read "stencil") which generalizes the idea of carving up a matrix into uniform-shaped possibly-overlapping tiles, reducing over each tile, and then gluing the results back together; this makes it much easier to express the idea of a neighbor count. several interesting variations can be found here

really disappointed that wasn't a link to goatse, not gonna lie

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

suffix posted:

current hipste status: mad about floats and that disingenious crank gustafson

why?

(background in case it matters: I read the post about posits and mostly just shrugged, but I don’t know anything)

Share Bear
Apr 27, 2004

Soricidus posted:

list comprehensions aren’t bad but they should have forbidden putting multiple fors in them because neither order is obviously correct and the one they picked doesn’t match my intuition

oh absolutely. i also think they shouldve figured something better for dicts, but you can use the same bs syntax for those too.

Carthag Tuek
Oct 15, 2005

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



Sapozhnik posted:

I am on my hands and knees, begging the software developer community to learn the word "summary" and then utilize it in place of the phrase "too long; didn't read"

:razz: TL;DR: Zoinkies automagically rewrites your code from scratch to continuously deploy 420% more unicorn fart emojis on your cli progress bar! ftw! :razz:

tldr: sapozhnik used utilize as use

BobHoward
Feb 13, 2012

The only thing white people deserve is a bullet to their empty skull

pokeyman posted:

why?

(background in case it matters: I read the post about posits and mostly just shrugged, but I don’t know anything)

can’t speak for op and i haven’t followed recent developments (posits is a new term for me) but gustafson’s original propaganda for “unums” etc was way over the top. he made extremely dubious proclamations about ending error forever, hand waved away implementation cost concerns, and generally seemed to pitch it all towards less informed audiences who could be wowed by a slick presentation from a plausible authority figure rather than doing the legwork to get it taken seriously by the sort of people whom he’d need to create actual hardware implementations, build software tools, etc

he also took lots of juvenile potshots at William Kahan, aka the father of ieee 754 floating point arithmetic, which was pretty uncool imo

Notorious b.s.d.
Jan 25, 2003

by Reene

Ploft-shell crab posted:

biggest python peeve for me is that they made map/reduce/filter such a pain to use

that's because list comprehensions are supposed to replace functions, see?

Share Bear posted:

code:
new_list = [
   item
   for things
   in basket
   if item == 'food'
]

so easy!

in conclusion,

Share Bear posted:

never touch python

p.s. perl and ruby have much better map/reduce/filter support, but who cares? they are still bad languages.

luchadornado
Oct 7, 2004

A boombox is not a toy!

Share Bear posted:

i write docs that assume someone hasn't seen all the parts of the language, especially when it's not explicit what is going on

thats a p good reason to write the code differently, no? i kind of consider it my job to write easily maintainable and understandable code.

syntactic sugar can be really gross if youve ever had to work with scala people

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.

suffix posted:

current hipste status: mad about floats and that disingenious crank gustafson

I wanna hear more too. My first read is that he’s trying to market it hard but if it’s so good then who’s adopting it for which applications?

Internet Janitor posted:

nowadays in dyalog apl you could write

life ← U ∊⍨ ⊢∘⊂⌺3 3

the core enhancement is the use of a relatively new operator ⌺ (read "stencil") which generalizes the idea of carving up a matrix into uniform-shaped possibly-overlapping tiles, reducing over each tile, and then gluing the results back together; this makes it much easier to express the idea of a neighbor count. several interesting variations can be found here

Having just written a higher order function in MATLAB today, I suspect that if I ever learn an APL I’ll start thinking of all my MATLAB manipulations in those terms. not sure if this would make my life or programming better or worse.

FlapYoJacks
Feb 12, 2009
I also like Ruby and think it’s cool and good. I also like modern C++.

FlapYoJacks
Feb 12, 2009
we can all agree that no matter how bad Python is, at least it’s not as bad as PHP, the worst Plang of them all.

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
perl is hilarious, but not particularly practical

animist
Aug 28, 2018

Internet Janitor posted:

nowadays in dyalog apl you could write

life ← U ∊⍨ ⊢∘⊂⌺3 3

the core enhancement is the use of a relatively new operator ⌺ (read "stencil") which generalizes the idea of carving up a matrix into uniform-shaped possibly-overlapping tiles, reducing over each tile, and then gluing the results back together; this makes it much easier to express the idea of a neighbor count. several interesting variations can be found here

i have no idea if this is BS or not which is why APL is such an excellent language

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

yeah

so the thing about fractional math is that every fixed-size representation is going to have trade-offs and weaknesses, and floating-point formats share a lot of them regardless of ieee-ness. like any fixed-size floating-point format is going to have problems with catastrophic cancellation, it just goes with the territory. if you care about maintaining precision or numeric stability you have to design your computations carefully to minimize these problems, and if you care about error bounds you have to do a pretty obnoxious analysis to figure them out. but gustafson has a long history going back to his unums work of talking like his formats don't have any of these problems and just magically eliminate them so that all you have to do is copy formulas out of a paper. and he loves to cherry-pick examples that perfectly cause precision problems with ieee but don't quite with his formats. and if you point any of this out then he immediately retreats to talking about some alternative idea which either applies equally well to ieee floats, like doing some intermediate computations with extra precision, or is poorly-specified to the extreme, like dynamically falling back on extra storage for extra precision when you realize you need it. also he has these recurring ideas that are basically interval arithmetic but which he doesn't like to call interval arithmetic because he similarly wants to pretend that they don't have any of the well-known drawbacks of intervals

unums were ten different ideas at once and you could never nail down what the hell he was talking about concretely. posits are more carefully specified which of course means they have identifiable problems: they're basically ieee floating point with a variable-width exponent field, plus some totally unnecessary quirks. so they generally have a larger dynamic range than ieee — which is pretty silly, the exponent range of a 32-bit ieee float is already ridiculously excessive — but less precision at those dynamic extremes, which squeezing out a few extra bits of precision when the value is closer to 1. thus gustafson loves to pick algorithms that have poor numeric properties (for any format) and then use "arbitrary" inputs that trigger catastrophic cancellation for ieee but don't quite for posits of the same size because there's an extra two bits of precision in that range

so the basic problems here are, first, that all the numeric problems with ieee floats are still there, they're just an extra four or five bits away at best, and so you really do still need to carefully design your computation to have good numeric properties; and second, that you also still need to do error analysis, and the posit error analysis is much more difficult and specific to the actual range of input values than ieee error analysis; and finally, that the variable-width exponent field is a huge problem for hardware and so posit math is basically doomed to be something like twice as slow as ieee fp math

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
the real problem here is that most programmers are essentially enthusiastic amateurs about everything in technology up to and including the things they get paid to spend 70 hours a week 10x'ing about. so they are aware of a laundry list of known problems with floating-point but are too unsophisticated to reason about which are inherent and which could theoretically be fixed, which of course means they're easily susceptible to the tech equivalents of sidewalk preachers, laying down the good word with enough technical-sounding authority to sweep in the credulous

like, you are probably aware that .1 + .2 != .3 in floating-point math. this class of problem is inherent to binary floating-point, and if any particular example doesn't show in a format it's a funny coincidence of the exact rounding being done. posits are still binary floating-point, so nothing about them solves any of this, and not even gustafson claims they do. and yet you can find people talking about .1 + .2 whenever this comes up

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
that is all v insightful, thanks!

Xarn
Jun 26, 2015

Notorious b.s.d. posted:

you have not seen what i have seen done in python list comprehensions

Seen? I wrote them :black101:

Share Bear posted:

i write docs that assume someone hasn't seen all the parts of the language, especially when it's not explicit what is going on

code:
new_list = [
   item
   for things
   in basket
   if item == 'food'
]

is not the clearest logic if you're junior or, more commonly in my experience, never touch python

Also this is terrible and a half step over
C++ code:
// increment iterator
++it;
because what if someone came from Python and doesn't know increment operators??

suffix
Jul 27, 2013

Wheeee!

yes all of this

after his first two wildly impractical attempts he has through persistence and accident landed on a specification that arguably has some accuracy advantages within certain ranges but the grandiose claims are still copy-pasted from the first version

he touts no overflow!! as some big advantage but of course he's just capped the result so MAX_NUM*MAX_NUM = MAX_NUM, oh and also i think MAX_NUM/2 = MAX_NUM because the precision at each end is completely poo poo
the end of the scales are basically dynamic range penis extenders you never want to touch, while ieee floats have useful precision within their range
the 16-bit posits have worse precision than half-precision floats for all numbers higher than 64, hope you picked your si units really really carefully

but wait, it turns out 16-bit posits can "punch above their weight class" with the simple addition of a 256-bit accumulator!

https://marc-b-reynolds.github.io/math/2019/02/06/Posit1.html has a decent explanation on how the extremely cherry-picked computation examples makes two extra bits of precision in certain ranges seem like the second coming of turing

Malcolm XML
Aug 8, 2009

I always knew it would end like this.
William Kahan has decisively dismantled everything Gustafson has wrote on unums and posits and it just feels like he's reminding everyone of his original work getting IEEE 754 done

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
that’s good stuff suffix, thanks! only understood like a quarter of it but I’ll read it a few more times

Adbot
ADBOT LOVES YOU

Share Bear
Apr 27, 2004

Xarn posted:

Seen? I wrote them :black101:


Also this is terrible and a half step over
C++ code:
// increment iterator
++it;
because what if someone came from Python and doesn't know increment operators??

OK so what is the preferred way to transform another class or dict or other list into a new list? I thought this was pretty snappy.

I also think there are levels of syntactic sugar that are appreciable, like this as opposed to f-strings

I generally also don’t see the fault in writing comments assuming that someone might look at your code and not understand it on its face. I am usually this person, dealing with other people’s code, and would love more comments about someones wild Java streams chain or Scala nonsense or python garbage

Maybe I should stick to the terrible programmer thread

Share Bear fucked around with this message at 19:02 on Jul 11, 2019

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