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
Jazerus
May 24, 2011


ultrafilter posted:

Academic departments are incentivized to teach intro classes that students feel good about. The language of choice before Python was Java, and when it comes to making beginners feel good, Python is a much better choice.

well you're talking about college, which is a totally different thing. python is almost a reasonable choice at that level.

in k-12 neither python or java really works at all. javascript honestly provides the best balance of accessibility, immediate ability to produce results, and relevancy.

Adbot
ADBOT LOVES YOU

FlapYoJacks
Feb 12, 2009
My high school started with basic and then moved on to C. It should still be this way.

more falafel please
Feb 26, 2005

forums poster

DoomTrainPhD posted:

My high school started with basic and then moved on to C. It should still be this way.

We did Basic and then C++, but it was the APCS "C with a string class" C++

FlapYoJacks
Feb 12, 2009

more falafel please posted:

We did Basic and then C++, but it was the APCS "C with a string class" C++

Acceptable. It's not that new programmers should suffer from C. It's that higher-level language abstracts way too much, which in turn creates terrible programmers.

Ask new graduates how two strings are actually concatenated, and most of them couldn't answer properly. Let alone what a volatile is or the difference between the stack and heap.

Volte
Oct 4, 2004

woosh woosh
There's no reason to ever teach or use C for anything save maybe embedded programming. It's too abstract to properly teach low-level concepts and too low-level to properly teach abstractions.

Pie Colony
Dec 8, 2006
I AM SUCH A FUCKUP THAT I CAN'T EVEN POST IN AN E/N THREAD I STARTED

Hammerite posted:

