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
Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

my homie dhall posted:

what is an array but a set with the added complexity of ordering? :smuggo:

well, at least in javascript a set can only have a single instance of a thing:
JavaScript code:

const buttsArray = ['butts', 'butts', 'butts'];
// Array(3) [ "butts", "butts", "butts" ]
const buttsSet = new Set(buttsArray)
// Set[ "butts" ]

Adbot
ADBOT LOVES YOU

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
i say that because i'm sure there is some definition of a set that involves greek letters and makes my eyes slide right off the screen

Osmosisch
Sep 9, 2007

I shall make everyone look like me! Then when they trick each other, they will say "oh that Coyote, he is the smartest one, he can even trick the great Coyote."



Grimey Drawer

Wheany posted:

i say that because i'm sure there is some definition of a set that involves greek letters and makes my eyes slide right off the screen

What about second σετ?

Colonel Taint
Mar 14, 2004


just found out that the hard way that if a python function has a parameter with default value that's an object, it's persistent between calls, so you get things like this happening:

code:
>>> def test_def(x = []):
...     x.append(1)
...     return x
... 
>>> test_def()
[1]
>>> test_def()
[1, 1]
>>> test_def()
[1, 1, 1]
>>> test_def()
[1, 1, 1, 1]
Had me spinning for a bit.

Armitag3
Mar 15, 2020

Forget it Jake, it's cybertown.


Colonel Taint posted:

just found out that the hard way that if a python function has a parameter with default value that's an object, it's persistent between calls, so you get things like this happening:

code:
>>> def test_def(x = []):
...     x.append(1)
...     return x
... 
>>> test_def()
[1]
>>> test_def()
[1, 1]
>>> test_def()
[1, 1, 1]
>>> test_def()
[1, 1, 1, 1]
Had me spinning for a bit.

Yep, python evaluates default params at function definition, so you’re better off using None and initialising the default value in the body instead

Sapozhnik
Jan 2, 2005

Nap Ghost
yeah only reason i know about that one is because it's a classic interview question.

it makes sense from a certain perspective but it is certainly counter-intuitive.

redleader
Aug 18, 2005

Engage according to operational parameters

Colonel Taint posted:

just found out that the hard way that if a python function has a parameter with default value that's an object, it's persistent between calls, so you get things like this happening:

code:
>>> def test_def(x = []):
...     x.append(1)
...     return x
... 
>>> test_def()
[1]
>>> test_def()
[1, 1]
>>> test_def()
[1, 1, 1]
>>> test_def()
[1, 1, 1, 1]
Had me spinning for a bit.

you fell victim to one of the classic blunders

Corla Plankun
May 8, 2007

improve the lives of everyone
I'm just really glad it is rare enough that none uses it that way on purpose

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Corla Plankun posted:

I'm just really glad it is rare enough that none uses it that way on purpose

lol good one

Carthag Tuek
Oct 15, 2005

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



sweet, my epub decryption script still works. just loaded up on some more books :cool:

cool av
Mar 2, 2013

Subjunctive posted:

the client’s authentication could be a cookie, or an Authorization header token, or a client certificate for TLS, or simply being on an internal network for some cases

well don’t auto send auth headers either of course. I don’t know about client certs, but local network is a good example and it’s funny IME that sites authenticated that way are likely to have cors disabled!

CPColin
Sep 9, 2003

Big ol' smile.

Carthag Tuek posted:

sweet, my epub decryption script still works. just loaded up on some more books :cool:

Eyy, I've got one of those too. Shout-out to Hoopla for calling theirs decrypt.ts and not minifying it!

Adbot
ADBOT LOVES YOU

Carthag Tuek
Oct 15, 2005

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



CPColin posted:

Eyy, I've got one of those too. Shout-out to Hoopla for calling theirs decrypt.ts and not minifying it!

:hfive:

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