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
jesus WEP
Oct 17, 2004


Share Bear posted:

black, mypy, and flake8 rule, great tools use em all the time
youre already a great tool for using python in the first place

Adbot
ADBOT LOVES YOU

Bloody
Mar 3, 2013

my goodness high dpi stuff on windows is a bit of a mess. like its very clearly dramatically better than just a few years ago, but still.

also, how the hell can i test any of this. horrible

shoeberto
Jun 13, 2020

which way to the MACHINES?
Some of the blackisms turned me off when I evaluated it, like the quote switching and the way it determines line breaking for the max width. But I have been evaluating yapf a bit and it seems pretty good out of the box, though I upped the line width.

The new employee under me has really taken ownership of getting styling right in the Python repo, which has been great.

Shaggar
Apr 26, 2006

Bloody posted:

my goodness high dpi stuff on windows is a bit of a mess. like its very clearly dramatically better than just a few years ago, but still.

also, how the hell can i test any of this. horrible

if ur talking about how to fix it for your winforms app, its just bad. i ended up disabling dpi awareness and letting windows scale everything and that seemed to fix most issues, but if you're using the form editor on a high dpi machine it still is sucks.

Share Bear
Apr 27, 2004

jesus WEP posted:

youre already a great tool for using python in the first place

lmao :angel:

Share Bear fucked around with this message at 22:14 on Feb 3, 2021

Bloody
Mar 3, 2013

Shaggar posted:

if ur talking about how to fix it for your winforms app, its just bad. i ended up disabling dpi awareness and letting windows scale everything and that seemed to fix most issues, but if you're using the form editor on a high dpi machine it still is sucks.

yeah our baseline right now is disabled and we dont use the form editor, my mission is to figure out how to enable it some day. i think the answer is: rewrite 95% of the ui in wpf and host 2 ultra custom controls that already know how to zoom (& so are trivial to add dpi support to) in WindowsFormsHosts

Shaggar
Apr 26, 2006
someone was clever and made one form in our winforms app in wpf and every time that loads for the first time it takes like 5 seconds. it also had really hosed dpi handling and i dont remember how i fixed it.

if you do something clever like that you should probably see if you can preload the wpf components so it doesnt murder your app the first time the user loads one.

Bloody
Mar 3, 2013

yeah we're a hybrid app already so there's either poo poo that's handling that in places or we just yolo it idk

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.


Bloody posted:

yeah we're a hybrid app already so there's either poo poo that's handling that in places or we just yolo it idk

sml idc/idgaf tbqh

not that I blame you

tk
Dec 10, 2003

Nap Ghost

Bloody posted:

yeah our baseline right now is disabled and we dont use the form editor, my mission is to figure out how to enable it some day. i think the answer is: rewrite 95% of the ui in wpf and host 2 ultra custom controls that already know how to zoom (& so are trivial to add dpi support to) in WindowsFormsHosts

You're supposed to rewrite it as a local webserver with a react ui duh.

Shaggar
Apr 26, 2006
with our app at some point in the next year or so we're gonna start overhauling it and im considering converting it to a webapp with fully server side application state. the idea being when dumbass users close the browser they can just go back to the webapp and be immediately back where they were.

i dont know if the current team is right for it tho.

cool av
Mar 2, 2013

allowing both single- and double-quotes for strings in a language is wrong

FlapYoJacks
Feb 12, 2009
Yeah, the whole idea behind black is that you relinquish control over your formatting and let black do the formatting for you. It may have some oddities that bother you, but it’s better than manual formatting your files, and it can be automated.

cool av
Mar 2, 2013

Shaggar posted:

with our app at some point in the next year or so we're gonna start overhauling it and im considering converting it to a webapp with fully server side application state. the idea being when dumbass users close the browser they can just go back to the webapp and be immediately back where they were.

i dont know if the current team is right for it tho.

you gonna store the state in sql server? ive done this in an app layer and it's ok but kind of annoying to do updates

Shaggar
Apr 26, 2006
id still use sql server for the actual data that matters, but idk what i'd use to store the application state. could be sql, could be something less persistent. idk if its even worth while as a concept since it may end up being too much of a pain in the rear end trying to maintain every piece of UI state to make it work.

Nomnom Cookie
Aug 30, 2009



DoomTrainPhD posted:

Yeah, the whole idea behind black is that you relinquish control over your formatting and let black do the formatting for you. It may have some oddities that bother you, but it’s better than manual formatting your files, and it can be automated.

"gently caress you, follow the style guide" was go's best idea. static linking was the other good idea. shame about the rest of the language but what can you do

