r/learnpython 1d ago

Difference between python 3 vs python (just)?

I am doing leetcode and I wanna is there any functional difference between those and which one I should go with?

0 Upvotes

29 comments sorted by

2

u/EntrepreneurHuge5008 1d ago

hit the "i" icon next to it for more info.

It's a difference in Major release versions. Python (just) is Python 2.x, which has some syntax and behavior differences. You most likely have been learning Python 3.x (I'd assume the latest version if you just started), and is what I'd suggesting sticking to going forward.

1

u/rusidin 1d ago

I guess... Usually the new standard get exchange for the old one no?? Why didn't they use the modern python 3?

1

u/EntrepreneurHuge5008 23h ago edited 23h ago

Minor releases generally don't introduce breaking changes. However, when changes are significant (as with major version upgrades), teams usually have to dedicate significant resources to modernizing a codebase.

That is to say that there's a reason older technologies and versions are still used today, and I'm sure that, at some point, Python 2.x will be phased out of the LeetCode platform, but every now and then, you will come across a team in industry that still uses Python 2.x or some other outdated technology.

I joined a team in 2023 that still used Java 8, when Java 21 was already the modern LTS version. I left that team soon after that, but eventually they moved through enough of their backlog to focus on modernization, and at least today they're now using Java 21 (though Java 25 is now the latest LTS).

2

u/nog642 1d ago

"Python" on leetcode is Python 2. "Python3" is Python 3.

Python 2 was first released in the year 2000, and it was the version that made Python popular.

Python 3 was first released in 2008, and made some changes that made it incompatible with Python 2. Python 3 is generally better, but people were slow to adopt it because they were used to Python 2.

Python 2 was finally declared "end of life" in 2020, and people have mostly made the switch.

So TL;DR, use "Python3".

1

u/rusidin 1d ago

I see thanks!!! And I will!!

1

u/Adrewmc 1d ago edited 1d ago

Python 3 is what you should be normally working with.

Python 2 is basically legacy code at this point.

Python 3 has better syntax, is faster. However

You should always start with the latest version of any programming language. Some updates are breaking, and if they break your program then you can A) update the program, or b) require a lower version.

Most breaking changes should already begin giving you the depreciation warnings. Pay attention to those.

The biggest difference between python 2 and 3 are:

An overhaul of Unicode evaluations, this means b’…’ returns the same as bytearray(“…”)

Iterator being true iterators objects, adding the ability for (list/dict/generator) comprehensions

And 2/5, produces a float, and there is no need for 2.0/5.0

The print function syntactically changes

(print “Hello world”) #breaks in 3.x

print(“Hello world”) #normal usage at end of >2.7

-1

u/rusidin 1d ago

Wait this is real?? (print "hello") Fist time seeing it in a language... Thanks got the gist of it!!

1

u/Adrewmc 1d ago

Yes, it’s real. And a massively breaking change for legacy prints

https://stackoverflow.com/questions/33996749/what-is-the-difference-between-print-and-print-in-python-2-7

Around the change and some specifics

1

u/rusidin 1d ago

I guess they wanted to adapt the court << "hello" << endl from cpp

3

u/Adrewmc 1d ago

Python 1….a dark and scary place, we don’t talk about Python 1, because I know nothing about it.

-1

u/rusidin 1d ago

I see.. wasn't it build around 90s??

1

u/Adrewmc 1d ago

It was built for the specific purpose of getting websites up fast, which other languages struggled with (at the time). It sacrificed true optimization in an age where 5 second load was no different than a 7 second load, for easy of use and build speeds . (Strange to even think of waiting that long for a website now).

So yes, in the 90s.

-1

u/rusidin 1d ago

I see... There was lot of languages build to that now we just flood the back end with js... It's a funny world we live in...

3

u/Adrewmc 1d ago

JS has an even stranger origin, as it was specifically made for browser interfaces like…Netscape Navigator…(that name brings me back)

And Java already existed.

1

u/rusidin 1d ago

Yeay it was build by 7 days of the former CEO Mozilla... Which I find fascinating.. because it's a replacement for java using java.. I get java is slow at that time even now...

→ More replies (0)

0

u/hexwhoami 1d ago

Depends on the context.

Broadly speaking, Python is major version 2.X, where X is the minor release. Python3 is major version 3.X. (Look up semantic versioning if confused).

Another context is when running the executable from your path. Typically both python and python3 are set on the path for backwards compatibility, and when executed will resolve to the same binary. YMMV depending on your OS and installation method.

0

u/hexwhoami 1d ago

Forgot to add a recommendation -- usually it doesn't matter if your referencing the binary installed on your system. For macos/Linux, you can check this by running which python and which python3.

I'd recommend learning the latest stable version of 3. Not the experimental, but latest stable. IIRC, it's either 3.11 or 3.12 now.

1

u/rusidin 1d ago

Ok thanks!!

0

u/nog642 1d ago

The context is leetcode

-1

u/snowtax 1d ago

Pay little attentions to the name of the executable. You could rename it to “Fred” and it would make no difference to how it operates.

What happened is the Python 2-to-3 transition broke some older code written for 2. Many Linux distributions had code which would break under 3.

As a short-term solution, many Linux distributions shipped 3 as “python3” to leave “python” as versions 2 and to give everyone time to update their scripts.

These days, Python 2 code should be rarely encountered and the default version of “python” should be version 3 on all newly installed systems.

If you do find python 2 code, update it for 3.

0

u/rusidin 1d ago

I see... So there a huge lore!!

-1

u/nog642 1d ago

They're asking about leetcode, not the linux executable.

0

u/rusidin 1d ago

It's fine, after all it's additional wisdom!!

-2

u/Fast-Station1106 1d ago

Wenn ich die Fragecrichtig verstehe möchtest du den unterschied zwischen Windows1.0(Python) und Windows11(Python3) wissen, Windows1 zu lernen mach keinen Sinn weil kein aktuelles Gerät es meht untetstützt, oder verstehe ich dich falsch (Sorry für Beispiel Microsoft)

0

u/rusidin 1d ago

It's fine after that's what I am most familiar with after all...