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
Thermopyle
Jul 1, 2003

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

Mido posted:

self sucks.

tef posted:

Lexical self is the best goddam thing in python, take a seat, shut the gently caress up, and learn why it's there. I have no loving patience for such foolish behaviour.

Adbot
ADBOT LOVES YOU

Soricidus
Oct 21, 2010
freedom-hating statist shill
Python is fine and often a good choice, but it's dumb to pretend it doesn't have a bunch of warts.

The same goes for pretty much every language. If you can't list a bunch of nasty design flaws in a given language, you probably don't know it as well as you think.

Thermopyle
Jul 1, 2003

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

So what's the argument people are making here?

  • "Python has lovely stuff that makes it overall shittier to use than my favorite language?"
I'm not sure you can make any sort of cogent argument for this in the general case. Python does have dumb stuff, but you're going to have to make the argument that it's worse at dumbness in widely used features than your recommended replacement and that's a hard argument to make without going in to how widely used features 1, 2, 3 are and that the other parts of the language don't outweigh the negatives relative to whatever other language.

I don't if any answer to this question is wrong or right.

  • "Python has lovely stuff that makes it overall shittier to teach with?"
Same sort of thing as with the last question. Still going to be hard to answer this in a manner that makes me sure if your answer is wrong or right.

  • "Python has lovely stuff but so do other widely used languages?"
This is a question you can answer easily (in the affirmative).

  • "Python is poo poo?"
meh

Thermopyle fucked around with this message at 17:40 on Dec 7, 2014

Coffee Mugshot
Jun 26, 2010

by Lowtax
Let's meet in the middle here. "Python is a cool language that is nice to program in, but I find myself confused about its lexical scoping"

Dominoes
Sep 20, 2007

So what's the deal with monads?

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

seiken posted:

:allears:

I'm completely familiar with its features and syntax (and I know InternetJanitor is as well).

It's an inconsistent, backwards mess of a language that doesn't align in any way with its stated goals. What Python is good at is being a slightly less terrible bash, for couple-hundred line scripts. It's only managed to sneak under the radar of universally reviled languages because its awfulness is a bit more subtle than PHP or Javascript, but it's no less systemic. (and nobody has written a really good blog post a la "fractal of bad design")

So what do you think of Perl compared to Python?

seiken
Feb 7, 2005

hah ha ha

Bruegels Fuckbooks posted:

So what do you think of Perl compared to Python?

Never really used it, don't have an opinion.

1337JiveTurkey
Feb 17, 2005

Dominoes posted:

So what's the deal with monads?

Mo'nads mo' problems.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Deus Rex posted:

"I cannot rebut reasonable criticism of my pet programming language"

I was going to do a point-by-point rebuttal, but then realized that would be petty and boring, so I chose a YOSquote instead.

Dylan16807
May 12, 2010

Thermopyle posted:

Lexical self

That's a good argument that self should be explicit as a parameter, but it doesn't address the issue of writing it every time you access a property.

print(foo) currently checks locals then globals. Instead it could check locals, then self, then globals. Python has decided that this is too magic, but it's not incompatible with the other nice things about the way self is handled.

(How would it know which object to do variable lookup in? It could take the one literally named 'self', there could be a special syntax in argument lists, or whatever else you can think of. You would be able to use this feature when defining a standalone function, and copy functions from one class to another, etc.)

FamDav
Mar 29, 2008

Dylan16807 posted:

That's a good argument that self should be explicit as a parameter, but it doesn't address the issue of writing it every time you access a property.

print(foo) currently checks locals then globals. Instead it could check locals, then self, then globals. Python has decided that this is too magic, but it's not incompatible with the other nice things about the way self is handled.

(How would it know which object to do variable lookup in? It could take the one literally named 'self', there could be a special syntax in argument lists, or whatever else you can think of. You would be able to use this feature when defining a standalone function, and copy functions from one class to another, etc.)

for a couple of reason

* self is not already a keyword, and there are conventions where you would use a different word and there are people who are dumb and write something different.
* changing the behavior of resolution to special-case self means methods are no longer just functions. this is unnecessary complexity (and its not even explicit complexity!)

Karate Bastard
Jul 31, 2007

Soiled Meat

Soricidus posted:

Python is fine and often a good choice, but it's dumb to pretend it doesn't have a bunch of warts.