Nomnom Cookie
Aug 30, 2009



Shaggar posted:

id still use sql server for the actual data that matters, but idk what i'd use to store the application state. could be sql, could be something less persistent. idk if its even worth while as a concept since it may end up being too much of a pain in the rear end trying to maintain every piece of UI state to make it work.

sounds like you're talking about DIY'ing viewstate and also persisting it

FlapYoJacks
Feb 12, 2009

Nomnom Cookie posted:

"gently caress you, follow the style guide" was go's best idea. static linking was the other good idea. shame about the rest of the language but what can you do

Agreed on all counts.

Bored Online
May 25, 2009

We don't need Rome telling us what to do.

cool av posted:

allowing both single- and double-quotes for strings in a language is wrong

singles are for keying a dictionary. doubles for everything else

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
the important part about allowing single and double quoted strings is to have subtly different semantics for each

the next important part is to add a dozen other kinds of string literals with various spellings, making your single and double quote differences seem downright hostile in comparison

TimWinter
Mar 30, 2015

https://timsthebomb.com

pokeyman posted:

the important part about allowing single and double quoted strings is to have subtly different semantics for each

At least this is not widespread. I'd talk more but I'm debugging this weird dockerfile issue where the CMD line refuses to work due to some invisible, nigh indiscernible reason.

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.

Nomnom Cookie posted:

"gently caress you, follow the style guide" was go's best idea. static linking was the other good idea. shame about the rest of the language but what can you do
Static linking aka distributed third-party vulnerabilities

Cybernetic Vermin
Apr 18, 2005

Shaggar posted:

id still use sql server for the actual data that matters, but idk what i'd use to store the application state. could be sql, could be something less persistent. idk if its even worth while as a concept since it may end up being too much of a pain in the rear end trying to maintain every piece of UI state to make it work.

do you actually need to go so far as to persist the state? seems like 99% of the advantage would be in just keeping sessions alive until memory pressure forces the oldest ones to close. and depending on the number of clients just having enough memory to make this largely indistinguishable from indefinitely.

cowboy beepboop
Feb 24, 2001

Nomnom Cookie posted:

"gently caress you, follow the style guide" was go's best idea. static linking was the other good idea. shame about the rest of the language but what can you do

rust tried to copy 'go fmt' and then let you define your own style rules :rolleyes:

champagne posting
Apr 5, 2006

YOU ARE A BRAIN
IN A BUNKER

my stepdads beer posted:

rust tried to copy 'go fmt' and then let you define your own style rules :rolleyes:

are there at least default rules most people wouldn't tinker with?

Bloody
Mar 3, 2013

I didn't even know you could change the cargo fmt rules lol

Share Bear
Apr 27, 2004

pokeyman posted:

the important part about allowing single and double quoted strings is to have subtly different semantics for each

the next important part is to add a dozen other kinds of string literals with various spellings, making your single and double quote differences seem downright hostile in comparison

i absolutely hate this aspect of python

there's "raw" strings, typically used for regexes but only offer that backslashes are literal characters

code:
r"\d+"
, and "format" strings, which have templates and call an stl function ~magically~

code:
drink = "piss"
print(f"i want {drink}")
both are terrible and are due to people valuing typing less over readable code,

you can have the template logic by using the .format() method applicable to any string instead

code:
drink = "piss"
print("i want {}".format(drink))
which i think is better as it's less magical but this is a point of contention w other p devs

black is good, useful, and helps pay my bills

Share Bear fucked around with this message at 15:58 on Feb 4, 2021

shoeberto
Jun 13, 2020

which way to the MACHINES?

DoomTrainPhD posted:

Yeah, the whole idea behind black is that you relinquish control over your formatting and let black do the formatting for you. It may have some oddities that bother you, but it’s better than manual formatting your files, and it can be automated.

Fundamentally I'm on board with that, but I still gotta look at it, so if I'm going to get something auto-formatted I don't want it to do changes that I think look dumb or mess with the ergonomics of development. In my (brief) evaluation, yapf does a better job of letting you have a few knobs for that, while still preventing devs from going off the rails.

ikanreed
Sep 25, 2009

I honestly I have no idea who cannibal[SIC] is and I do not know why I should know.

syq dude, just syq!

Share Bear posted:

i absolutely hate this aspect of python

there's "raw" strings, typically used for regexes but only offer that backslashes are literal characters

code:
r"\d+"
, and "format" strings, which have templates and call an stl function ~magically~

