473,322 Members | 1,526 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

DictObjSys (DOS): Dictionary Objects System V.0.0.1 (2004 Oct 26)

RDJ
=== This is a AoooAoooA project (^_^) ===

DictObjSys (DOS): Dictionary Objects System V.0.0.1 (2004 Oct 26)

Copyright (C) 2004 RDJ

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
TABLE OF CONTENTS
*****************

_REFERENCES
_FILES
_RUN_DOS
_REFERENCES
************

Redirect: AoooAoooA.too.it
____Site: it.geocities.com/dawjde/AoooAoooA.html
___Email: rd****@inwind.it (OBJECT: [AoooAoooA] your object)
_FILES
******

DictObjSys/DOS.py...........library
DictObjSys/GNU_LGPL.txt.....GNU LIBRARY GENERAL PUBLIC LICENSE
DictObjSys/README.txt.......this file
_RUN_DOS
********

DOS is a library but you can run a test:

python DOS.py
Appear:

This is a test:
1-2
['three.a', 'three.b']
1-2-3b
It is OK! Now view the source code...

#
# Class
#

class DOS:
def __init__(self):
self.value = None
self.dict = {}

def get(self,path):
dos = self.getDOS(path)
if dos == None:
return None
else:
return dos.value

def getDOS(self,path):
pl = path.split('/')
dos_tmp = self
try:
for r in pl:
dos_tmp = dos_tmp.dict[r]
return dos_tmp
except KeyError:
return None

def keys(self):
return self.dict.keys()

def set(self,path,value):
pl = path.split('/')
dos_tmp = self
for r in pl:
if dos_tmp.dict.has_key(r) == False:
dos_tmp.dict[r] = DOS()
dos_tmp = dos_tmp.dict[r]
dos_tmp.value = value;
#
# Main
#

if __name__ == '__main__':
print 'This is a test:'
dos = DOS()
dos.set('one/two','1-2')
dos.set('one/two/three.a','1-2-3a')
dos.set('one/two/three.b','1-2-3b')
print dos.get('one/two')
print dos.getDOS('one/two').keys()
print dos.get('one/two/three.b')
Jul 18 '05 #1
0 1018

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: none | last post by:
or is it just me? I am having a problem with using a dictionary as an attribute of a class. This happens in python 1.5.2 and 2.2.2 which I am accessing through pythonwin builds 150 and 148...
2
by: jg | last post by:
I was trying to get custom dictionary class that can store generic or string; So I started with the example given by the visual studio 2005 c# online help for simpledictionay object That seem...
90
by: Christoph Zwerschke | last post by:
Ok, the answer is easy: For historical reasons - built-in sets exist only since Python 2.4. Anyway, I was thinking about whether it would be possible and desirable to change the old behavior in...
7
by: noro | last post by:
Is it possible to do the following: for a certain class: ---------------------------- class C: def func1(self): pass def func2(self):
20
by: Gustaf | last post by:
This is two questions in one really. First, I wonder how to convert the values in a Dictionary to an array. Here's the dictionary: private Dictionary<Uri, Schemaschemas = new Dictionary<Uri,...
18
by: Marko.Cain.23 | last post by:
Hi, I create a dictionary like this myDict = {} and I add entry like this: myDict = 1 but how can I empty the whole dictionary? Thank you.
9
by: =?Utf-8?B?SG93YXJkIFNtaXRo?= | last post by:
I am using VC++ 6.0 (with SP5 installed). When using WinXP this is with SP2 installed. I am developing an instrumentation system comprising a set of networked PCs connected using TCP/IP TCP links....
5
by: davenet | last post by:
Hi, I'm new to Python and working on a school assignment. I have setup a dictionary where the keys point to an object. Each object has two member variables. I need to find the smallest value...
8
by: Bob Altman | last post by:
Hi all, I'm trying to do something that should be really easy, but I can't think of an obvious way to do it. I have a dictionary whose value is a "value type" (as opposed to a reference type --...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.