The same goes for pretty much every language. If you can't list a bunch of nasty design flaws in a given language, you probably don't know it as well as you think.

I like python a whole lot after having used it as my main professional work tool for close to a decade. However I recently decided to check out golang, and my first impression is that it's basically a better python.

I'd love to hear you guys rip it to shreds if you can (and care to :)).

Series DD Funding
Nov 25, 2014

by exmarx

Karate Bastard posted:

my first impression is that it's basically a better python.

It is, enjoy :)

vOv
Feb 8, 2014

A static type system without generics In The Year Of Our Lord 2014. The lack of exceptions is interesting but it means that if I want to do a bunch of things that could possibly fail in a row then I have a shitload of if err != nil { return err } everywhere.

vOv fucked around with this message at 20:20 on Dec 7, 2014

Progressive JPEG
Feb 19, 2003

vOv posted:

A static type system without generics In The Year Of Our Lord 2014. The lack of exceptions is interesting but it means that if I want to do a bunch of things that could possibly fail in a row then I have a shitload of if err != nil { return err } everywhere.

Given the way they handle duck typing/interfaces, generics haven't felt necessary. That said I could see it being annoying if you're trying to roll your own generic data structure.

I actually sorta like the explicit error handling but that's just from previously writing a lot of C/C++. (The C++ code avoided using them as a rule)

QuarkJets
Sep 8, 2008

Karate Bastard posted:

I like python a whole lot after having used it as my main professional work tool for close to a decade. However I recently decided to check out golang, and my first impression is that it's basically a better python.

I'd love to hear you guys rip it to shreds if you can (and care to :)).

I've heard that a lot of people who like Go really like Rust, but my assumption is that Go and Rust are each suited to performing different tasks. Depending on what you're doing, it might be worth checking out Rust

SavageMessiah
Jan 28, 2009

Emotionally drained and spookified

Toilet Rascal

Dominoes posted:

So what's the deal with monads?

They're just a monoid in the category of endofunctors, what's the problem?

Dominoes
Sep 20, 2007

SavageMessiah posted:

They're just a monoid in the category of endofunctors, what's the problem?
I'm too stupid to understand functional programming. But functions are cool, and so are Python's functools and itertools modules!

vOv
Feb 8, 2014

Progressive JPEG posted:

Given the way they handle duck typing/interfaces, generics haven't felt necessary. That said I could see it being annoying if you're trying to roll your own generic data structure.

I actually sorta like the explicit error handling but that's just from previously writing a lot of C/C++. (The C++ code avoided using them as a rule)

There are other ways to do explicit error handling, like Rust's Option and Result types. But you can't implement those in Go because you don't have generics.

a cyberpunk goose
May 21, 2007


Hi, poster Mido here, you may remember me from such posts as

Mido posted:

Recovered python addict chiming in.

I recently was attempting to explain some python constructs to a programming newbie at work who is trying to get better so she can be a more valuable employee and all that fun jazz. I was able to cover a lot of ground in simple terms, just describing core types, iterables and for loops, all that jazz, but when it came time to explain classes is when I started to feel really embarrassed about python.

Trying to explain python classes to programming newbies is the worst if you think about it

"okay, so, in a lot other languages when you define a method in a class they will implicitly slip in a 'this' that you'll refer to talk to your own instance, but python is weird and when you have a class instance with methods you need to put 'self' at the beginning of your method, it also wont resolve what variables you're trying to reference, you will always need to rely on 'self' for anything"

it is clunky and awful to teach, because you dont want them to think all programming languages are doing the quirky things it does. a lot of pythonesque things are easy to conceptualize and describe -- to other programmers, for beginners it's a nightmare to teach and be taught.

the problem with python, and what i was trying to illustrate with my example before you blew it out of proportion, is that there's a lot of "okay so heres a language construct -- but..." when teaching it. I think a type strict language like C#, Java or Processing is better suited for teaching beginners. type strict environment, consistent and well specced syntax

a cyberpunk goose fucked around with this message at 22:22 on Dec 7, 2014

Dominoes
Sep 20, 2007

Mido posted:

Hi, poster Mido here, you may remember me from such posts as


