[Kde-windows] KDE/kdelibs

Jarosław Staniek js at iidea.pl
Tue Oct 11 22:50:34 CEST 2005


Ralf Habacker said the following, On 2005-10-11 20:51:

 > Am Dienstag, 11. Oktober 2005 18:37 schrieb Jarosław Staniek:
 >
 >>David Faure said the following, On 2005-10-11 18:30:
 >>
 >>>On Tuesday 11 October 2005 18:27, Jaroslaw Staniek wrote:
 >>>
 >>>>+2005-10-11
 >>>>+ It's good idea to append always a space to string definitions:
 >>>>+ obj.libs = ' lib1 lib2 ' instead of 'lib1 lib2' because then
 >>>>+ adding
 >>>>+
 >>>>+  obj.libs += 'lib3'
 >>>>+
 >>>>+  will cause horrible error: 'lib1 lib2lib3'
 >>>>+                                      ^^
 >>>>+
 >>>
 >>>Isn't that the whole reason for using the [] notation ("list"?), so that
 >>>it's possible to append without whitespace problem?
 >>
 >>Heh, of course. But people still like to use 'lib1 lib2' instead of
 >>['lib1', 'lib2']. What to do to solve this? Hmm, maybe to overload "="
 >>operator so that only lists are allowed?
 >
 > Is that possible with python ?

Yes, except overloading assignment operator is possible because python handles 
variables as references.

See attached code of StringList class and example use. The class' name should 
be better selected...

It may work unless somebody just enters:

obj = env.kdeobj('shlib', env)
obj.libs = 'libname'
          ^^

To avoid the risk we need to:
1. init check type of the obj.libs to StringList() in kdeobj
2. on obj.execute() we need to check if type(libs) == StringList
   --- obvious error message is better than wrong behaviour...


OK?

-- 
regards / pozdrawiam,
  Jaroslaw Staniek / OpenOffice Polska
  Kexi Developer:
      http://www.kexi-project.org | http://koffice.org/kexi
  KDE3, KDE4 libraries for developing MS Windows applications:
      http://wiki.kde.org/tiki-index.php?page=KDElibs+for+win32
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: t.py
Url: http://mail.kde.org/pipermail/kde-windows/attachments/20051011/2a319768/attachment.ksh 


More information about the Kde-windows mailing list