I don't get the point of the type annotations thing in Python. If you want type safety you may as well use a real programming language and get one at compile time. It's too late to shoehorn it in to your dynamically-typed scripting language once it's 20 years old or whatever. And no-one should be building anything in Python that's more complicated than a single file anyway (but I'm getting sidetracked).

But there's this effort to add kind-of sort-of type safety to the language, only it's all just promises and not enforced anywhere... what is it adding? A real, compile-time-enforced type system allows you to trust that certain types of mistakes can't possibly be present in your code. I don't get the impression that the Python type annotations achieves that, and I don't know what it does achieve.

What are you even talking about? Are you aware of Python's massive popularity, or are you taking a stand against static typing because there's a different tool for it? The majority of my work's Python projects are 100% strictly typed and type safety is enforced at all stages of our deployment pipeline.

ChickenWing
Jul 22, 2010

:v:

Hammerite posted:

I was being consciously provocative when I said you shouldn't use Python for anything more complicated than a single file. But also, coincidentally, it's what I actually do believe.


but how does it help them, really? If it's not enforced by a compiler then how do you have confidence in it? It just smacks to me of something that will decay, like comments, until eventually it's lying to you.

If it doesn't break when it's wrong then it will go wrong and cause you pain.

It's documentation. It's helpful in the same way that documentation is, with the added benefit of adding IDE hints. That's about the size of it.

DoomTrainPhD posted:

I hear good things about Spring. I have used Django quite extensively over the years and quite like it as well. What can Spring do that Django struggles with?

JVM vs Python, realistically. They're both made for the same purpose (a non-trivial server application), where python's natural advantages don't apply as well, and its natural drawbacks (hello GIL) start really hammering you.

more falafel please
Feb 26, 2005

forums poster

Volte posted:

There's no reason to ever teach or use C for anything save maybe embedded programming. It's too abstract to properly teach low-level concepts and too low-level to properly teach abstractions.

What language should low-level concepts be taught in?

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Pie Colony posted:

What are you even talking about? Are you aware of Python's massive popularity, or are you taking a stand against static typing because there's a different tool for it? The majority of my work's Python projects are 100% strictly typed and type safety is enforced at all stages of our deployment pipeline.

What does enforcement actually involve? Does it stop you from running code that won't work due to type issues, or does it just throw warning messages?

ChickenWing
Jul 22, 2010

:v:

more falafel please posted:

What language should low-level concepts be taught in?

verilog > asm > java :colbert:

Pie Colony
Dec 8, 2006
I AM SUCH A FUCKUP THAT I CAN'T EVEN POST IN AN E/N THREAD I STARTED

ultrafilter posted:

What does enforcement actually involve? Does it stop you from running code that won't work due to type issues, or does it just throw warning messages?

Yes, if the type check fails, the build fails, the deploy fails, and the code is never run.

OddObserver
Apr 3, 2009
Bring back Pascal, IMHO.

FlapYoJacks
Feb 12, 2009

Pie Colony posted:

Yes, if the type check fails, the build fails, the deploy fails, and the code is never run.

Again, it's not a type check, it's a type hint, and in Pythons case it's mainly for the programmers edification. If you want the build to fail, you run mypy in a CI/CD pipeline and it will enforce the type-hints.

Absurd Alhazred
Mar 27, 2010

by Athanatos
Borland Pascal ftw.

e: fb

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
Assembly is a terrible way to learn low-level concepts where you have to e.g. manage allocations, copy values around, etc. It’s not that you don’t still have to care about those things, it’s that most of your focus will be on worrying about other things. C has some warts, but its main problems as a programming language are in how it forces you to deal with exactly those things, so it’s good for learning them.

Pie Colony
Dec 8, 2006
I AM SUCH A FUCKUP THAT I CAN'T EVEN POST IN AN E/N THREAD I STARTED

DoomTrainPhD posted:

Again, it's not a type check, it's a type hint, and in Pythons case it's mainly for the programmers edification. If you want the build to fail, you run mypy in a CI/CD pipeline and it will enforce the type-hints.

If the types are checked automatically, it's literally a type check.

I'm risking a lot by posting this, but here's my job's proprietary build tool:

code:
alias python4='mypy && python3'

FlapYoJacks
Feb 12, 2009

rjmccall posted:

Assembly is a terrible way to learn low-level concepts where you have to, e.g., manage allocations, copy values around, etc. It's not that you don't still have to care about those things; it's that most of your focus will be on worrying about other things. C has some warts, but its main problems as a programming language are how it forces you to deal with exactly those things, so it's good for learning them.

Exactly. Learning C is a good stepping stone to higher-level languages, as many of the same syntax or concepts still apply (for/while loops, enums, structs, basic types.) You also learn about the annoyances of various things that higher-level languages obscure, such as string handling, memory management, pointers/address' etc.

Once you know the pain of string management in C, you can appreciate "foo" + "butt" a lot more!

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Pie Colony posted:

What are you even talking about? Are you aware of Python's massive popularity, or are you taking a stand against static typing because there's a different tool for it? The majority of my work's Python projects are 100% strictly typed and type safety is enforced at all stages of our deployment pipeline.

what does Python's popularity have to do with it? To answer your question, I am aware that Python is widely used.

I don't know how you read that post and come away with the idea that I'm "taking a stand against static typing". I think it's clear from the post that I think static typing is a good thing and also that I'm circumspect about incorporating it into Python when the "everything is duck typed" philosophy of the language is so established.

I'm glad you can enforce the type system as part of a build process. I had been under the impression that this wasn't really feasible. I'm happy to be wrong.

Pie Colony
Dec 8, 2006
I AM SUCH A FUCKUP THAT I CAN'T EVEN POST IN AN E/N THREAD I STARTED
My point was just that if you see a benefit in static typing, you should be happy that you can statically type code in one of the most popular programming languages.

Bongo Bill
Jan 17, 2012

I believe static typing is better, but I'm not gonna tell people to switch away from dynamic typing if they like it. After all, if they wanted to be warned when they made a mistake, they wouldn't be using a dynamically typed language in the first place.

more falafel please
Feb 26, 2005

forums poster

I'm a weirdo in that I learned BASIC, then Z-80 assembly (to make calculator games), then "C with a string class" C++, then college where I learned a little Java, but mostly did things in C and C++. In my personal time I did most stuff in Perl 5 because I was an insufferable Unix kid in college. So when I learned about pointers I was confused for a while until I realized they were just memory addresses, just like in assembly.

I also took a PL class in college where we did some Common Lisp, some OCaml, some Haskell, and some Prolog, and eventually I wrote a micro-lisp in Smalltalk.

QuarkJets
Sep 8, 2008

Bongo Bill posted:

I believe static typing is better, but I'm not gonna tell people to switch away from dynamic typing if they like it. After all, if they wanted to be warned when they made a mistake, they wouldn't be using a dynamically typed language in the first place.

I think dynamic typing just gives you greater flexibility. If you're writing a new function that you feel needs static typing, then you can temporarily enforce static typing without switching languages

xtal
Jan 9, 2011

by Fluffdaddy

QuarkJets posted:

I think dynamic typing just gives you greater flexibility. If you're writing a new function that you feel needs static typing, then you can temporarily enforce static typing without switching languages

This is the opposite of true, because a static language can opt in to having dynamic types where needed but a dynamic one always pays the runtime costs.

MononcQc
May 29, 2007

I'ma just drop Hillel Wayne's Epistemology of Software Quality into any god drat language or typedness debate.

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Everything has its place. If you don't know what you want to write yet, dynamic typing is the way to go. Once you've got a clear domain model and you want to write something for production with correctness guarantees and optimization, static typing really shines.

Xarn
Jun 26, 2015
Lot of terrible opinions itt, the worst one being that students should suffer lovely language so they appreciate the good ones more.

QuarkJets
Sep 8, 2008

xtal posted:

This is the opposite of true, because a static language can opt in to having dynamic types where needed but a dynamic one always pays the runtime costs.

Granted, statically typed languages can have dynamic types, but in my experience it is a pain in the rear end and really clunky to actually use them so I avoid them whenever possible.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Logo was pretty cool

FlapYoJacks
Feb 12, 2009

Xarn posted:

Lot of terrible opinions itt, the worst one being that students should suffer lovely language so they appreciate the good ones more.

It has nothing to do with wanting them to suffer. They need to understand the fundamentals of what's going on behind the scenes.

Beef
Jul 26, 2004

xtal posted:

This is the opposite of true, because a static language can opt in to having dynamic types where needed but a dynamic one always pays the runtime costs.

:hmmwrong:

fritz
Jul 26, 2003

ultrafilter posted:

Python being the only language that most machine learning/data science people know is a full-fledged horror.

Found the poster who doesn't remember matlab.

Beef
Jul 26, 2004
And then there is R

QuarkJets
Sep 8, 2008

Python as a machine learning platform actually makes a lot of sense for like 99% of use cases

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


fritz posted:

Found the poster who doesn't remember matlab.

I got started long enough ago that matlab was the only choice, but most of the people who do ML don't remember those days at all.

xtal
Jan 9, 2011

by Fluffdaddy

I don't think it is wrong, gradual typing tends to be at best performance neutral, and negative when you end up having runtime checks.

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof

xtal posted:

This is the opposite of true, because a static language can opt in to having dynamic types where needed but a dynamic one always pays the runtime costs.

Dynamic languages can have type checkers that don't impact runtime.

zergstain
Dec 15, 2005

more falafel please posted:

We did Basic and then C++, but it was the APCS "C with a string class" C++

QBasic then Turbo Pascal for me.

Tei
Feb 19, 2011
Probation
Can't post for 4 days!

DaTroof posted:

Dynamic languages can have type checkers that don't impact runtime.

I am confused.

But the definition of dynamic languages and run time is that if a language is dynamic, that type is checked at run-time, whatever time is taking to evaluating the type at runtime, that time is lost. Where a compiler have to do the same evaluation, but since is on compile time, is zero on run-time. ((( Except on some fancy dynamic OOP stuff that may recreate the same effect a dynamic language. )))

Is not this like saying. "Writting some code that will be interpreted before is executed ==( has fast )== Executing some code in the native language". That the impact of the interpreter is zero !?

Tei fucked around with this message at 10:38 on Feb 6, 2021

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof

Tei posted:

I am confused.

But the definition of dynamic languages and run time is that if a language is dynamic, that type is checked at run-time, whatever time is taking to evaluating the type at runtime, that time is lost. Where a compiler have to do the same evaluation, but since is on compile time, is zero on run-time. ((( Except on some fancy dynamic OOP stuff that may recreate the same effect a dynamic language. )))

Is not this like saying. "Writting some code that will be interpreted before is executed ==( has fast )== Executing some code in the native language". That the impact of the interpreter is zero !?

I'm thinking of type checkers as diagnostic tools, not type checking performed at runtime. Like mypy for Python, solargraph for Ruby, dialyzer for Elixir, etc.

Adbot
ADBOT LOVES YOU

Volte
Oct 4, 2004

woosh woosh
Python has a runtime type checking penalty even if you don't use type annotations. Both in the form of checking to make sure that the methods you call actually exist and in the form of explicit isinstance() checks in the code to make up for the lack of type safety. Static typing is good.

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