Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Why does python look so different when it is also object oriented like Java?

 
Ranch Hand
Posts: 1258
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Python is also object oriented like Java. In such a case why does it look so different than Java.
 
Marshal
Posts: 65851
250
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you expect two different languages to have the same syntax?
 
Saloon Keeper
Posts: 21144
134
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Programming languages do tend to fall into syntax families. Many languages look a lot like C: Perl, PHP, Java, Javascript and so forth. Others look like Algol: Pascal, Modula, Ada, and more. Then there are english-like languages, of which COBOL is the most famous. And the outliers, like LISP and Smalltalk. One reason for these similarities was to make them easier to adopt by shortening the learning curve - if you know Java, you can get a head start on JavaScript, for example. And people are more likely to adopt something that looks like something that they're familiar with.

When Guido van Rossum decided to invent a new language, however, he wanted a minimalist, "English/human-"like approach. He didn't want to waste a lot of time coding brackets and braces to define blocks, so he used indentation. He lifted a lot of the expression syntax and functionality from existing language, but again made it less symbolic and more human-like.

And actually, he didn't originally plan for it as an object-oriented language. That was bolted on after the fact, and it shows in things like having to explicitly define "self" in OO methods and being able to put straight-up procedural code in "class" files.

It's not as big a struggle to retro-fit OOP to Python as it has been for PHP, but it's more awkward than it could have been.
 
Monica Shiralkar
Ranch Hand
Posts: 1258
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Many languages look a lot like C: Perl, PHP, Java, Javascript and so forth. Others look like Algol: Pascal, Modula, Ada, and more. Then there are english-like languages, of which COBOL is the most famous. And the outliers, like LISP and Smalltalk.



Out of these 3 categories, in which one does Python fall under and under which one does C# fall under?
 
Tim Holloway
Saloon Keeper
Posts: 21144
134
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They're not really categories in the formal sense. It's mostly a matter of what looks like what.

C# resembles C. The various BASIC dialects resemble Fortran - to the point that in school, BASIC was taught at the end of my Fortran class. BASIC was originally sort of a simplified interactive dialect of Fortran, in fact.

If Python directly resembles any other language, it might be COBOL (very loosely) or Forth (very loosely). Or Smalltalk (ditto) It's sort of an outlier syntax, though.
 
It runs on an internal combustion engine. This ad does not:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!