Weekly Python StackOverflow Report: (clxix) stackoverflow python report

These are the ten most rated questions at Stack Overflow last week.
Between brackets: [question score / answers count]
Build date: 2019-03-16 20:11:00 GMT

  1. Python if-else code style for reduced code for rounding floats – [17/11]
  2. Why is (2^31) >> 32 not 0? – [12/1]
  3. Python: Check if string and its substring are existing in the same list – [11/5]
  4. Convert dataframe into dictionary – [10/2]
  5. How do I slice a string by characters in Python? – [8/5]
  6. Fastest way to pop N items from a large dict – [8/2]
  7. Why is AdamOptimizer duplicated in my graph? – [8/0]
  8. How the dtype of numpy array is calculated internally? – [7/2]
  9. Why is `arr.take(idx)` faster than `arr[idx]` – [7/0]
  10. Python type hint for classes that support __getitem__ – [6/3]

Planet Python

Weekly News Summary for Admins — 2019-03-15

Lot’s of news for important conferences this week. JamfNation User Conference, MacSysAdmin, and WWDC are getting obviously closer. Also, MacADUK has sold out of tickets! (10 days and counting…)

If you would rather get the weekly newsletter by email, you can subscribe to the Scripting OS X Weekly Newsletter here!! (Same content, delivered to your Inbox once a week.)

On Scripting OS X


MacAdmins on Twitter

  • Tim Perfitt: “Version 1.4 of MDS is going to be awesome. How awesome you ask? Glad you asked. 1/” (Thread)
  • Steve Troughton-Smith: “I like to remind myself sometimes that the current Mac Pro was announced before iOS 7…”

News and Opinion

Bugs and Security

Support and HowTos

Scripting and Automation

Updates and Releases

To Watch

To Listen

Just for Fun


There are no ads on my webpage or this newsletter. If you are enjoying what you are reading here, please spread the word and recommend it to another Mac Admin!

If you want to support me and this website even further, then consider buying one (or all) of my books. It’s like a subscription fee, but you also get a useful book or two extra!

Scripting OS X

PyCoder’s Weekly: Issue #359 (March 12, 2019)

#359 – MARCH 12, 2019
View in Browser »

The PyCoder’s Weekly Logo

Writing Beautiful Pythonic Code With PEP 8

Learn how to write high-quality, readable code by using the Python style guidelines laid out in PEP 8. Following these guidelines helps you make a great impression when sharing your work with potential employers and team mates. Learn how to make your code PEP 8 compliant with these bite-sized lessons.

Enforcing The Single Responsibility Principle (SRP) in Python

The Single Responsibility Principle (or SRP) is an important concept in software development. The main idea of this concept is: all pieces of software must have only a single responsibility. Nikita’s article guides you through the complex process of writing simple code with some hands-on refactoring examples. You’ll use callable classes, SRP, dependency injection, and composition to write simple Python code. Nice read!

Find a Python Job Through Vettery


Vettery specializes in developer roles and is completely free for job seekers. Interested? Submit your profile, and if accepted, you can receive interview requests directly from top companies seeking Python devs. Get started →
VETTERY sponsor

How to Set Up Your Python Project for Success With Tests, CI, and Code Coverage

How to add tests, CI, code coverage, and more. Very detailed writeup.

Detecting Real vs Fake Faces With Python and OpenCV

Learn how to detect liveness with OpenCV, Deep Learning, and Keras. You’ll learn how to detect fake faces and perform anti-face spoofing in face recognition systems with OpenCV.

Managing Multiple Python Versions With pyenv

In this step-by-step tutorial, you’ll learn how to install multiple Python versions and switch between them with ease, including project-specific virtual environments, even if you don’t have sudo access with pyenv.

Python Packages Growth Since 2005

“The Python ecosystem has been steadily growing [since 2005]. After the first few years of hyper growth as PyPI gained near-full adoption in the Python community, the number of packages actively developed each year—meaning they had at least one release or new distribution uploaded—has increased 28% to 48% every year.”


Loop With “Else” Clause

“What is the Pythonic way to handle the situation where if a condition exists the loop should be executed, but if it does not something else should be done?”

The Source for the Zen of Python Completely Violates the Zen of Python

“I was clicking around in PyCharm and noticed that the this module in CPython violates basically all of these principles.”

Python Jobs

Sr Enterprise Python Developer (Toronto, Canada)


Senior Systems Engineer (Hamilton, Canada)


Python Web Developer (Remote)

Premiere Digital Services

Software Developer (Herndon, VA)


Python Software Engineer (Berlin, Germany)


Computer Science Teacher (Pasadena, CA)

ArtCenter College of Design

Senior Python Engineer (New York, NY)


Software Engineer (Herndon, VA)

Charon Technologies

Web UI Developer (Herndon, VA)

Charon Technologies

More Python Jobs >>>

Articles & Tutorials

Don’t Make It Callable

You can make any Python object callable by adding a __call__ method to it. Like operator overloading this seems like a nifty idea at first…but is it really? Moshe’s article goes over some use cases and examples to discuss whether making objects callable is a good idea or not.

