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
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?

tef posted:

fwiw the paper https://dl.acm.org/doi/pdf/10.1145/3485513 has this as the contributions

I think these were common implementation idioms for LISP compilers in the 1970s

Adbot
ADBOT LOVES YOU

b0lt
Apr 29, 2005

Subjunctive posted:

there was a Python implementation on top of the CLR, but it didn’t have compatibility with the world of C extensions so nobody took it seriously. I think it was IronPython?

there was also boo, which adds static typing with inference. if you're going to drop compatibility with existing code, you might as well make the language not suck rear end while you're at it

Bloody
Mar 3, 2013

python seems impossibly bad why do people use it. all they’re doing is gluing together c code anyways. seems miserable

pseudorandom name
May 6, 2007

because the alternatives are perl or bash

Shaggar
Apr 26, 2006
or just use the c directly

Arcteryx Anarchist
Sep 15, 2007

Fun Shoe

Bloody posted:

python seems impossibly bad why do people use it. all they’re doing is gluing together c code anyways. seems miserable

because it has a large software catalog and works nice with scientific software

people try to build better things but it's pretty established

Bloody
Mar 3, 2013

it’s 2024 we’ve been in the future for a while now everything has trivial c interop

Arcteryx Anarchist
Sep 15, 2007

Fun Shoe
does everything have cython?

Bloody
Mar 3, 2013

Arcteryx Anarchist posted:

because it has a large software catalog and works nice with scientific software

people try to build better things but it's pretty established

a large library of garbage

people still probably use matlab a lot though. scientific software types have never been the brightest

Arcteryx Anarchist
Sep 15, 2007

Fun Shoe
one piece of software ive worked on started out as matlab iirc and then transitioned into c/lua, into an even more messy kluge of software, and is now on its way to being python (hopefully)

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
if you're writing a 50 line or less script it does not matter what you use to write it; you can get away with literally any language, no matter how flawed, and it'll be fine

the basics of python are apparently simple and unsurprising, so nobody's afraid of using it

much like php, python has a huge stdlib and can do a lot of stuff out of the box

put those two facts together and python is essentially a glue-trap for greenfield software development

Carthag Tuek
Oct 15, 2005

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



we use python to build/update our solr indexes

the scripts are fairly simple, basically they run a bunch of sql, massage it into json, and send it off to solr

for the most recent index though, i added some end points to our backend, since it can already generate 75% of the json needed. so basically the newest script just asks the backend for the objects, adds whatever is missing, and sends that off. no sql

doing the whole thing in the backend would be a pain in the rear end so we went the simplest route

Nomnom Cookie
Aug 30, 2009



Bloody posted:

python seems impossibly bad why do people use it. all they’re doing is gluing together c code anyways. seems miserable

the important decisions on any software project were always made five years ago by someone completely unqualified to make them, and half your time is spent dealing with the consequences

Zlodo
Nov 25, 2006

Internet Janitor posted:

if you're writing a 50 line or less script it does not matter what you use to write it; you can get away with literally any language, no matter how flawed, and it'll be fine

the basics of python are apparently simple and unsurprising, so nobody's afraid of using it

much like php, python has a huge stdlib and can do a lot of stuff out of the box

put those two facts together and python is essentially a glue-trap for greenfield software development

I'm working on a small python script (not by choice, its a photoshop script part of a tool we're making and the people who will end.l up maintaining it wanted it to be in python ) and I disagree, it's complete crap

like I have a bunch of helper functions and want to move them to a separate .py file and I ended up having to mess with paths and poo poo because the module system is loving convoluted

Soricidus
Oct 21, 2010
freedom-hating statist shill

mystes posted:

both ironpython and jython were pretty neat honestly

but yeah without extension compatibility there isn't much point

without extension compatibility they aren’t replacements for cpython in scientific computing etc, but that’s not the only use case for python. loads of python code doesn’t use c extensions at all.

jython was really useful as a scripting engine for java apps so people didn’t have to touch java unless they wanted to. what killed it was the difficulty of reimplementing everything to support python3.

Cybernetic Vermin
Apr 18, 2005