the problem with python, and what i was trying to illustrate with my example before you blew it out of proportion, is that there's a lot of "okay so heres a language construct -- but..." when teaching it. I think a type strict language like C#, Java or Processing is better suited for teaching beginners. type strict environment, consistent and well specced syntax
New/self-taught programmer - Started with Python. Had a very easy time learning it. 'self' wasn't an issue since objects aren't important until you do complicated projects - ie you're no longer a beginner. My main struggle with objects was figuring out why you'd use them instead of dictionaries and functions.

I don't know how academic programming courses are setup, but I learned from problem-solving - ie I needed to accomplish a specific task, so I learned and coded as much as I needed to make it happen. I could see a course presenting an assignment where you create objects and call their methods to do math and print text. It wouldn't have come up in practical learning; you'd just write a function to do math and print.

Dominoes fucked around with this message at 22:57 on Dec 7, 2014

Thermopyle
Jul 1, 2003

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

Mido posted:

Hi, poster Mido here, you may remember me from such posts as


the problem with python, and what i was trying to illustrate with my example before you blew it out of proportion, is that there's a lot of "okay so heres a language construct -- but..." when teaching it. I think a type strict language like C#, Java or Processing is better suited for teaching beginners. type strict environment, consistent and well specced syntax

Hmm, I think you blew my response out of proportion. I was just pointing to someone who explained why explicit self was as it was and why it's a good thing.

a cyberpunk goose
May 21, 2007

Thermopyle posted:

Hmm, I think you blew my response out of proportion. I was just pointing to someone who explained why explicit self was as it was and why it's a good thing.

I don't mind self in principle, implicit 'this' is the same kind of object instance magic just with a different approach. It's all pretty arbitrary. My only point is that Python by its design is a very slippery language which I have found to be a frustrating thing when teaching people who are very new to programming.

Dominoes posted:

New/self-taught programmer - Started with Python. Had a very easy time learning it. 'self' wasn't an issue since objects aren't important until you do complicated projects - ie you're no longer a beginner. My main struggle with objects was figuring out why you'd use them instead of dictionaries and functions.

I don't know how academic programming courses are setup, but I learned from problem-solving - ie I needed to accomplish a specific task, so I learned and coded as much as I needed to make it happen. I could see a course presenting an assignment where you create objects and call their methods to do math and print text. It wouldn't have come up in practical learning; you'd just write a function to do math and print.

Thanks but I have tutored quite a few people who wanted to learn python and this has been a common sticking point. I am glad you didn't have a problem with it.

a cyberpunk goose fucked around with this message at 23:22 on Dec 7, 2014

Corla Plankun
May 8, 2007

improve the lives of everyone

Soricidus posted:

guys, guys, this language that I am intimately familiar with behaves the way I expect, so clearly what it does is natural and logical and anyone who thinks it's flawed or inconsistent simply doesn't get it

I actually literally and unironically found Ruby to behave exactly like I expected it to when I was learning it. It's a super fun language to write in for that reason.

Haystack
Jan 23, 2005





Mido posted:

Thanks but I have tutored quite a few people who wanted to learn python and this has been a common sticking point. I am glad you didn't have a problem with it.

Maybe it's a self-taught vs taught-to issue? I also taught myself on python, and at the time I recall that lexical self was no more or no less of a braintwister than the rest of the basic object model. I didn't understand why things were done that way, but I accepted it as part of the magic. Later, it prompted me to look under the hood and figure out the (fairly simple) mechanism at work, which I don't think I would have done with a magic pseudo-variable like this

Now, if there's anything in Python I'm not fond of, it's super().

ExcessBLarg!
Sep 1, 2001

Corla Plankun posted:

I actually literally and unironically found Ruby to behave exactly like I expected it to when I was learning it. It's a super fun language to write in for that reason.
Yep. I've also long disliked Python for the issues raised in the thread, and a decade ago saw Ruby as an alternative that really made a lot of sense. Couldn't understand why Python was getting all the joy and Ruby wasn't (no English documentation? Pshaw, there's a book!). Then Rails happened and any credibility Ruby had went out the window.

Honestly Python isn't terrible. It has some idiosyncrasies due to its age. Most people live with them, or decide other benefits of the language (and the technically strong, not-complete-hipster community) outweigh the issues it does have.

The horror, though, is Perl 5. And 6 too.

Sinestro
Oct 31, 2010