Python Pandas: Merging Dataframes Using Inner, Outer, Left and Right Joins

How to merge different Dataframes into a single dataframe using Pandas’ DataFrame.merge() function. Merging is a big topic, so this part focuses on merging dataframes using common columns as Join Key and joining using Inner Join, Right Join, Left Join and Outer Join.

Python Opportunities Come to You on Indeed Prime


Indeed prime is a hiring platform exclusively for tech talent like you. If you’re accepted, we’ll match you with companies and roles that line up with your skills, career goals and salary expectations. Apply for free today.
INDEED sponsor

An Introduction to Neural Networks With Python

A simple explanation of how neural networks work and how to implement one from scratch in Python. Nice illustrations!

Import Almost Anything in Python

An intro to module loaders and finders so you can “hack” Python’s import system for fun and profit.
ALEKSEY BILOGUR • Shared by Aleksey Bilogur

Why You Want Formal Dependency Injection in Python Too

“In other languages, e.g., Java, explicit dependency injection is part of daily business. Python projects however very rarely make use of this technique. I’d like to make a case for why it might be useful to rethink this approach.”

Understanding and Improving Conda’s Performance

Update from the Conda team regarding Conda’s speed, what they’re working on, and what performance improvements are coming down the pike.

Sentence Similarity in Python Using Doc2Vec

Using Python to estimate the similarity of two text documents using the Doc2Vec module.

Projects & Code

iodide-project/pyodide: Run CPython on WASM in the browser

And not just that, it’s a full Python scientific stack, compiled to WebAssembly for running in the browser. More info here.

PEP 8 Speaks: GitHub Integration for Python Code Style

A GitHub app to automatically review Python code style over Pull Requests.


Python Atlanta

March 14, 2019

PyCon Odessa

March 16 to March 17, 2019

PyCon SK 2019

March 22 to March 25, 2019

Happy Pythoning!
This was PyCoder’s Weekly Issue #359.
View in Browser »


[ Subscribe to 🐍 PyCoder’s Weekly 💌 – Get the best Python news, articles, and tutorials delivered to your inbox once a week >> Click here to learn more ]

Planet Python

Django Weekly: #73 – Djangochat podcast, Django Recommended Reading and more

Worthy Read

I ’ve spent weeks working new podcast called DjangoChat The episode launched listen

At Caktus, we believe in continued learning (and teaching). It’s important to read up on the latest industry trends and technologies to stay current in order to address our clients’ challenges. We even maintain a library in our office for staff use, and we add references frequently. Our team enjoys sharing what they’ve learned by contributing to online resources, such as the Django Documentation and the Mozilla Developer Network Web Docs.

Django ORM uses transactions or savepoints automatically to guarantee the integrity of ORM operations that require multiple queries, especially delete() and update() queries. Few things are should be clear in mind while writing the transaction block with atomic().

This article aims to simplify the process of deploying, maintaining, and scaling a production-grade Django app on Heroku. We’ll also review some tips and tricks for simplifying the deployment process.

Masonite is an increasingly popular Python web framework that has garnered a lot of attention in the Python community recently.I am not here to say that Django is crap and that Masonite is the best thing in the entire world but I have talked with a lot of developers over the past year on why they made the switch from Django to Masonite. Below I will go into some detail on the common reasons I have found between them all and why Masonite may make more sense to use for your next project.

In this article, we will see how to create a Universal application using Django and Nuxt.js. Django will handle the backend operations and provide the APIs using the (DRF) Django Rest Framework, while Nuxt.js will create the frontend.

The client requested that I add a feature to allow administration users to download the data in CSV format. They also wanted me to include a feature where all of the data can be dumped into a zip file for download.I will write about how I accomplished this using two different methods.

A pragmatic styleguide for Django API Projects.

This django widget contains Date-Picker, Time-Picker, DateTime-Picker input widgets with date-range-picker functionality for django version >= 2.0. The widget implements flatpickr to display date-pickers in django model forms and custom forms which can be configured easily for date-range selection. For Bootstrap date-picker see django-bootstrap-datepicker-plus.

Planet Python

Weekly Python StackOverflow Report: (clxviii) stackoverflow python report

These are the ten most rated questions at Stack Overflow last week.
Between brackets: [question score / answers count]
Build date: 2019-03-09 13:28:16 GMT

  1. Jupyter notebook: No connection to server because websocket connection fails – [30/3]
  2. Inconsistent behaviour between dict.values() and dict.keys() equality in Python 3.x and Python 2.7 – [23/1]
  3. Why a 352GB NumPy ndarray can be used on a 8GB memory macOS computer? – [19/1]
  4. Why is int(x-1) == x True in Python 3.7 with some values of x? – [11/1]
  5. Why does Python enforce change in size during iteration for dict, but not for list? – [10/0]
  6. How to use math.log10 function on whole pandas dataframe – [7/3]
  7. Consequences for virtual env when system’s Python is removed and/or updated – [7/2]
  8. os.path.basename() is inconsistent and I’m not sure why – [7/1]
  9. Python script calling from laravel – [7/0]
  10. Contract words in python with set length – [6/5]

Planet Python