Re: [Tutor] General method for creating a partitioned window

2011-08-09 Thread Knacktus
Am 09.08.2011 16:44, schrieb Shwinn Ricci: I am using wxPython and OpenGL, although I would prefer to run a script in Maya, but this does not seem efficient for what I want to do, since maya only allows for 3-D visualization, not simultaneous 2-D/3-D viewing (i.e., side-by-side) On Thu, Aug 4

Re: [Tutor] How to get the keys of a dict inside a dict. ValueError: too many values to unpack

2011-08-07 Thread Knacktus
Am 07.08.2011 17:37, schrieb Kayode Odeyemi: Hello all, Please I need help figuring out this permutation. I have a dict like this: x = "{'pk': 1L, 'model': 'trans', 'fields': {'updated': 2011, 'tel': 3456}", "{'pk': 2L, 'model': 'trans2', 'fields': {'updated': 2011, 'tel': 34510}"; This is not

Re: [Tutor] Object Management

2011-07-27 Thread Knacktus
Am 27.07.2011 15:51, schrieb Alexander: Hello everyone. I'm having trouble wrapping my mind around a project I'm working on. My goal is to create a program that manages (allows its users to manipulate, search by criteria and edit) objects. There is one type of object, for example I'll say it's a

[Tutor] Descriptors and type declaration order

2011-07-14 Thread Knacktus
Hi guys, I've got the following (not working) code: class Attribute(object): def __init__(self, attribute_name, att_type_name): self._attribute_name = attribute_name try: self._attribute_type = globals()[att_type_name] except KeyError: self._at

Re: [Tutor] Combining two Dictionaries

2011-04-30 Thread Knacktus
def combine(d1, d2): for key in d1: if key in d2: d2[key] += d1[key] [Remark] I usually avoid changing function arguments. But later on you're talking about using this function as a method a class, so d1 and d2 would be instance attributes I guess. When I ini

Re: [Tutor] Gtk - relational data display and edit

2011-04-26 Thread Knacktus
Am 26.04.2011 17:34, schrieb bod...@googlemail.com: Hi, I am reading in data from a csv file which will be in a format like this User1, attrib1, attrib2 User2, attrib1, attrib2 Etc. And need to display this in a window. My initial thought was to use gtk.Entry widgets because I will need to ed

Re: [Tutor] counting a list of elements

2011-04-01 Thread Knacktus
Am 01.04.2011 21:31, schrieb Karim: On 04/01/2011 08:41 PM, Knacktus wrote: Am 01.04.2011 19:16, schrieb Karim: Hello, I would like to get advice on the best practice to count elements in a list (built from scractch). The number of elements is in the range 1e3 and 1e6. 1) I could create a

Re: [Tutor] Meta language and code generation

2011-04-01 Thread Knacktus
Am 01.04.2011 20:56, schrieb Karim: On 04/01/2011 08:29 PM, Knacktus wrote: Am 01.04.2011 19:09, schrieb Karim: Hello All, I would to ask you if somebody has experience or can give direction in a new project I have. I have a meta language description (in xml) from which I should generate

Re: [Tutor] counting a list of elements

2011-04-01 Thread Knacktus
Am 01.04.2011 19:16, schrieb Karim: Hello, I would like to get advice on the best practice to count elements in a list (built from scractch). The number of elements is in the range 1e3 and 1e6. 1) I could create a generator and set a counter (i +=1) in the loop. 2) or simply len(mylist). I

Re: [Tutor] Meta language and code generation

2011-04-01 Thread Knacktus
Am 01.04.2011 19:09, schrieb Karim: Hello All, I would to ask you if somebody has experience or can give direction in a new project I have. I have a meta language description (in xml) from which I should generate code on different languages. In my case, lisp and tcl. You need to provide more

Re: [Tutor] counting a list of elements