code:
drink = "piss"
print(f"i want {drink}")
both are terrible and are due to people valuing typing less over readable code,

you can have the template logic by using the .format() method applicable to any string instead

code:
drink = "piss"
print("i want {}".format(drink))
which i think is better as it's less magical but this is a point of contention w other p devs

black is good, useful, and helps pay my bills

I love fixing "thing: {} other thing{} similar-sounding-thing{} over{}and{}over{}and{}over{}".format(can, you, keep, track, of, all, these.positional, arguments) calls that are completely unreadable because my teammates think new features are inherently unreadable.

Versus f""thing: {can} other thing{you} similar-sounding-thing{keep} over{track}and{of}over{all}and{these.positional}over{arguments}"

Not knowing where a variable is even going to be decomposed to or what format arguments go with it, or anything, it's frustrating as hell and totally unusable.

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?
calling format strings "less readable" is ridiculous

HappyHippo fucked around with this message at 17:32 on Feb 4, 2021

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?
also i do like the idea of simply prepending the strings with a letter vs having a bunch of different quotes with different abilities, like ` or ' or " or """ meaning different things

which is not to say that python is free of that, with """ and all.

Corla Plankun
May 8, 2007

improve the lives of everyone

HappyHippo posted:

calling format strings "less readable" is ridiculous

yeah, mega agreed

for a one-parameter format i guess who cares (hell, you can even use the % syntax idgaf) but if you have multiple things to format the other alternatives get gross really fast, especially if the parameter appears multiple times in the template

fstrings are one of the best things to happen to python and if they had included them in python 3 i bet a lot of python 2ers would've switched (because i have upgraded projects from 3.something to 3.7 specifically for the glory of fstrings

Corla Plankun
May 8, 2007

improve the lives of everyone
and it isn't magic, it just turns it into a string the same way anything else would with str() or repr() if you use !r

CPColin
Sep 9, 2003

Big ol' smile.
My favorite is Groovy with its single- and double-quote strings where if you use the wrong one to index into a java.util.Map, it'll only ever return null, because one of those strings uses GString as its class.

Also, GString lol

ikanreed
Sep 25, 2009

I honestly I have no idea who cannibal[SIC] is and I do not know why I should know.

syq dude, just syq!

Corla Plankun posted:

and it isn't magic, it just turns it into a string the same way anything else would with str() or repr() if you use !r

Actually, no. It's literally just transformed behind the scenes into string.format(locals()). Which means that it's doing all the string formatting stuff that string.format always does, precision, casting, padding, all depends on the formatting arguments you provide.

shoeberto
Jun 13, 2020

which way to the MACHINES?
PHP has broken me because anytime I see double quotes I just assume some magic interpolation is going to happen.

Share Bear
Apr 27, 2004

ikanreed posted:

I love fixing "thing: {} other thing{} similar-sounding-thing{} over{}and{}over{}and{}over{}".format(can, you, keep, track, of, all, these.positional, arguments) calls that are completely unreadable because my teammates think new features are inherently unreadable.

Versus f""thing: {can} other thing{you} similar-sounding-thing{keep} over{track}and{of}over{all}and{these.positional}over{arguments}"

Not knowing where a variable is even going to be decomposed to or what format arguments go with it, or anything, it's frustrating as hell and totally unusable.

you can also do that with

code:
x = "my template string is {adjective}"
print(x.format(adjective="better"))
i should've been more clear f" sucks, but the templating itself is good

ikanreed posted:

Actually, no. It's literally just transformed behind the scenes into string.format(locals()). Which means that it's doing all the string formatting stuff that string.format always does, precision, casting, padding, all depends on the formatting arguments you provide.

that's magic man, i'm going to have explicit code as much as i can



Share Bear fucked around with this message at 18:12 on Feb 4, 2021

Nomnom Cookie
Aug 30, 2009



Share Bear posted:

you can also do that with

code:
x = "my template string is {adjective}"
print(x.format(adjective="better"))
i should've been more clear f" sucks, but the templating itself is good


that's magic man, i'm going to have explicit code as much as i can

if you dont like magic dont use python tbh, f-strings are great

Share Bear
Apr 27, 2004

Nomnom Cookie posted:

if you dont like magic dont use python tbh, f-strings are great

they're actually not and you're all wrong

also thinking about the magic i do like and i wonder what list comps get turned into, should look into that

Adbot
ADBOT LOVES YOU

Bloody
Mar 3, 2013

f-strings look like c#'s $strings which are great. only time to use string.format is when you have some localized string to stuff with numbers or w/e

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