This week's book giveaway is in the Cloud forum.
We're giving away four copies of Terraform in Action and have Scott Winkler on-line!
See this thread for details.
Win a copy of Terraform in Action this week in the Cloud 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Why Python is the best to java.

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The most widely used programming languages are Java and Python. Both are high-level, general-purpose programming languages that are widely used. Developers currently utilize the Java programming language to create online and desktop apps. Python is used to create a machine learning and data science applications.
Python is a dynamically typed, interpreted programming language. It signifies that no variables need to be declared. Because Java is a compiled and statically typed language, declaring variables directly is required. Python comes with a broad and well-rounded standard library. The library saves time and effort for the programmer.
 
Saloon Keeper
Posts: 8779
71
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not sure what point you are trying to make. I'm sure someone could argue Python vs Java point by point but I'm too tired for that right now. We do have a forum for Python if you'd like to hang out there and converse with fellow Pythoners. This forum is devoted to people who want to learn Java.
 
Saloon Keeper
Posts: 13427
303
  • Likes 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sakshi Chaudhary wrote:dynamically typed


This is enough for me to put Python way way way down on the list of languages I want to learn. If your language doesn't provide a compiler that performs static type checking, I don't want it.
 
Marshal
Posts: 74393
335
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

Sakshi Chaudhary wrote:The most widely used programming languages are Java and Python. . . .

Where did you get that from? If you look at the Tiobe index, you will find C persistently near the top of the list. Tiobe doesn't necessarily show which language is used the most. Unfortunately C is only slightly better at type safety than Python.
 
Saloon Keeper
Posts: 7181
166
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also keep in mind that there rarely is a single best of anything. There certainly isn't for programming languages, where the choice of language depends a whole lot of what you intend to do with.
 
lowercase baba
Posts: 13014
66
Chrome Java Linux
  • Likes 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Whenever I hear/read an argument like this, all I can think of is:

Hammers are better than screwdrivers.  They don't require any twisting, nor a strong grip.  A hammer can drive any size nail, while a screwdriver can only be used on screws with the correct head, therefore hammers are much more versatile.  People have been using hammers a lot longer than screwdrivers, thus proving the hammer's greater versatility and lifespan.

Crazy, right?  The best tool depends on what job you are trying to do.  It doesn't matter if the tool is a hammer, a screwdriver, Java, Python, or a welding robot  - each has its own strengths and weaknesses.
 
Bartender
Posts: 4709
183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:

Sakshi Chaudhary wrote:dynamically typed


This is enough for me to put Python way way way down on the list of languages I want to learn. If your language doesn't provide a compiler that performs static type checking, I don't want it.



Hmm, yes, it IS horrible to have a function help (a, b, c) and having to read the code to find out that a is a dictionary, b a boolean and c a List, and that it can return some value. But then again, that is the same in javascript, and you do get used to it, after a (long) while.
 
Marshal
Posts: 5168
322
IntelliJ IDE Python Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Piet Souris wrote:But then again, that is the same in javascript, and you do get used to it, after a (long) while.


And this is precisely the reason why I like TypeScript so much. All the benefits of JS with the added safety of static types, what's not to love?
 
Piet Souris
Bartender
Posts: 4709
183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Never worked with typescript, but that sounds pretty powerful indeed!
 
Saloon Keeper
Posts: 1672
61
Eclipse IDE Postgres Database C++ Java
  • Likes 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Until Sakshi returns, we may not know what her point was intended to be.  It's a good enough excuse to riff on whether "Python is the best to Java" or "Java 17 is the best to Java "(so far).

Python does have a pretty extensive standard library, but the JDK base classes are nothing to sneeze at either.

I still regularly see things saying "static typing means that you must explicitly declare the type of every single variable" as a disadvantage, ignoring:

1. LVTI (Local Variable Type Inference) available since Java 10 in all the spots it is not insane, which is to say, for local variables, IMHO, and feeling that way even more strongly after doing Python for a few months (there are aspects of Python that I really like, the Dynamicness-as-a-Religious-Principle is not one of them).  C++ started moving towards LVTI with re-purpose of auto even earlier, with the 2011 release.

