0
votes
1answer
38 views

Python design advice

I have written a generic framework in python for some particular type of task. It is a webserver which serves different requests and operations. This framework can be used by many projects and each ...
0
votes
0answers
23 views

python design pattern feedback

i am looking for a feedback on my aproach. i want to write an library to "talk" with remote networked device (mikrotik). communication is simple via socket. to communicate you must send a sentence ...
0
votes
2answers
41 views

Prototype pattern in Python

I have the following implementation of the prototype pattern in Python 2.7: def clone (instance): x = object.__new__ (type (instance)) x.__dict__ = dict (instance.__dict__) return x ...
0
votes
2answers
53 views

Trying to parse a string into a list in Python

So I have a string like so: pattern = "AAaa$$##" I want to parse it into a list so it outputs letter by letter, but I can't do pattern.split("") cause it gives an error. Like this pattern.split() ...
1
vote
1answer
36 views

Which is the recommended way to use the Null Pattern in Python?

The other day I was coding when suddenly I discovered myself struggling with a simple problem but confuse solution (at least in a pythonic way to go). The code was supposed to just download some ...
0
votes
1answer
26 views

python object to xml hiearchy

I have a set of xml files that are kind of defined in a tree like structure. The structure is somewhat like : root -> view[{ config, c_header, a_header }] I would like to be able to define all this ...
0
votes
3answers
50 views

How to call specific function based on parameters to decorator

disclaimer: I'm obviously quite new to decorators To create and decorate functions in python is quite simple and straight forward, and this excellent answer (the one with the most upvotes), gives a ...
1
vote
1answer
60 views

Python replace text (regex?)

Hello I have a Problem with the replace funktion. I can print the link but I can't replace the link. Which code I have forgotten? import urllib2 import re htmlfile = ...
1
vote
2answers
47 views

Calling chains methods with intermediate results

I have a class and a some methods of it. Could I keep a result of the methods between calling. Example calling: result = my_obj.method_1(...).method_2(...).method_3(...) when method_v3(...) ...
1
vote
1answer
54 views

Using __getattr__ for implementing the decorator design pattern [duplicate]

Say you have class Foo which has 4 methods and class FooDecorator. From those 4 methods, FooDecorator only needs to decorate one method. Is it ok from a pythonic/OO design point of view to use ...
0
votes
1answer
58 views

Wrapping the observer pattern with Cython

The observer pattern appears frequently in my C++ project, which I now want to expose to the Python interpreter via Cython bindings. I tried to construct a minimal example illustrating the situation. ...
3
votes
1answer
62 views

Design Pattern for complicated queries

We are currently developing an application that makes heavy use of PostgreSQL. For the most part we access the database using SQLAlchemy, and this works very well. For testing the relevant objects can ...
0
votes
3answers
52 views

A pattern where a class has a number of similar methods (same type signature, similar semantics)

It's hard to describe this in the abstract, so let me just give a (simplified & snipped) example: class ClassificationResults(object): ...
0
votes
1answer
43 views

Python: re.sub pattern and replacement wildcard

I have been going this bit of code for what seems to be a lifetime and cannot seem to get it to work. pattern = "\[([a-zA-Z0-9].*?)#([a-zA-Z0-9].*?)\]" pattern_obj = re.compile(pattern, re.MULTILINE) ...
0
votes
4answers
68 views

python string processing, strip out date-time patterns

Python processing question -- strip out date-time patterns: I have some data from a GSM unit of the form: +CMGL: 1,"REC READ","+111111111111","13/05/25,05:15:16+04",25-05-13,05:15:20, 0.668 +CMGL: ...

1 2 3 4 5 18
15 30 50 per page