2011-04-01 Thread Knacktus
Am 01.04.2011 19:16, schrieb Karim: Hello, I would like to get advice on the best practice to count elements in a list (built from scractch). It's not clear to me what your starting point is. If you don't have a list and don't need a list, but have a large number of objects you create in y

Re: [Tutor] New person greets you all!

2011-03-11 Thread Knacktus
Am 11.03.2011 17:12, schrieb Yaşar Arabacı: Hi, First of all, I want to greet you all since this is the first time I will be using this mail groups. I consider myself being familiar with programming logic, structures in general. I do/did lots of PHP programming. I know python and PHP is pretty

Re: [Tutor] very odd math problem

2011-03-10 Thread Knacktus
Am 11.03.2011 06:05, schrieb Steven D'Aprano: Alex Hall wrote: Hi all, I am trying to get a list of ordered pairs from the below function. In my code, evaluate is more exciting, but the evaluate here will at least let this run. The below runs fine, with one exception: somehow, it is saying that

Re: [Tutor] very odd math problem

2011-03-10 Thread Knacktus
Am 11.03.2011 04:23, schrieb Alex Hall: Hi all, I am trying to get a list of ordered pairs from the below function. In my code, evaluate is more exciting, but the evaluate here will at least let this run. The below runs fine, with one exception: somehow, it is saying that -2+2.0 is 4.x, where x i

Re: [Tutor] BLAS Implementation on Python

2011-03-08 Thread Knacktus
Am 08.03.2011 20:00, schrieb Alan Gauld: "Stefan Behnel" wrote He doesn't have to write it, as it is very obvious, that no Python code on earth (even written by Guido himself ;-)) stands a chance compared to Fortran or C. Look at this: There is one big proviso. The C or Fortran needs to be w

Re: [Tutor] BLAS Implementation on Python

2011-03-07 Thread Knacktus
Am 07.03.2011 22:44, schrieb Steven D'Aprano: On Tue, 8 Mar 2011 12:28:56 am Knacktus wrote: Am 07.03.2011 01:50, schrieb Mahesh Narayanamurthi: Hello, I am thinking of implementing a BLAS package in pure python. I am wondering if this is a good idea. Sure, why not? Even if nobody us

Re: [Tutor] BLAS Implementation on Python

2011-03-07 Thread Knacktus
Am 07.03.2011 01:50, schrieb Mahesh Narayanamurthi: Hello, I am thinking of implementing a BLAS package in pure python. I am wondering if this is a good idea. I don't think so. Usually people write extensions to the CPython implementation (when talking about performance, we need to talk about

Re: [Tutor] Help!

2011-03-03 Thread Knacktus
Am 03.03.2011 22:28, schrieb Andrew Bouchot: okay so this is my comp sci lab * Problem: *ProductionTime.py It takes exactly 2 minutes and 7 second to produce an item. Unfortunately, after 143 items are produced, the fabricator must cool off for 5 minutes and 13 seconds before it can continue. W

Re: [Tutor] A class that instantiates conditionally ?

2011-03-02 Thread Knacktus
Am 01.03.2011 07:49, schrieb David: I have an idea that might clean up my code slightly, if I can make one of my classes clever enough to refuse to instantiate itself if a necessary condition is not met. I think that's too clever ;-). Instead, you could create a function which has the only and

Re: [Tutor] couchdb.mapping 'Document' class

2011-03-01 Thread Knacktus
Am 01.03.2011 16:19, schrieb Emanuel Lauria: Hi everyone, I'm trying to map a couchdb document to a python object using couchdb.mapping. I'm stuck in the very first part were it says I should declare a Python class that inherits from the 'Document'.. Where does this 'Document' superclass comes f

Re: [Tutor] Object, methods, class

2011-02-26 Thread Knacktus
Once again a very insightfull answer. Much appreciated! Same to you, Alan. I paricularly like the "even longer answer". It remindes us of how lucky we are using Python and brings me light in dark times when I wish I had better code completion in my IDE for my own spaghetti-code ;-)) ___

Re: [Tutor] Object, methods, class

2011-02-26 Thread Knacktus
Am 26.02.2011 18:49, schrieb Christopher Brookes: Hi, Is there in Python private/protected attributes in class like in other langage ? Yes, there is. But it's protected by convention not compiler ;-). Check out this: http://docs.python.org/tutorial/classes.html#private-variables -- Brookes Chr

Re: [Tutor] Unintentionally manipulating a list

2011-02-25 Thread Knacktus
Am 25.02.2011 15:49, schrieb ranjan das: I am facing the following problem I have a list of the form INPUT= [ [ ['A1-N','A2-Y','A3-N' ],['B1-Y','B2-N','B3-N' ] ], [.] ] and I want an output of the form (selecting only those elements which have a Y associated with them) OUTPUT=[ ['A

Re: [Tutor] dict['_find']

2011-02-20 Thread Knacktus
Am 20.02.2011 05:14, schrieb Max Niederhofer: Hello all, Hello Max, first post, please be gentle. I'm having serious trouble finding an alternative for the deprecated find module for dictionaries. The code (from Zed Shaw's Hard Way, exercise 40) goes something like this. Hope indentation sur

Re: [Tutor] about import statement

2011-01-11 Thread Knacktus
Am 11.01.2011 13:02, schrieb arun kumar: I'm trying to program with google api i downloaded the libraries provided by the google. http://code.google.com/apis/gdata/docs/client-libraries.html In oder to write program with google api, i need to write some import statements. But i'm unable to under

Re: [Tutor] syntax error that i cant spot!

2011-01-01 Thread Knacktus
Am 01.01.2011 18:02, schrieb pete: Hi, Please help just starting out and have come up with the following code to create a simple guessing game. on line 30 print good job etc i get a syntax error! sure it's simple but i've looked for ages and cant spot it! There's a + missing after myName Also,

Re: [Tutor] scraping and saving in file

2010-12-29 Thread Knacktus
Am 29.12.2010 10:54, schrieb Tommy Kaas: Hi, I’m trying to learn basic web scraping and starting from scratch. I’m using Activepython 2.6.6 I have uploaded a simple table on my web page and try to scrape it and will save the result in a text file. I will separate the columns in the file with #.

Re: [Tutor] Choice of Python

2010-12-28 Thread Knacktus
Am 28.12.2010 14:41, schrieb Stefan Behnel: Abdulhakim Haliru, 28.12.2010 13:38: I come from a Cakephp, zend framework angle cutting through ASP.net,VB and C# at an intermediate level. [...] Is python really worth the pain or should I just skip it ? Given that you already invested your time in

Re: [Tutor] vim as a python editor

2010-12-15 Thread Knacktus
Am 15.12.2010 23:26, schrieb Paul Griffiths: Hi - I'm a beginner at programming and Python. I have been looking for an editor to replace Idle and tried out a few. I liked Geany but decided on vim because I am also learning Linux and the vim skills might be useful. I run Python 2.6.5 on Ubuntu 1

Re: [Tutor] vim as a python editor

2010-12-15 Thread Knacktus
Am 15.12.2010 23:26, schrieb Paul Griffiths: Hi - I'm a beginner at programming and Python. I have been looking for an editor to replace Idle and tried out a few. I liked Geany but decided on vim because I am also learning Linux and the vim skills might be useful. I run Python 2.6.5 on Ubuntu 1

Re: [Tutor] making onthefly attributes persistent

2010-12-14 Thread Knacktus
Am 13.12.2010 23:50, schrieb Jojo Mwebaze: On Mon, Dec 13, 2010 at 8:44 PM, Alan Gauld mailto:alan.ga...@btinternet.com>> wrote: "Jojo Mwebaze" mailto:jojo.mweb...@gmail.com>> wrote Assuming i have a class bank as below . class bank(object): def __init__(self,

Re: [Tutor] Any recommend of UML tool and UI design tool for python?

2010-12-12 Thread Knacktus
Am 12.12.2010 19:16, schrieb Alan Gauld: "cajsdy" wrote Either paid or free open source is fine. I'm creating automation frame work. Idealy it includes: test plan management, test manager across windows, unix, linux, solaris and other os. UML documentation for python scripts IDE tool for pyth

Re: [Tutor] Ressources for licensing

2010-12-12 Thread Knacktus
Am 12.12.2010 03:42, schrieb David Hutto: On Sat, Dec 11, 2010 at 9:52 AM, Knacktus wrote: Hi everyone, can anybody recommend a lib or some other ressources about license mechanisms of desktop applications written in python. I'm thinking of a license-key that can be used to limit the tim

[Tutor] Ressources for licensing

2010-12-11 Thread Knacktus
Hi everyone, can anybody recommend a lib or some other ressources about license mechanisms of desktop applications written in python. I'm thinking of a license-key that can be used to limit the time the application can be used. I also need to exploit the usage of a license server. Cheers, J

Re: [Tutor] Which non SQL Database ?

2010-12-05 Thread Knacktus
Am 05.12.2010 10:41, schrieb Alan Gauld: "Jorge Biquez" wrote Talking with a friend about what he will do (he use C only) he suggest to take a look on dBase format file since it is a stable True enough and Dabo is worth a look since it provides not only a dbase format db engine but a good G

Re: [Tutor] Which non SQL Database ?

2010-12-05 Thread Knacktus
Am 04.12.2010 23:42, schrieb Jorge Biquez: Hello all. Newbie question. Sorry. As part of my process to learn python I am working on two personal applications. Both will do it fine with a simple structure of data stored in files. I now there are lot of databases around I can use but I would like

Re: [Tutor] data structures

2010-12-01 Thread Knacktus
Am 02.12.2010 02:51, schrieb Dana: Hello, I'm using Python to extract words from plain text files. I have a list of words. Now I would like to convert that list to a dictionary of features where the key is the word and the value the number of occurrences in a group of files based on the filename

Re: [Tutor] JOB AD PROJECT

2010-11-21 Thread Knacktus
Am 21.11.2010 04:34, schrieb delegb...@dudupay.com: Hi People, I am afraid only Alan has said something to me. Is it that solution would never come or u guys are waiting to gimme the best? I agree with what Alan wrote. Your project sounds like real challenge even for experienced developers. Ev

Re: [Tutor] Paper Book

2010-11-18 Thread Knacktus
Am 18.11.2010 15:31, schrieb Srinidhi Rao: Hi, Thanks for the reply guys, I would prefer a Paper Book as I don't have a kindle(amazon) and also the PDF is not so suitable out here.. (the power cuts hamper continuity :( ) @Alan, Nice website for a beginner. I glanced through your webpage and tha

Re: [Tutor] Advantages or disadvantages on Platform?

2010-11-04 Thread Knacktus
Am 04.11.2010 20:43, schrieb Jorge Biquez: Hello all. I am newbie and studying and working hard learning python. Per your advise I am on 2.7 . I have one question for you. I can work on Windows (XP) or under Ubuntu . The advantage of using Ubuntu is that you learn how to work in a Linux/Unix

Re: [Tutor] mutable types

2010-11-02 Thread Knacktus
Am 02.11.2010 13:51, schrieb John: Hello, I thought the following should end with G[1] and G[0] returning 20. Why doesn't it? In [69]: a = 10 "a" is a reference to an immutable object of type int with value 10. Somewhere in memory is an object of type int with value 10 stored. This object cann

Re: [Tutor] pickle problem

2010-10-12 Thread Knacktus
Am 12.10.2010 19:35, schrieb Roelof Wobben: Hello, I have this code : import urllib import pickle image = urllib.URLopener() image.retrieve("http://www.pythonchallenge.com/pc/def/peak.html","banner.p"; ) plaatje = open("banner.p", "rb") plaatje2 = pickle.load(plaatje) But it gives this outp

Re: [Tutor] Hiding Superclass Methods

2010-10-10 Thread Knacktus
Am 11.10.2010 06:24, schrieb Denis Gomes: Hi Everyone, I have a basic python question. I am writing an n dimensional vector class by inheriting from the builtin python list object. I want to be able to hide the parent object's methods in the derived class instances. Why inheriting then? A

Re: [Tutor] IDE for Python

2010-10-07 Thread Knacktus
Am 07.10.2010 17:23, schrieb Juan Jose Del Toro: Dear List; In your experience what is the best IDE for Python? I'm using Wing IDE. Very good overall package. I like especially the debug probe, which is like an interactive shell in the current stack. To me it's a good balance between features

Re: [Tutor] how to extract data only after a certain condition is met

2010-10-06 Thread Knacktus
Am 06.10.2010 18:25, schrieb Eduardo Vieira: The other day I was writing a script to extract data from a file from the line where a text is found to the end of the file. The same functionality is this sed script: '1,/regexp/'d I couldn't put my head to work around this and came up with a solution

Re: [Tutor] filling 2d array with zeros

2010-09-27 Thread Knacktus
Am 27.09.2010 20:29, schrieb Steven D'Aprano: On Tue, 28 Sep 2010 03:54:55 am Alex Hall wrote: Hi again everyone, I have a 2d array (I guess it is technically a list) which I want to fill with zeros. Later I will change some values, but any I do not change have to be zeros. I have two complex fo

Re: [Tutor] Python And reading the Web - Javascript

2010-09-25 Thread Knacktus
Any ideas in general in how to do this appreciated. i don't mind reading so if you have some good links they are appreciated. I have no experience myself with this task, but I would look at those resource: 1) For reading html pages in addition to the standard-lib modules: http://www.crummy

[Tutor] Best practice for API design handeling collections and single objects

2010-09-22 Thread Knacktus
Hi all, I've got a question for you about how to best design an API that has to handle requests for single objects and collections of those objects. My naming conventions are: Plural nouns for collections, singular nouns for single objects. "Key_to_value"-style for dictionaries. So I normaly

Re: [Tutor] Can this be done easly

2010-09-19 Thread Knacktus
Am 19.09.2010 10:49, schrieb Roelof Wobben: Hello, I have this programm : class Point: def __init__(self, x=0, y=0): self.x = x self.y = y class Rectangle(Point): def _init_(self, width=0, length=0): self.width = width self.length = length Yo

[Tutor] What are "singletons" good for?

2010-09-18 Thread Knacktus
Hey all, the usual explanation for the usage of a Singleton goes like this: "Use a singleton if you want to make sure, that only one instance of a class exists." But now I ask myself: Why should I call the constructor of a class more than once if I only want one instance? After all, I decide

Re: [Tutor] selecting elements from dictionary

2010-09-14 Thread Knacktus
xdic {11135457: [1], 11135492: [1], 11135913: [1], 11135436: [1, 2], 11135699: [1, 2], 11135702: [1, 3], 11135901: [1]} I want to print only those items that have [1,2] and [1,3] in any order, such as [1,2] or [2,1], [3,1] or [1,3] >>> for item in xdic.keys(): ... if [1,2] in xdic[item]: ...

Re: [Tutor] changing list index start

2010-09-11 Thread Knacktus
Am 11.09.2010 15:46, schrieb Joel Goldstick: On Sat, Sep 11, 2010 at 9:25 AM, Rance Hall mailto:ran...@gmail.com>> wrote: On Fri, Sep 10, 2010 at 6:14 PM, Lie Ryan mailto:lie.1...@gmail.com>> wrote: > On 09/11/10 07:36, Rance Hall wrote: > In most cases in Python, you woul

Re: [Tutor] What Design Pattern for Document class (NOT URGENT)

2010-09-11 Thread Knacktus
Hi Karim, it's difficult to comment as to me the problem is not quite clear. But I try ;-) You have a complex xml and need to read different data types. For each type you have certain rules, how to extract them from the xml (docrules). You could create a DocRule class, that do nothing but hol

Re: [Tutor] design question

2010-09-11 Thread Knacktus
Am 10.09.2010 16:11, schrieb Albert-Jan Roskam: Hi Jan, Here's a screendump of my program: http://nl.tinypic.com/r/2qtlojc/7 . This might make my description a little bit clearer. The beautiful sunset will in reality be a dull, handwritten form. ;-) Regarding the iterator pattern, I was referri

Re: [Tutor] design question

2010-09-10 Thread Knacktus
Am 10.09.2010 11:23, schrieb Albert-Jan Roskam: Hi, I've made a small data entry program where a picture of a hand-written, scanned form is shown next to several text entries. The design has been largely 'bottom up', although of course I started with a rough sketch. I started with the following

Re: [Tutor] Conditional attribute access / key access

2010-08-31 Thread Knacktus
The sizes given are in bytes. So 200,000 instances of this class, plus the list to hold them, would take approximately 34 megabytes. An entry level PC these days has 1000 megabytes of memory. "Huge"? Not even close. The items hold a lot of metadata, which I didn't provide in my example. Depen

Re: [Tutor] Help with Object Oriented Programming

2010-08-30 Thread Knacktus
You could google for 1) Alex Martelli, Design Patterns He's a Pyton guru and there're some online talks (at Google and some conferences) about DP; a bit difficult to understand, well, he's guru ;-) 2) http://www.suttoncourtenay.org.uk/duncan/accu/pythonpatterns.html I like that one. Also, the

Re: [Tutor] Help with Object Oriented Programming

2010-08-30 Thread Knacktus
Am 30.08.2010 20:13, schrieb Tino Dai: Hi Everybody, I'm beefing up my Object-Oriented Analysis and Design - getting the gaps in my knowledge filled in through the Head First OOAD book (http://headfirstlabs.com/books/hfooad/). That book focuses on Java - is there a comparable book for

Re: [Tutor] Conditional attribute access / key access

2010-08-30 Thread Knacktus
Am 30.08.2010 17:53, schrieb Francesco Loffredo: Two questions and one doubt for you: 1- How many "generations" do you want to keep in a single item (call it dictionary or list, or record, whatever)? I mean, what if some children have children too, and some of those have more children, etc ? The

[Tutor] Conditional attribute access / key access

2010-08-30 Thread Knacktus
Hey everyone, I have a huge number of data items coming from a database. So far there're no restrictions about how to model the items. They can be dicts, objects of a custom class (preferable with __slots__) or namedTuple. Those items have references to each other using ids. Fresh from the d

Re: [Tutor] type() problem

2010-08-22 Thread Knacktus
fruit="ramadana" print "fruit heeft als type", type(fruit) y=len(fruit) print y z=fruit[:3] print z These lines put in a module and executed print (using Python 2.7): fruit heeft als type 8 ram Strange that it doesn't work for you. I can only advice you to check the file again or run the

[Tutor] Done -- Elementtree and pretty printing in Python 2.7

2010-08-20 Thread Knacktus
Hi guys, just found "hidden" in the "Schema change in Etree"-Thread the answer to my formatting question: Quotation: " ElementTree doesn't have a way of formatting (pretty printing) XML files, so there can't be that many newline characters in the structure (they may be in the occur, though!)

[Tutor] Elementtree and pretty printing in Python 2.7

2010-08-20 Thread Knacktus
Hi guys, I'm using Python 2.7 and the ElementTree standard-lib to write some xml. My output xml has no line breaks! So, it looks like that: instead of something like this: I'm aware of lxml which seems to have a pretty print option, but I would prefer to use the standard-lib Element

Re: [Tutor] Error Using exec to Run Module Files

2010-08-17 Thread Knacktus
Am 18.08.2010 06:54, schrieb mes...@juno.com: I'm a rank beginner in Python. Took advantage of the O'Reilly one-day sale of 'Learning Python' announced on the tutor, and starting to work my way through it. When I tried out an example from pg57, on Using exec to Run Module Files, I get the fo

[Tutor] Multiple inheritance for mixin attributes

2010-08-16 Thread Knacktus
Hello everyone, I've got a question about class design. I want to model classes like these (examples): # class BaseItem(object): def __init__(self, ident, name, description): self.ident = ident self.name =

[Tutor] Performance list vs. deque for [-1]

2010-08-11 Thread Knacktus
Hi everyone, I'm wondering what's the fastet datatype in python to lookup the last element in an ordered collection. I know about lists, of course, and read about deques. As I understand deques have better performance for popping and adding elements, but I didn't understand what's the behavior

Re: [Tutor] how to get str() to use my function?

2010-08-04 Thread Knacktus
Am 04.08.2010 17:37, schrieb Alex Hall: It worked, thanks. Is there a list of these functions somewhere? That is, the functions that map implicitly to operators or implied uses? For example, printing will call __str__, as will a cal to str(). What about math or comparison operators? I have heard

Re: [Tutor] Python and Abaqus

2010-07-30 Thread Knacktus
Am 30.07.2010 13:44, schrieb leo.ruggier...@libero.it: Dear All, I am trying to have access to the Abaqus kernel by a Python script. My intention is to avoid to use the Abaqus GUI (or command line) to run a simulation. The idea is to lunch the Python script by DOS or Python module. The problem

Re: [Tutor] Question

2010-06-19 Thread Knacktus
~So is it better to learn 1 programming language first, then learn another. Or better to pretty much learn them at the same time? And why? First, I think python is a bit underrated for creating "real" applications. I'm amazed again and again by it's power on all programming scales (e.g. quic

Re: [Tutor] How to model objects aimed to persistence?

2010-06-16 Thread Knacktus
Am 17.06.2010 02:17, schrieb Alan Gauld: "Steven D'Aprano" wrote Deliberate misspellings in class and variable names will cost you *far* more in debugging time when you forget to misspell the words than they will save you in typing. Trust me on this. Thanks for that hint. I can imagine the ni

[Tutor] How to model objects aimed to persistence?

2010-06-16 Thread Knacktus
Hi everyone, within a python application I can easily model object association with simple references, e.g.: # class FavoritMovies(object): def __init__(self, movies): self.movies = movies class Movie(object): def

[Tutor] What's the catch with ZopeDB?

2010-06-11 Thread Knacktus
Hey everyone, I'm planning to create small application which manages product data e.g. parts of cars. There are quite some relations, e.g. - a car consists of certain assemblies, - an assembly consists of certatin parts, - a part has serveral documents which describe the part, e.g. a CAD docum

Re: [Tutor] Unit testing command-line options from argparse or optparse

2010-05-18 Thread Knacktus
Am 18.05.2010 22:49, schrieb Serdar Tumgoren: Hello all, Does anyone have advice for writing unit tests against variables set by command-line options? I have a program I'd like to run in either "debug" or "live" mode, with various settings associated with each. Below is some pseudo-code tha

Re: [Tutor] pickle.load() all dict

2010-05-16 Thread Knacktus
Am 16.05.2010 14:45, schrieb Yutao Deng: LOL, try...except is a good idea. i fix it lick this: with open("data2.pickle","rb") as file_stream: c = 0 while True: try: i = cPickle.load(file_stream) print i c += 1 except:

Re: [Tutor] pickle.load() all dict

2010-05-16 Thread Knacktus
Am 16.05.2010 09:10, schrieb Yutao Deng: Hi all: I'm trying to learn to use Python wrote a applet to record every day doing. and i use the pickle pickle.dump something to file no problem i think. but pickle.load whith a problem. can not load all dict do my way that what i pickle.dump(). My