2. there have been not one, but more than one way to add type annotations to Python code to try to protect oneself from various usage errors that will only show up at runtime, and, in fact, with the right data/test cases, timing and luck, that would have never compiled in Java (or C# or C++ or probably Swift to be fair)...

I mentioned elsewhere a good friend was on a Coding Challenge, neither trivial nor too hard, he chose to do it in Ruby, because Ruby is Beautiful and Makes Everything Nice.

He had a subtle but forehead-slapping error that would NEVER have compiled in Java/C/C++/C# etc. etc. but not only "compiled" (well, threw no errors nor exceptions) but just silently gave really dumb results.  I think the actual thing that was happening is that his code was saying 1000 < 2 because it was doing string comparisons on that line.  Two hours of coding, no other errors, but he did not get the job because it advised them to "BUY BUY BUY!!" right before the Great Crash...

He is happily working a probably lower-paying job now, and is using Ruby most of the time, with some JavaScript.

If people compare strict static type checking to seat belts, he is definitely not going to disagree, if he would have before.

The normal objection is "You still need to write tests anyway, so all that static type checking is just an annoying waste of time!"

You sure, do, but no...I prefer any code I am writing that might kill someone or put someone out of business if I get anything wrong to undergo the strictest static analysis possible, far more than that done by javac.  Note that it is far easier to write a great static analyzer for Java than for Python, precisely because the code can reason about types, value domains, etc. in a way that is very (extremely) difficult to do in Python.

The same things affect possibilities for optimization.  The computational acrobatics being done by pretty much all of the modern JIT compilers are mind-blowing, leveraging the knowledge of exactly what type everything is to the hilt in order to achieve this.

Guido has said that a new version of Python is coming that is going to be Insanely Fast compared to the earlier ones.  Maybe.  But the Ultra-Dynamism-As-Core-Design-Principle at the heart of Python makes that exceptionally difficult to achieve.  Looking at Cython (not CPython, the standard reference interpreter that most people mean when they just say Python) it achieves a lot of its speed advantage by limiting dynamic behavior to Very High instead of Thru the Stratosphere.

I think that using Python is great for a lot of different people doing a lot of different things.  I learned a lot of new ways of thinking about programming from partying with Python...

But it made me appreciate a number of "drawbacks" of Java at the same time as well, certainly in terms of "How sure am I that this really works?"

One point for Python, any attempt to use mutable data types as keys for dicts (think HashMap) or members of sets fails immediately, do not pass go, do not collect $200.  I have seen presenters (at this point many of them) who know Lots More Java than I do (at least in terms of Spring, SpringBoot, some of the other frameworks) stick user types that are not only mutable, but don't have .hashCode() or .equals() properly overridden, which ensures Hilarity ensues as I can stuff 500 clowns/clones into the same set...but for the most part, there are a lot of places where the "lack of flexibility" in Java does feel like complaining "Hey, this gun refuses to fire while I am pointing it at my face!"  Do I really want to wait for a test case to catch that?
 
Ranch Hand
Posts: 106
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is "Python is the best to Java"? OR is "Java the best to Python"?

I suppose it is a matter of philosophy or scripture, whether two things are each the "best" of the other.

And as Python shall be the best of Java, so shall Java be the best of Python. So said it shall be.

Wherefore, the sons of Java proliferate widely, spawning many threads; Python was forsaken, and begat no sons.

So said it shall be.

 
Rancher
Posts: 990
23
Netbeans IDE Oracle MySQL Database Tomcat Server C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sakshi,
you look at that as a good thing, it can make debugging a nightmare.  i have not done that much development in Python to say i'm an expert or even good at it, but no declaration of variables has always led to confusion in every language that i've use that allows it.
Les

Sakshi Chaudhary wrote:The most widely used programming languages are Java and Python. Both are high-level, general-purpose programming languages that are widely used. Developers currently utilize the Java programming language to create online and desktop apps. Python is used to create a machine learning and data science applications.
Python is a dynamically typed, interpreted programming language. It signifies that no variables need to be declared. Because Java is a compiled and statically typed language, declaring variables directly is required. Python comes with a broad and well-rounded standard library. The library saves time and effort for the programmer.

 
Jesse Silverman
Saloon Keeper
Posts: 1672
61
Eclipse IDE Postgres Database C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From a cursory check, she didn't appear to be a known spammer (and still doesn't), and that didn't appear to be a cut-and-paste.

Unless she comes back, we may never know exactly why she posted that or what her experiences were.

I do think we had some pretty good discussion reflecting on our own experiences tho.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic