Python Forum
Seniors, please answer this
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Seniors, please answer this
#3
Quote:What would you say are the most common mistakes made using Python?
  • Indentation errors
  • mixed white spaces and tabulators in indentation
  • saving the source code with the name of an existing module. For example: os.py, socket.py, sys.py
  • The misunderstanding between assignment and mutation. Objects are passed by reference.
  • from something import *
  • Since Python 3: bytes -> decode() -> str -> encode() -> bytes

Quote:Do you ever multithread?
Yes, but it's not usable for CPU bound tasks, because Python is single threaded, which is an implementation detail of CPython (GIL).
You better use multiprocessing for CPU bound tasks. Multithreading works for IO bound tasks.
If you have many concurrent connections, the asynchronous model is better (asyncio).

Quote:What's your favorite Python 3 feature (that is missing in Python 2)? Why?
I miss many features in Python 2.7. I just don't use it anymore.
To name some of them:
  • format strings
  • good unicode support
  • pathlib
  • asyncio
  • dataclasses
  • multiple star assigment:
    head, *body, tail = ['Start', 1, 2, 3, 4, 5, 'End']
    print('head:', head)
    print('body:', body)
    print('tail:', tail)
    Output:
    head: Start body: [1, 2, 3, 4, 5] tail: End
  • math.tau, very important to get rid of the factor 2
  • much more...

You try to compare two different languages, where the older one was not extended since 10 years.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
Seniors, please answer this - by nadaa - Feb-18-2019, 11:11 AM
RE: Seniors, please answer this - by buran - Feb-18-2019, 11:23 AM
RE: Seniors, please answer this - by nadaa - Feb-18-2019, 03:39 PM
RE: Seniors, please answer this - by DeaD_EyE - Feb-18-2019, 12:04 PM
RE: Seniors, please answer this - by Larz60+ - Feb-18-2019, 03:58 PM
RE: Seniors, please answer this - by metulburr - Feb-18-2019, 05:21 PM
RE: Seniors, please answer this - by Larz60+ - Feb-18-2019, 08:11 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020