Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 PYTHON


  Unfortunate Python

Python is a wonderful language, but some parts should really have bright WARNING signs all over them. There are features that just can't be used safely and others are that are useful but people tend to use in the wrong ways.This is a rough transcript of the talk I gave at my local Python group on November 15, with some of the audience feed back mixed in. Most of this came from hanging around the Python IRC channel, something I highly recommend.[update 2011-12-19: improved "array" critique, add "python -i" suggestion to "reload" critique, add html targets to sections]Easy Stuff FirstStarting...

3,097 0       PYTHON WARNING DEFECTS DEPRECATED METHODS


  Python threads: communication and stopping

A very common doubt developers new to Python have is how to use its threads correctly. Specifically, a large amount of questions on StackOverflow show that people struggle most with two aspects:How to stop / kill a threadHow to safely pass data to a thread and backI already have a blog post touching on these issues right here, but I feel it’s too task-specific for sockets, and a more basic and general post would be appropriate. I assume the reader has a basic familiarity with Python threads, i.e. has at least went over the documentation.So, without further ado, here’s a sample "w...

3,011 0       PYTHON MULTITHREADING COMMUNICATION SYNCHRONIZE


  Good to Great Python reads

A col­lec­tion of python “must reads”:The Python yield key­word explainedPython’s super() con­sid­ered super!Under­stand­ing Python DecoratorsWhat is a meta­class in Python?Meta­classes DemystifiedTry/Catch for val­i­da­tion or speed?Python (and Python C API): __new__ ver­sus __init__Python “self” keywordPython and the Prin­ci­ple of Least AstonishmentA Curi­ous Course on Corou­tines and ConcurrencyGen­er­a­tor Tricks for Sys­tems ProgrammersCode like a Python­ista: Idiomatic Py...

2,983 0       PYTHON REFERENCE EBOOK READING MATERIAL


  Why learning Haskell/Python makes you a worse programmer

I've found, contrary to what you sometimes read, that learning Python and Haskell has not improved my programming using other languages. Haskell in particular, being so different from imperative languages, is supposed to give new insights into programming that will help you even when you are not using the language. My current experience doesn't exactly tally with this, and here is why:Demotivation.I find I think in Python, and even in Haskell to some extent, even though I have used Haskell very little. I constantly find myself wanting to use idioms from these languages, or noticing h...

2,973 2       PYTHON PROGRAMMER BAD BAD PROGRAMMER HASKELL


  Bug caused by using changeable value as the default in "python method overload"​

In python we can set the passed in parameter's default value to make the function has the same running feature as the method overload in Java.Define a function like this:def testFunction(self, param1, param2=None, param3=None):Normally we use "None" as the parameter's default value. We can also use str/bool as the default value, but is it OK we use empty list [] as its default value?This is our test program:""" A test program using empty list as the passed-in parameter's default value."""class TestFunc(object): def __init__(self, id, parm = []): self.ObjId = id self.parm = ...

2,851 0       PYTHON


  Standardizing Python WSGI deployment

Over the past year I have been testing all of the new python platform as a service companies that have popped up, and I have posted my notes on my blog so that everyone can learn from my experiences. ep.io, apphosted.com, gondor.io, dotcloud.com, DjangoZoom.com, Heroku, Django hosting roundup,All and all, the platforms were very similar, they allowed you to easily host your python/django project without having to worry about managing a server or other typical system administration duties. Some of the services were more advanced and had more features then others, but since it was s...

2,840 0       JAVA PYTHON STANDARD WAR


  Why so many Python web frameworks?

When asked about the plethora of web frameworks for Python the answer is often that it is way too easy to put together one in Python. That certainly seems plausible since there are so many libraries that implement the components of a web framework and if it's easy to plug those pieces together then maybe that lowers the bar of entry for new frameworks. So let's give it a shot, we'll pick some components and spend a couple hours seeing how far we can get building a web framework, which we'll call Robaccia. Executive Summary: Robaccia was built in three hours and a total of 60 lines of Pytho...

2,641 0       WEB DESIGN PYTHON WEB FRAMEWORK DYNAMIC SCRIPTING LANGUAGE


  Mutli-inheritance bug between python 2.7 and 3.7

When we have run a py3.7 code under py2.x or a py2.x code under 3.x ,if a class do mutli-inheritance from 2 parent and the 2 parents also got inheritance from same parent, the different way to handle inheritance chain between python 2 and 3 will cause some running time bug:Assume we got this sample program inheritTest.py :# Purpose: Test mutli-inheritance different between python2 and 3# Author: Yuancheng Liu# Created: 2019/05/16class A: def getVal(self): print("call A's getVal()") def setVal(self): print("call A's setVal()")class B(A): def getVal(self): ...

2,628 1       INHERITANCE PYTHON 3 PYTHON