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
Armitag3
Mar 15, 2020

Forget it Jake, it's cybertown.


FlapYoJacks posted:

F-strings should be used everywhere possible.

I think I read somewhere that you shouldn’t use them when logging but i don’t remember why or even if it makes sense

Adbot
ADBOT LOVES YOU

FlapYoJacks
Feb 12, 2009

Armitag3 posted:

I think I read somewhere that you shouldn’t use them when logging but i don’t remember why or even if it makes sense

The official logging library uses lazy evaluation for string interpretation yeah. Gotta go with logger.info("%s: Turn your monitor on.", name)

edit: You can also set the style using logging.basicConfig either to '%', '{' or '$'. https://docs.python.org/3/library/logging.html#logging.basicConfig

FlapYoJacks fucked around with this message at 02:39 on Jan 14, 2024

mystes
May 31, 2006

FlapYoJacks posted:

edit: You can also set the style using logging.basicConfig either to '%', '{' or '$'. https://docs.python.org/3/library/logging.html#logging.basicConfig
gross

tef
May 30, 2004

-> some l-system crap ->
today i learned that ?>!:,< is a valid key name in yaml

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.

prisoner of waffles posted:

f-strings are fine.

the f is for fine

I would like to revise my earlier statement: if it is possible to write an f-string where one of the interpolated expressions is itself an f-string (presumably using different quotation marks?) then that is forbidden and shameful. that way lies the greatest sins of JSX

FlapYoJacks
Feb 12, 2009

prisoner of waffles posted:

I would like to revise my earlier statement: if it is possible to write an f-string where one of the interpolated expressions is itself an f-string (presumably using different quotation marks?) then that is forbidden and shameful. that way lies the greatest sins of JSX

Nested f-strings are fine.

Dylan16807
May 12, 2010

prisoner of waffles posted:

I would like to revise my earlier statement: if it is possible to write an f-string where one of the interpolated expressions is itself an f-string (presumably using different quotation marks?) then that is forbidden and shameful. that way lies the greatest sins of JSX
you do need different quotes, which seems like a pointless annoyance

with JSX, or javascript template strings, the code inside the {} is parsed like completely normal code

redleader
Aug 18, 2005

Engage according to operational parameters

tef posted:

today i learned that ?>!:,< is a valid key name in yaml

i think a parser that breaks compat with the spec for this is fine, tbh

Visions of Valerie
Jun 18, 2023

Come this autumn, we'll be miles away...

FlapYoJacks posted:

F-strings should be used everywhere possible.

sure would be nice if they worked for binary strings. loving python

FlapYoJacks
Feb 12, 2009

Visions of Valerie posted:

sure would be nice if they worked for binary strings. loving python

And floats for some reason.

akadajet
Sep 14, 2003

air on a f-string

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

tef posted:

today i learned that ?>!:,< is a valid key name in yaml

it's a syntactically valid composition in k, too, but it doesn't do anything useful

"distinct of grade-down of odometer of enclose of less"

the colon is redundant, since ! is textually forced to be monadic already, but some dialects tolerate it

Internet Janitor fucked around with this message at 05:14 on Jan 14, 2024

Visions of Valerie
Jun 18, 2023

Come this autumn, we'll be miles away...

FlapYoJacks posted:

And floats for some reason.

don't they?

Python code:

>>> d = 1.01
>>> f"{d}"
'1.01'
>>> type(d)
<class 'float'>

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

anyone want to make a new compiler for me? my idea is that it should have 100% compatibility with existing python code but compile down into small binary executables and run faster than c in most benchmarks. ill give you partial credit for implementing my idea so you can put it on your resume

Arcteryx Anarchist
Sep 15, 2007

Fun Shoe

fart simpson posted:

anyone want to make a new compiler for me? my idea is that it should have 100% compatibility with existing python code but compile down into small binary executables and run faster than c in most benchmarks. ill give you partial credit for implementing my idea so you can put it on your resume

https://cython.readthedocs.io/en/latest/src/tutorial/cython_tutorial.html

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

Internet Janitor posted:

it's a syntactically valid composition in k, too, but it doesn't do anything useful

"distinct of grade-down of odometer of enclose of less"

the colon is redundant, since ! is textually forced to be monadic already, but some dialects tolerate it

what

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

rjmccall posted:

openmp is meant to be a performance optimization, and supporting it well so that it’s actually, y’know, faster requires major system and toolchain integration work.

this is the real heart of the matter right here: it’s not just something where a switch can be flipped and it makes code faster, but its adopters expect to behave that way (and the language in OP’s post seems to imply that’s how they see it)

it would take a large amount of work to actually have it implemented in a way that will provide the expected benefit, and the code in the wild that could take advantage of that is pretty sparse