not writing c is a good first step for most things and projects. python being the choice for gluing little things that can't avoid it is a noble purpose.

python itself little to write home about but it is very sane and has somehow gotten more sane over time (almost unheard of in pl)

BobHoward
Feb 13, 2012

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

Internet Janitor posted:

if you're writing a 50 line or less script it does not matter what you use to write it; you can get away with literally any language, no matter how flawed, and it'll be fine

the basics of python are apparently simple and unsurprising, so nobody's afraid of using it

much like php, python has a huge stdlib and can do a lot of stuff out of the box

put those two facts together and python is essentially a glue-trap for greenfield software development

see also perl5 and how it lost its place as the standard glue-trap plang to python

hopefully something will come along and do to python what it did to perl, i think that's the only way to make real progress in this space

Carthag Tuek
Oct 15, 2005

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



Zlodo posted:

I'm working on a small python script (not by choice, its a photoshop script part of a tool we're making and the people who will end.l up maintaining it wanted it to be in python ) and I disagree, it's complete crap

like I have a bunch of helper functions and want to move them to a separate .py file and I ended up having to mess with paths and poo poo because the module system is loving convoluted

?? if the files are in the working directory you just import them

Zlodo
Nov 25, 2006

Carthag Tuek posted:

?? if the files are in the working directory you just import them

I don't want to mess with the cwd just so that the script works

mystes
May 31, 2006

Maybe it's an issue with how Photoshop Python scripts work or something?

That's normally not an issue in Python

Carthag Tuek
Oct 15, 2005

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



even running from some other dir with a path to the script will import other py files in the same dir as the script

maybe ps copies the contents into its own process?

redleader
Aug 18, 2005

Engage according to operational parameters

Soricidus posted:

jython was really useful as a scripting engine for java apps so people didn’t have to touch java unless they wanted to. what killed it was the difficulty of reimplementing everything to support python3.

nowadays you simply run a copy of v8 in a subprocess

Zlodo
Nov 25, 2006

Carthag Tuek posted:

even running from some other dir with a path to the script will import other py files in the same dir as the script

didn't work and I had to resort to using some module path stuff I copied from some other script

quote:

maybe ps copies the contents into its own process?

I'm running it as a standalone script because photoshop doesn't directly support python scripting but it have a COM interface

I dunno perhaps it's because i'm using a portable python install that we have on our perforce repo

Carthag Tuek
Oct 15, 2005

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



weird. idk then:shrug:

Zlodo
Nov 25, 2006
no worries, im sort of glad that my annoyance at python remains justified

Athas
Aug 6, 2007

fuck that joker
Can someone remind me why it's actually cool & good that Apple disables OpenMP in their gcc-impersonating C compiler?

Cybernetic Vermin
Apr 18, 2005

there's many things one can say about pythons module support, but "convoluted" is not among them

Sweeper
Nov 29, 2007
The Joe Buck of Posting
Dinosaur Gum

Cybernetic Vermin posted:

there's many things one can say about pythons module support, but "convoluted" is not among them

Namespace packages are definitely weird and complicated, people invoking interpreter with a path instead of -m also can mess up imports

Carthag Tuek
Oct 15, 2005

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



btw zlodo what version is in your perforce there?

iirc they did some finagling with how imports work a couple minor versions of 3 ago, and also probably 2->3

Zlodo
Nov 25, 2006

Carthag Tuek posted:

btw zlodo what version is in your perforce there?

iirc they did some finagling with how imports work a couple minor versions of 3 ago, and also probably 2->3

3.7.6

Arcteryx Anarchist
Sep 15, 2007

Fun Shoe

BobHoward posted:

see also perl5 and how it lost its place as the standard glue-trap plang to python

hopefully something will come along and do to python what it did to perl, i think that's the only way to make real progress in this space

julia just isn’t going to happen

Share Bear
Apr 27, 2004

Cybernetic Vermin posted:

there's many things one can say about pythons module support, but "convoluted" is not among them

the transformation to writing everything as a script into writing everything as a module is easy to trip up,

cause module packaging requires the magic words __init__py and __main__py (or cramming main into something else via init)

