Python3 is not as bad as you think !
I personally did not like to believe my beloved Python 2.7 has come to an end. Like anyone I was a bit stubborn to things and I see I have already gotten a bit religious about Py2.7 - as my mentor says(scolds me) I agree its a bit(not actually) bad but I am proud of it.
So here I am, started off exploring with Python where I like that concept of (1) new concurrent module where you can do multithreading with a new map function, well is nt that simply great !? :)
(2) Secondly favourite things I like is explicit and implicit exception handling where some intelligent cleanup is done so next when a type-error happens you don’t get 10 - 15 lines of code I think, just 2-3 line of err is enough.
(3) IO, Decimal Modules is re-written to increase to increase performance. Import module is re-written to handle deadlock issues created while every thread tried to import same module( good luck to those VM guys who are running different kinds of Hardware platforms). Sta
(4)new module - “ipaddress”, thank god - I don’t have to define and check about them every time :) - Lazyness rocks !! ;)
(5) virtualenv pkg is default pkg now.
(6) Inside of classes now we can use => name + ‘.’ + self.qualname # and it gives you fully qualified name. There is also another parameter called METACLASS inside of each by default
(7) Extended iterable unpacking - below is valid now
first, *rest = range(5)
first, *mid, last = range(12)
(8) If recall properly, by now you should know that everything in python is objects mostly and it maintain dict for each. So what happened here in Py3.3, these memory views are rewritten to maintain to one mega view I think and it made python work faster. Thumbs up !!
Here is a set of things I have kept as a notes for myself. If you are further interested, you can find 40+ min presentation over Youtube.
My Notes :
- Traceback - Module # clean-up for error codes
- Explicit exception chaining
- Module : importlib
For above image - If you have few codes which are already compiled to .pyc, then they don’t get re-written but new ones will be created inside pycache directory.
- Namespace packages
- Python3 with standard API functions as defaults
- Function annotations # Security & ease testing
- Thanks ASCII and hello to UTF-8 !
- String literals : new UTF-8 stuff !
Conclusion : Performance or 2.7 & 3.3 are same :)
Below is comparison specific to packages.