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
Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS
Yeah that's the big thing.

If I ever interviewed at a place that dinged me for syntax on a whiteboard I'd laugh at them and walk out backwards firing two guns

....................../´¯/)
....................,/¯../
.................../..../
............./´¯/'...'/´¯¯`·¸
........../'/.../..../......./¨¯\
........('(...´...´.... ¯~/'...')
.........\.................'...../
..........''...\.......... _.·´
............\..............(
..............\.............\...

Adbot
ADBOT LOVES YOU

Gul Banana
Nov 28, 2003

you could call this a "binding", or a "value". i don't like "variable" because it doesn't, literally, vary

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Somewhere in there is a significant misunderstanding of what programming actually is.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Gul Banana posted:

you could call this a "binding", or a "value". i don't like "variable" because it doesn't, literally, vary

But it's different in every class I use it in :confused:

Seriously guys can you stop arguing over an extremely common misuse of a word please?

JawnV6
Jul 4, 2004

So hot ...

Munkeymon posted:

Seriously guys can you stop arguing over an extremely common misuse of a word please?

We could talk about "engineer" instead?

baquerd
Jul 2, 2007

by FactsAreUseless

JawnV6 posted:

We could talk about "engineer" instead?

quote:

I am an Engineer.

In my profession I solve practical problems. To it I owe solemn obligations.

Since the Stone Age, Human Progress has been spurred by the Engineering Genius. Engineers have made usable Nature's vast resources of Materials and Energy for Humanity's Benefit.

Engineers have vitalized and turned to practical use the Principles of Science and the Means of Technology. Were it not for this heritage of accumulated experiences, my efforts would be feeble.

As an engineer, I, (full name), pledge to practice Integrity and Fair Dealing, Tolerance, and Respect, and to uphold devotion to the standards and dignity of my profession, conscious always that my skill carries with it the obligation to serve humanity by making best use of the Earth's precious wealth.

As an engineer, I shall participate in none but honest enterprises. When needed, my skill and knowledge shall be given without reservation for the public good. In the performance of duty, and in fidelity to my profession, I shall give the utmost.

baquerd
Jul 2, 2007

by FactsAreUseless

This is my IDE. There are many like it, but this one is mine.

My IDE is my best friend. It is my life. I must master it as I must master my life.

My IDE, without me, is useless. Without my IDE, I am useless. I must use my IDE true. I must code faster than my enemy who is trying to beat me. I must release code before he releases his. I will...

My IDE and I know that what counts in code is not the number of lines, the libraries used, nor the tests we write. We know that it is the features that count. We will succeed...

My IDE is human, even as I, because it is my life. Thus, I will learn it as a brother. I will learn its weaknesses, its strength, its parts, its accessories, its keybindings and its macros. I will keep my IDE clean and ready, even as I am clean and ready. We will become part of each other. We will...

Before God, I swear this creed. My IDE and I are the defenders of my company. We are the masters of our enemy. We are the saviors of my life.

So be it, until victory is ours and there is no enemy, but AI!

My Rhythmic Crotch
Jan 13, 2011

:captainpop:

baquerd
Jul 2, 2007

by FactsAreUseless

Now you know why they call them coding bootcamps.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Munkeymon posted:

But it's different in every class I use it in :confused:

Seriously guys can you stop arguing over an extremely common misuse of a word please?

It's not a mis-use. The name identifies a variable quantity rather than a constant quantity. This use in mathematics predates computer science and mutable memory by two hundred years. You don't get to wish away the historical context of words just because it makes things a little less tidy and unambiguous in the present day.

Coin
Jan 9, 2006

I'm no shitposter; I always know how I'm posting is wrong. I'm just a guy that doesn't like reading the thread, effortposting, and respecting the mods. So if you think about it, I'm the best poster here.
Here's some homework I submitted a couple of months ago. In my defense, this was for an intro class and I hadn't learned that lists were a thing yet.

Also, I just noticed that I was apparently still weak on while loops.
code:
def fibonacci(n):
	if n<=1:
		return n
	elif n==2:
		return 1
	elif n>=3:
		fibon1=1
		fibon2=1
		fibonCounter=0
		while fibonCounter<n-2:
			newFibon=fibon1+fibon2
			fibonCounter+=1
			fibon1=fibon2
			fibon2=newFibon
		if fibonCounter==n-2:
				return newFibon

Coin fucked around with this message at 22:20 on Dec 8, 2014

BigRedDot
Mar 6, 2008

seiken posted:

It's an inconsistent, backwards mess of a language that doesn't align in any way with its stated goals.
You cherry picking a few cases where something might not meet some stated goals, is not the same as that thing not meeting any stated goals. That's how logic works. (This is not to imply I agree with all of your assessments, either; I don't, though some have some merit)

quote:

What Python is good at is being a slightly less terrible bash, for couple-hundred line scripts.
Or, you know, doing productive work (witness: NumPy, SciPy, IPython, Scikit-Learn, the entire constellation of scientific packages), or building ten billion dollar companies, which surely must get your goat!


WRT to teaching python being hard. I've taught ~forty classes to a few thousand students on every continent save antarctica in the last two years. Some of them started with "print x" and some of them ended with the descriptor protocol and metaclasses. It's not hard to teach lexical self, nor is it hard to teach python's scoping rules (which, BTW, are "different" which is distinct from "wrong"). It's really not any harder to understand an ordered sequence of scopes than it is to understand a nested hierarchy of scopes.

Pollyanna
Mar 5, 2005

Milk's on them.


I understand lexical self. If I can understand lexical self, anyone can understand lexical self.

ephphatha
Dec 18, 2009




Fuuuuuck coders who can't give functions sensible names.

code:
procedure update_foo(bar, baz)
begin
  loop --over things
    if thing_valid then
      check_bar(bar);
    end if;
    update_foo(bar, baz);
  end loop;
end; 
(Trimmed from a few hundred lines and only showing one of four identical functions)

Sitting here wondering how the gently caress this code was meant to do anything since it only recursively called itself and never performed an update, so I decided to check out what the check_bar function did.

code:
procedure check_bar(bar)
begin
  --check if bar exists
  if bar_found then
    --update
  else
    --insert
  end if;
end; 

Real loving obvious naming guys, thanks.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Ephphatha posted:

Fuuuuuck coders who can't give functions sensible names.

code:
procedure update_foo(bar, baz)
begin
  loop --over things
    if thing_valid then
      check_bar(bar);
    end if;
    update_foo(bar, baz);
  end loop;
end; 
(Trimmed from a few hundred lines and only showing one of four identical functions)

Sitting here wondering how the gently caress this code was meant to do anything since it only recursively called itself and never performed an update, so I decided to check out what the check_bar function did.

code:
procedure check_bar(bar)
begin
  --check if bar exists
  if bar_found then
    --update
  else
    --insert
  end if;
end; 
Real loving obvious naming guys, thanks.

You haven't lived until you've dealt with code with methods named x, y, xx, xy, etc. With equally inscrutable variable names within the method body.

The culprit: An intern who spoke English well, but had very poor written English skills. Her poo poo got caught and fixed during code review, but it was rough.

seiken
Feb 7, 2005

hah ha ha

BigRedDot posted:

You cherry picking a few cases where something might not meet some stated goals, is not the same as that thing not meeting any stated goals. That's how logic works. (This is not to imply I agree with all of your assessments, either; I don't, though some have some merit)

I think you're confusing me with InternetJanitor, I didn't post any examples of Python missing goals. I might write a long blog post one day, but it's kind of obvious anyway

BigRedDot posted:

Or, you know, doing productive work (witness: NumPy, SciPy, IPython, Scikit-Learn, the entire constellation of scientific packages), or building ten billion dollar companies, which surely must get your goat!

:confused: no, it doesn't get my goat. It's not personal. I work for such a many-billion-dollar company that uses Python extensively, and I write a lot of Python for my job. The fact that it is possible to do useful work in Python does not preclude it from being a haphazard, inconsistently-designed minefield with unnecessary flaws just about everywhere you look.

If you consider random anecdotes about companies convincing, perhaps consider that the one you mentioned is rewriting their code in Go, along with Google and everyone else that realised how completely unmaintainable large Python codebases are

seiken fucked around with this message at 13:34 on Dec 9, 2014

Hughlander
May 11, 2005

BigRedDot posted:

Or, you know, doing productive work (witness: NumPy, SciPy, IPython, Scikit-Learn, the entire constellation of scientific packages), or building ten billion dollar companies, which surely must get your goat!

By that logic PHP must be even better as Facebook has a higher valuation!

Karate Bastard
Jul 31, 2007

Soiled Meat
I wish I could find that internet security course excerpt again, where they showed you how you could encrypt credit card numbers with base64_encode(x) in php. Does anyone have it?

e: Aaaaahahahahaargh here it is! Turns out it was just an ehow idiocy dump and not a proper internet security course, which makes it a little better. Still hilarious though :)

Karate Bastard fucked around with this message at 15:59 on Dec 9, 2014

Pythagoras a trois
Feb 19, 2004

I have a lot of points to make and I will make them later.
Hosting horror, my VPS provider decided to go from KVM to OpenVZ, terminating all KVM services in January (including a server I run). I've been working on new fab scripts to move the system to AWS, then overnight the provider I currently have shut down my server. I contacted their support and they replied, verbatim:

quote:

I am sorry. We did not hear back from you on any of our emails with respect to your desire to continue. A full refund has been given and your server will remain online for an additional 24 hours.

A month and a half notice cut down to 24 hours. The cost of the server is a drop in the bucket compared to the labor it takes to fab a new server and migrate users / services. After insisting there was nothing to be done the support staff simply stopped responding to email.

This is why you vet your hosting providers carefully, folks.

JawnV6
Jul 4, 2004

So hot ...

seiken posted:

:confused: no, it doesn't get my goat. It's not personal. I work for such a many-billion-dollar company that uses Python extensively, and I write a lot of Python for my job. The fact that it is possible to do useful work in Python does not preclude it from being a haphazard, inconsistently-designed minefield with unnecessary flaws just about everywhere you look.

Coming to Python from perl renders me unable to understand this sentiment.

seiken
Feb 7, 2005

hah ha ha
Perl strikes me as probably worse, but I haven't really used it so I won't pretend to know. Bash is definitely worse. I was only really railing against Python for large projects, anyway. For a couple-hundred line script (at most...), I don't know what you'd use that's more convenient.

sarehu
Apr 20, 2007

(call/cc call/cc)
Python is your basic dynamically typed language. Are there any real flaws, other than that and whitespace sensitivity, that isn't just really petty spergation? Like, flaws that really affect work?

Pythagoras a trois
Feb 19, 2004

I have a lot of points to make and I will make them later.
There's a pretty big gap between the couple of hundred lines upper limit you're claiming as an absolute maximum, and the dropbox example you're using as evidence of its drawbacks.

seiken
Feb 7, 2005

hah ha ha
I mentioned dropbox only to dismiss a ridiculous post implying that the existence of dropbox proves Python is a good language, so uh?

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
Dropbox's initial implementation was almost certainly pgfi and probably would have been unmaintainable garbage in any language given that it began life as a startup's mvp and grew piecemeal from there at a mile a minute.

NFX
Jun 2, 2008

Fun Shoe
What's "pgfi"?

Oh, and if you want to, it's fairly easy to embed Python in a C (or C++) program. You just include python.h, link against the library and make sure the dll (or .so) is handy. But unless you build python yourself, you won't have the debug versions of the libraries. This means you probably want to #undef _DEBUG before you incldue python.h, or it will try to load python27_d.dll instead of python27.dll.

Then you can call Py_Initialize() to load the interpreter, call a lot of functions or even just execute .py files directly, it's pretty easy. Just look out for reference counting (no big deal) and remember that threading is a bit complicated due to the GIL (but not insurmountable).

When you're done, you can call Py_Finalize() to clean up everything. The Python documentation suggests this:

Pythons posted:

This function is provided for a number of reasons. An embedding application might want to restart Python without having to restart the application itself. An application that has loaded the Python interpreter from a dynamically loadable library (or DLL) might want to free all memory allocated by Python before unloading the DLL. During a hunt for memory leaks in an application a developer might want to free all memory allocated by Python before exiting from the application.
Of course, that's a huge load of crap. The very next paragraph warns you that it's completely unreliable:

quote:

The destruction of modules and objects in modules is done in random order; this may cause destructors (__del__() methods) to fail when they depend on other objects (even functions) or modules. Dynamically loaded extension modules loaded by Python are not unloaded. Small amounts of memory allocated by the Python interpreter may not be freed (if you find a leak, please report it). Memory tied up in circular references between objects is not freed. Some memory allocated by extension modules may not be freed. Some extensions may not work properly if their initialization routine is called more than once; this can happen if an application calls Py_Initialize() and Py_Finalize() more than once.

evensevenone
May 12, 2001
Glass is a solid.

sarehu posted:

Python is your basic dynamically typed language. Are there any real flaws, other than that and whitespace sensitivity, that isn't just really petty spergation? Like, flaws that really affect work?

I'd point you to the rules for import resolution, but I don't think anyone actually understands them well enough to write them down in one place.

Also, setuptools / pip / virtualenv. I don't know if those are actually python problems though.

seiken
Feb 7, 2005

hah ha ha

sarehu posted:

Python is your basic dynamically typed language. Are there any real flaws, other than that and whitespace sensitivity, that isn't just really petty spergation? Like, flaws that really affect work?

Plenty, and I don't think the worst of it has come up yet in the thread. To really do it justice I'd like to make an effort post sometime.

But the worst and most systemic stuff is probably the level of dynamism, which goes well beyond mere dynamic typing, to the point where it's not really feasible to enforce any constraints whatsoever on anything any code is doing anywhere, and you inevitably end up with spaghetti you can't reason about

And all the convenient features which seem reasonable and elegant at first glance, but are really just the tip of the iceberg and there's a huge mass of sacrifices and hacks hiding under the surface to make them work

And the community which gleefully abuses all this and throws around terrible advice and meaningless terms like "Pythonic" everywhere

Or "Ask forgiveness, not permission". Hahaha

Edit: the worst bit is if you have a 1,000 line Perl or Bash program everybody knows that's awful, but somehow in Python people just chug along with this shitheap

vvv this discussion did actually prompt me today to start collecting the general opinions, rants, bug reports and so on I've had seen the past few years into a google doc, but yeah I don't know if I'll actually get round to it.

Sorry for being inflammatory. I don't think it's any less honest than the similarly-unsubstantiated "obviously Python is good and you're probably wrong", but yeah I shouldn't be all like that.

seiken fucked around with this message at 19:12 on Dec 9, 2014

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Stop saying probably wrong things that many people are obviously going to disagree with you on and then going "but I'm not going to explain them except in some amazing magnum opus that I'm not actually going to write".

That's bullshit inflammatory arguing.

Soricidus
Oct 21, 2010
freedom-hating statist shill

Thermopyle posted:

Stop saying probably wrong things that many people are obviously going to disagree with you on and then going "but I'm not going to explain them except in some amazing magnum opus that I'm not actually going to write".

That's bullshit inflammatory arguing.

Actually please carry on doing all that, but in yospos

JawnV6
Jul 4, 2004

So hot ...

seiken posted:

it's not really feasible to enforce any constraints whatsoever on anything any code is doing anywhere, and you inevitably end up with spaghetti you can't reason about

Sounds like a social problem with your team. If you could, you know, toss out any language which actually meets your criteria it might be nice. I'm guessing it's C++?

sarehu
Apr 20, 2007

(call/cc call/cc)
Why would you guess C++?

JawnV6
Jul 4, 2004

So hot ...
It's the funniest language

jneen
Feb 8, 2014
Golang is bad and it makes me sad because they had so much potential. They forgot to add either variants (aka tagged unions) or generics. You're just supposed to use nullables everywhere instead. Joy.

BigRedDot
Mar 6, 2008

seiken posted:

But the worst and most systemic stuff is probably the level of dynamism, which goes well beyond mere dynamic typing, to the point where it's not really feasible to enforce any constraints whatsoever on anything any code is doing anywhere, and you inevitably end up with spaghetti you can't reason about
So is the issue just that you, in particular, work with some lovely team that insists on writing descriptors and metaclasses just for the hell of it, and insists on monkey patching everything in sight? Because not everyone, or even most of everyone, or even a small fraction of everyone, does that. It's pretty specious to claim that it is not possible to reason about all python code because of the most dynamic features that almost no python code uses.

quote:

Edit: the worst bit is if you have a 1,000 line Perl or Bash program everybody knows that's awful, but somehow in Python people just chug along with this shitheap

1000 lines of well-written python is not alot, or unreasonable, or difficult just because you say so.

ExcessBLarg!
Sep 1, 2001

BigRedDot posted:

So is the issue just that you, in particular, work with some lovely team that insists on writing descriptors and metaclasses just for the hell of it, and insists on monkey patching everything in sight? Because not everyone, or even most of everyone, or even a small fraction of everyone, does that. It's pretty specious to claim that it is not possible to reason about all python code because of the most dynamic features that almost no python code uses.
He's not wrong though. These features can be convenient at times when writing short scripts and one-offs. But in the context of a large project it's necessary to be much more disciplined about interfaces as the opportunity to inadvertently wreck some code elsewhere is actually a concern.

It's not just Python though, Perl and Ruby are no better in that regard, and probably considerably worse.

Harik
Sep 9, 2001

From the hard streets of Moscow
First dog to touch the stars


Plaster Town Cop

BigRedDot posted:

So is the issue just that you, in particular, work with some lovely team that insists on writing descriptors and metaclasses just for the hell of it, and insists on monkey patching everything in sight? Because not everyone, or even most of everyone, or even a small fraction of everyone, does that. It's pretty specious to claim that it is not possible to reason about all python code because of the most dynamic features that almost no python code uses.


I use python for django, but not for anything else. Coming from a Java/C++ background, I just can't stand duck-typing and assignment-as-declaration. Also, the requirement to have a compiler and complete development environment on your production system to do anything worthwhile (interface with native libraries) is awful. You can get around that if you lockstep a deployment VM with the exact same pointlevel of everything as your production, then copy the vituralenv over as-is, but that's a hell of a lot of work compared to version-matching some libraries and copying a binary over.

Edit: global becomes undefined local if you assign to it later in a function has nailed me before, it's really unexpected. Would requiring a local (or global) keyword have really been as bad as that?

Harik fucked around with this message at 02:21 on Dec 10, 2014

BigRedDot
Mar 6, 2008

I need to find some actual coding horrors for this thread.

BigRedDot fucked around with this message at 04:59 on Dec 10, 2014

BigRedDot
Mar 6, 2008

Eh NM off topic

BigRedDot fucked around with this message at 04:58 on Dec 10, 2014

Adbot
ADBOT LOVES YOU

QuarkJets
Sep 8, 2008

seiken posted:

But the worst and most systemic stuff is probably the level of dynamism, which goes well beyond mere dynamic typing, to the point where it's not really feasible to enforce any constraints whatsoever on anything any code is doing anywhere, and you inevitably end up with spaghetti you can't reason about

Could you at least conjure an example of whatever problem you're trying to describe here? Your complaint is so vague that it's effectively meaningless

I mean there are a multitude of fine reasons to dislike Python, right tool for the right job and all of that. But if you're going to complain about something, at least be specific and explain why you dislike feature X of a language

QuarkJets fucked around with this message at 05:26 on Dec 11, 2014

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