#python - Wed 21 Mar 2007 between 08:54 and 09:04

HowDoIwhats oop im going to google
iacopopobject oriented programming
koshiacopop: it is very rarely needed
iacopopkosh: why?
koshiacopop: for example most of the design patterns in the gof book you see are artifacts of how c++ does things
FossiletHello, kosh.
koshiacopop: the design patterns where designed to get around problems in the language and codify the common ways of getting around stuff in the language
iacopopinfact i'm searching something in python
Jerubsingleton is a really good example of what's hard in C++ and easy in python
in python to do a singleton you do this:
class MyClass: # put methods here
iacopopi know
JerubMyClass = MyClass()
koshsinglton is a bad idea though in general
Jeruband some python programmers go to incredibly lengths to do the same thing :(
koshlater if it turns out your don't need a singleton then fixing stuff can be a royal pain in the neck
Jerubheh, yeah
extr3mdoes anyone here know of a working trapd implementation in python (for snmp) ?
Jerubwell, the only place I can think where it makes sense is a fieldstorage object in cgi programming
koshit is better to be explicit about theo bject reference and keep it around
it is just that nearly every c++/java design pattern has a 2-4 line version to do the same thing in python very simply
so why write up a whole bunch of design patterns when if you go to solve the problem the natural solution would be the one you choose anyways?
design patterns are written up because they are hard, not because anyone could trip and fall and figure it out
iacopopbut i working in a big project in python, and i would like to make things easy knowing some patter; surfing in google i find something oriented to python and i'm searching some book
i you don't use pattern you cannot make a goog "Big" project
that's sure
koshI don't agree at all
patterns are artifacts of bad language design for the most part
iacopop: how large are you defining as a big project?
Jerub: one problem I haev run into comparing code size is I have seen projects done in 1M loc that where later refactored to about 50K :)
iacopopbig means: reusable, modular
koshI have done more then a few reusable, modular and extentable projects with no patterns
redirfunny I though big meant large
koshI also know of other large projects that are done and meet all those requirements
loop at zope, twisted, and a host of other projects that are easily qualified as large
jkpcan someone tell me where datetime lives?
Yhg1sjkp: the datetime type lives in the datetime module.

Page: 2 9 16 23 30 37 44 51 58 65 72