The perfect day needs the perfect set of wheels.
C code:
	union
	{
		struct
		{
			float NOT_USED;
			float out[3];
		}
		float temp[4];
	}
I can't... even imagine what prompted the creation of this. I wrote it.

QuarkJets
Sep 8, 2008

Haystack posted:

Maybe it's a self-taught vs taught-to issue? I also taught myself on python, and at the time I recall that lexical self was no more or no less of a braintwister than the rest of the basic object model. I didn't understand why things were done that way, but I accepted it as part of the magic. Later, it prompted me to look under the hood and figure out the (fairly simple) mechanism at work, which I don't think I would have done with a magic pseudo-variable like this

Now, if there's anything in Python I'm not fond of, it's super().

Do you dislike super() in other languages as well, or do you specifically dislike Python's version of super()?

SavageMessiah
Jan 28, 2009

Emotionally drained and spookified

Toilet Rascal

Dominoes posted:

I'm too stupid to understand functional programming. But functions are cool, and so are Python's functools and itertools modules!

In case it wasn't clear, that was a joke. Nobody expects that definition to be meaningful to anyone but ekmett.

Joda
Apr 24, 2010

When I'm off, I just like to really let go and have fun, y'know?

Fun Shoe

Haystack posted:

Later, it prompted me to look under the hood and figure out the (fairly simple) mechanism at work, which I don't think I would have done with a magic pseudo-variable like this

In what way is this a "a magic pseudo-variable?"

E: In what way is it even a variable?

Joda fucked around with this message at 04:00 on Dec 8, 2014

raminasi
Jan 25, 2005

a last drink with no ice

Joda posted:

In what way is this a "a magic pseudo-variable?"

E: In what way is it even a variable?

...it looks like a variable when you use it?

Zopotantor
Feb 24, 2013

...und ist er drin dann lassen wir ihn niemals wieder raus...

Joda posted:

In what way is this a "a magic pseudo-variable?"

E: In what way is it even a variable?

Assignment to this used to be the way to do dynamic object allocation, before Stroustrup came up with new. This is the main reason why this is a pointer (it should have been a reference all along).

TheresaJayne
Jul 1, 2011

sarehu posted:

Honestly Java without an IDE is fine. It's better than Python or Ruby (or any dynamically typed language) without an IDE.

I once had a programming test for a job where you had to write working code in a webpage - no syntax checking, no api lookup and you were timed and had a restriction of failing if you hit alt-tab or switched out of the browser.

the joys of owning an ipad were then apparent :)

Joda
Apr 24, 2010

When I'm off, I just like to really let go and have fun, y'know?

Fun Shoe
All I meant was that the use of the this keyword as a pointer to the instance for which you called the member function in question makes sense (e.g. object at this address/ + whatever offset for the member variable or function you're trying to access is at.) Whether it's a pointer or a reference isn't really important; I'm fine with the way Java does it too. I just genuinely don't get the "magic pseudo variable" comment.

Joda fucked around with this message at 09:40 on Dec 8, 2014

KaneTW
Dec 2, 2011

Why? It's a pseudo-variable because it's used like a variable except you can't assign anything to it yourself. It's magic because it's explicitly defined nowhere, yet points to the current object.

Athas
Aug 6, 2007

fuck that joker

Joda posted:

E: In what way is it even a variable?

If it's not a constant, then it's a variable, and if you're writing a program in which this is a constant, then your design is weird. If it has to be an lvalue to be a variable, then functional languages have no variables.

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

TheresaJayne posted:

I once had a programming test for a job where you had to write working code in a webpage - no syntax checking, no api lookup and you were timed and had a restriction of failing if you hit alt-tab or switched out of the browser.

the joys of owning an ipad were then apparent :)

Ugh, why would you ever want to work for a company that did this kind of interview?

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

TheresaJayne posted:

I once had a programming test for a job where you had to write working code in a webpage - no syntax checking, no api lookup and you were timed and had a restriction of failing if you hit alt-tab or switched out of the browser.

Holy poo poo what a dumb test

Forgall
Oct 16, 2012

by Azathoth
Isn't that just an imitation of whiteboard interview? Those are quite common afaik.

Adbot
ADBOT LOVES YOU

Carthag Tuek
Oct 15, 2005

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



Nobody expects a whiteboard to compile. Or they shouldn't, at least.

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