making modules is easy once you learn the magic words. theres a blog post i share about this when it comes up that i cannot find in my bookmarks

Carthag Tuek
Oct 15, 2005

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




ah well. looks like it as 3.3 i was thinking of
https://docs.python.org/3.10/whatsnew/3.3.html#using-importlib-as-the-implementation-of-import

fwiw ive done some __path__ fuckery in my time, but thats always been for loading things like config or data files that reside with the .py file, never for imports that i can recall

Carthag Tuek fucked around with this message at 16:52 on Jan 12, 2024

tef
May 30, 2004

-> some l-system crap ->

Share Bear posted:

the transformation to writing everything as a script into writing everything as a module is easy to trip up,

cause module packaging requires the magic words __init__py and __main__py (or cramming main into something else via init)

making modules is easy once you learn the magic words. theres a blog post i share about this when it comes up that i cannot find in my bookmarks

python2 eol'd 4 years ago bud

Share Bear
Apr 27, 2004

tef posted:

python2 eol'd 4 years ago bud

i never used python2 so idgi, im doing this in a boring repeatable way with directories as modules

Arcteryx Anarchist
Sep 15, 2007

Fun Shoe
the file is the module

you can use directories to organize modules into groups of submodules if you want to

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Athas posted:

Can someone remind me why it's actually cool & good that Apple disables OpenMP in their gcc-impersonating C compiler?

what a weird way of putting this from someone who iirc actually works on compilers. you might as well be asking why apple disabled fortran for aarch64. like there’s a turnkey perfect openmp implementation that we just spitefully set on fire

openmp is a massive language extension / library. the current openmp spec is considerably longer than the c standard. there is some existing work in clang to support it — i did most of the code review on that, actually — but it is not simple to enable on a new platform because of the nature of the feature. 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. that’s because almost every single thing in openmp involves one or more of (1) offloading (and therefore secondary compilation and (typically) gpu driver support) or (2) cpu parallelism (which would normally be the most turnkey thing here except it obviously would need to be completely reimplemented on top of gcd on apple platforms) or (3) vectorization (which i’m certain you know is always a ton of work to make efficient, especially when the established code has been written assuming a different architecture)

so implementing openmp is a ton of upfront work and an ongoing permanent commitment. and programmer adoption of it in the wild is not really all that high, all things considered. that’s partially circular, i know, but it’s still true

it’s also a c technology at a time when we’re pretty all-in on moving to swift. “here’s a great new technology you should use! you’ll have to use c, please continue doing that for another ten years” is not the message we are going for as a platform. the openmp annotations certainly could be adapted into swift — the spec already presents them in both c and fortran — but that would be yet another major design and implementation task

i don’t want to be completely discouraging; it is something we still talk about from time to time. if you have a pretty good idea of what parts of openmp you’d be interested in using, i can put you in touch with the right people. knowing about more potential clients can’t hurt

rjmccall fucked around with this message at 17:08 on Jan 12, 2024

Share Bear
Apr 27, 2004

Arcteryx Anarchist posted:

the file is the module

you can use directories to organize modules into groups of submodules if you want to

yeah i do this generally. sorry to mismatch terminology as a file is its own module is also correct

it can be easier to organize groups of stuff using the directory method into submodules/packages and calling the entire thing as a module with python -m to the module entry point, but thats not as intuitive or simple as running a single file directly (cause then you gotta set up the module structure)

i hope thats a clearer expression of my point

Arcteryx Anarchist
Sep 15, 2007

Fun Shoe
also you’re probably better off doing the work to make it a property lib/package if you’re at that point

Adbot
ADBOT LOVES YOU

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
what i find most annoying on the rare occasions i need to write a python script is that the stdlib, while reasonably comprehensive, is completely scattershot in its approach to everything. it's even odds that a given module will expect an imperative style (bang on these magic functions and mutable values in sequence), a functional style (everything makes new copies of stuff), or a pointlessly object-oriented style (instantiate a parser whatzit, set fields to configure it, call a method and get back some other inscrutable piece of crap instead of just giving me the data)

for a glue language it is remarkably inconvenient and awkward to glue together the parts that come in the box

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