Tagged Questions
2
votes
1answer
160 views
Python, magic and objects that add attributes to its owner
Let me start with a disclaimer: I'm not the best programmer out there. I do however study I.T. and learnt a bit of Java and C.
I'm getting stuck into Python and Django + Mongoengine, I'm not going to ...
4
votes
2answers
160 views
Designing a function with many optional components
I'm trying to figure out a good practice for designing a function with (many) optional components.
For a specific example, say I am interested in designing a feature extractor function that takes as ...
2
votes
2answers
129 views
Changing __class__ in a factory?
I'm parsing a set of XML files of different kinds (these kinds are known in advance).
These are my requirements:
I want an object to represent each XML document (object-xml mapping)
I'd rather ...
1
vote
3answers
201 views
Hacking Python “Requests” library.. How to start as an intermediate pythonista?
My question is conceptual, yet extremely vital for me.
I'm an intermediate Python developer. I know fair enough about it, and actually use it on a daily basis. Now, I would like to transform my ...
3
votes
4answers
229 views
Representing complex object dependencies
I have several classes with a reasonably complex (but acyclic) dependency graph. All the dependencies are of the form: class X instance contains an attribute of class Y. All such attributes are set ...
2
votes
2answers
300 views
Caching factory design
I have a factory class XFactory that creates objects of class X. Instances of X are very large, so the main purpose of the factory is to cache them, as transparently to the client code as possible. ...
49
votes
8answers
8k views
Are there any design patterns that are unnecessary in dynamic languages like Python?
I've started reading the design pattern book by the GoF. Some patterns seem very similar with only minor conceptual differences.
Do you think out of the many patterns some are unnecessary in a ...
3
votes
4answers
945 views
What is the simplest human readable configuration file format?
Current configuration file is as follows:
mainwindow.title = 'test'
mainwindow.position.x = 100
mainwindow.position.y = 200
mainwindow.button.label = 'apply'
mainwindow.button.size.x = 100
...
3
votes
4answers
331 views
What is the proper name for this design pattern in Python?
In Python, is the proper name for the PersonXXX class below PersonProxy, PersonInterface, etc?
import rest
class PersonXXX(object):
def __init__(self,db_url):
self.resource = ...
6
votes
2answers
2k views
Python programming patterns and practices?
What are the best python programming patterns and practices you are using every day?
I don't mean only design patterns (there are lot of OO design patterns that can be used in python), I mean pure ...