Hello,
I'm trying to think of an OO way to abstract the storage of an
application I am working on.
The classes are (example):
FamilyMember (base class)
Family (container class)
I've been thinking of using a FamilyDoc class to interface the Family
container class to a storage location (particula
Hello,
I'd like to know how its possible to pass a data attribute as a method
parameter.
Something in the form of:
class MyClass:
def __init__(self):
self.a = 10
self.b = '20'
def my_method(self, param1=self.a, param2=self.b):
pass
Seems to produce a NameError o
Thanks Ben.
What does it mean that they're statically bound?
It seems weird that I'm not able to access variables in the class
namespace even though these attributes come into existance after class
instantiation.
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
I have a list that includes lists of integers, in the form of:
li = [[0, 1, 2], [3, 4, 5], ...]
packed = struct.pack(str(len(li)*3)+'i', li)
The frmt part is right, as I'm multiplying by 3, 'cause each inner list
has 3 elements.
What can I do to get li as a single list of integers?
I tr
Just came up with this:
litemp = []
[litemp.extend(i) for i in li]
Seems to give me a list with all the inner elements of li, not sure if
struct.pack will accept it now, but I'll give it a try.
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik, thanks alot.
Your preposition worked like a charm, plus I got to learn how to
reverse an inner for loop using list comprehensions :)
What I don't understand is what are you doing with *(...), this is
supposed to pack its contents as a list?
--
http://mail.python.org/mailman/listinfo/py
Is there some other practice than reading all the strings and slicing
them later?
They're stored in the form of:
List Group[10]:
char[17] name;
So I thought of doing:
unpacked = unpack('%s' % (10*17), data)
And then slicing the list by a step of 17.
Is there some way to have unpack return a
Unfortunately I'm familiar with the generator concept, I'll look into
it though, 'cause it saved me at least once already :)
Thanks mate.
--
http://mail.python.org/mailman/listinfo/python-list
I've been thinking if there's a point in applying some specific OOP
techniques in Python as we do in other languages.
i.e. we usually define private properties and provide public functions
to access them, in the form of:
get { ... } set { ... }
Should we do the same in Python:
self.__privateAttr
Thanks for all the useful answers :)
Alot of stuff to take into consideration/chew on. I come up with
similar drawbacks now and then, 'cause some OOP techniques can be made
in Python relatively simpler or plainly different (still simpler
though). Though I am hesitant on how to act on certain occas
Is there a way to have a whole module package use the new-style
classes, without having to specify it per module-file or even worse,
per class definition?
Maybe by declaring the __metaclass__ in the module's __init__.py?
--
http://mail.python.org/mailman/listinfo/python-list
OS: Windows XP + SP1
On this particular box, I hadn't moved to 2.4.3 yet.
So, earlier today, I uninstalled Python2.4.2 and installed 2.4.3 using
the .msi installer.
It seems though everything looked great, that when I invoke 'python'
from the command line, I get Python2.4.2 (as the header states)
Heh, Frederic,
It seems that its Lilypond's (www.lilypond.org) fault.
It registered its bin directory in the PATH variable, which seems to
contain a python.exe too.
So the result of:
>>>import sys; sys.executable
'D:\\Program Files\\LilyPond\\usr\\bin\\python.exe'
As for the instances of python24
I want a class method to take action depending on the type of the
arguement passed to it.
ie:
getBook(id) # get the book by ID
getBook(name) # get the book by name
...
Other languages use the term function/method overloading to cope with
this. And when I googled about it seems that GvR is testing
On Dec 27, 7:41 am, eric <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I want to setup simple python web server and I want it to just unzip
> and run, without any installation steps (have no right to do it).
>
> I've tried to write by myself, however, I find I am getting into more
> details like process
15 matches
Mail list logo