Dylan16807
May 12, 2010

each character is a function

boolean less-than -> odometer -> grade-down -> distinct

so as far as I can tell:

the less-than will output 0 or 1

it's fed into odometer which counts up from 0 but since the input is 0 or 1 the output is a list containing 0

that's fed into grade-down which tells you how to sort numbers, which doesn't do anything useful with odometer ever, but in this particular situation also outputs a list containing 0

then distinct gives you every distinct element in a list, so it also outputs a list containing 0

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

2Fast2Nutricious posted:

how do you even become a compiler developer? i dont even know what skills you need to have to be one

it’s just code, it’s not magic

FlapYoJacks
Feb 12, 2009

Visions of Valerie posted:

don't they?

Python code:
>>> d = 1.01
>>> f"{d}"
'1.01'
>>> type(d)
<class 'float'>

Sorry, I meant precision:

Python code:
print(f"0x{255:8.8X}")

quote:

print(f"0x{255:8.8X}")
^^^^^^^^^^
ValueError: Precision not allowed in integer format specifier

Visions of Valerie
Jun 18, 2023

Come this autumn, we'll be miles away...

FlapYoJacks posted:

Sorry, I meant precision:

Python code:
print(f"0x{255:8.8X}")

Oh, that. Yeah that sucks

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

Dylan16807 posted:

each character is a function

boolean less-than -> odometer -> grade-down -> distinct

so as far as I can tell:

the less-than will output 0 or 1

it's fed into odometer which counts up from 0 but since the input is 0 or 1 the output is a list containing 0

that's fed into grade-down which tells you how to sort numbers, which doesn't do anything useful with odometer ever, but in this particular situation also outputs a list containing 0

then distinct gives you every distinct element in a list, so it also outputs a list containing 0


Visions of Valerie posted:

Oh, that. Yeah that sucks

FlapYoJacks
Feb 12, 2009
The Something Awful Forums > Discussion > Serious Hardware/Software Crap > YOSPOS > PL thread:

Visions of Valerie posted:

Oh, that. Yeah that sucks

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Brain Candy posted:

please don't mention the m-word

matlab

Arcteryx Anarchist
Sep 15, 2007

Fun Shoe
mathematica
maple

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

merl

CPColin
Sep 9, 2003

Big ol' smile.
MUMPS

Arcteryx Anarchist
Sep 15, 2007

Fun Shoe

you don’t get in on it

Arcteryx Anarchist
Sep 15, 2007

Fun Shoe
keep that poo poo in wisconsin

Visions of Valerie
Jun 18, 2023

Come this autumn, we'll be miles away...

indexing my arrays from 1, achieving smoothest brain possible

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

one-indexing is contrarian but acceptable, but column-major?? get the gently caress out of here

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.
many are the crimes of matlab, including cells (vectors, matrices, or tensors of pointers) and “every N-dimensional matrix is also a column-vector.” MATLAB OOP also seems totally gross.

However, their datatable implementation and interface is actually pretty good; I’d be very happy to have it instead of the pandas equivalent— assuming the MATLAB table was reimplemented in Python.

never messed with polars yet but it looked very pandas-ish.

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003
1-index column-major is a fortran thing, surely that's where matlab got it from

Arcteryx Anarchist
Sep 15, 2007

Fun Shoe
lua is also one indexed

Cybernetic Vermin
Apr 18, 2005

we should not go one-indexed *now* as the retraining would be ridiculous, but having done both extensively there's for sure more off-by-ones doing 0-indexed.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Perl can be 1-based indexing, but, you know, it’s up to you

Arcteryx Anarchist
Sep 15, 2007

Fun Shoe
i have to deal with mixed indexed code, where im dealing with data in a zero indexed python environment but it will be interpreted in a 1 indexed environment on the other side

JawnV6
Jul 4, 2004

So hot ...
having a hard time reading the python complaints from a few pages back as someone who used to get paid to maintain perl written by EE's

"oooh my modules took me an hour to sort out file paths"

there were functions with no call sites, they'd just bodge up the name on the spot and eval() it. you'd weep

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
column-major matrix layout is a perfectly reasonable thing, and a lot of algorithms are written for it. it’s unfortunate that it doesn’t match the natural layout of nested arrays, but nested arrays are usually a lazy way to implement 2D matrices anyway

Adbot
ADBOT LOVES YOU

VikingofRock
Aug 24, 2008




Clearly the solution is to use Haskell's Arrays, where you decide at construction time how to index the arrays. You can do 0-indexed, 1-indexed, 2-indexed, or even tuple-indexed (great for mapping 2D matrices onto contiguous memory)!

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