Home

Would someone like to suggest a replacement for this? This is a
function that returns different kinds of similar objects, depending
on what is asked for. PSP and PWR are classes. I don't really
want to re-write the calling code very much: I'm just wondering
if the function can be replaced with some kind of OOP pattern.

def Device(DeviceType):
if DeviceType=='PSP':
return PSP()
elif DeviceType=="Power Supply"
return PWR()
etc...


Thanks!

previous
next

Re: how to initialize list in a vector
Username of Caller
Re: Porable Semaphore implemented in C++ ?
Re: The Future of Python Threading
Re: The Future of Python Threading
Podaruj Zycie
Fundacja Sloneczko
Kidprotect
Dzieci Niczyje
Rodzic Po Ludzku