1
vote
3answers
26 views

Importing functions from classes outside original file

I'm working on a text based adventure game. One of the things that I want to do, is build the game using classes, have the main data classes in a separate file, and then have the actual main loop that ...
1
vote
1answer
18 views

python objectlist adds to all objects

I'm trying to have a class (dprObject) that is a container for several dprVariables each variable has a list with integers (for now) but when I change something to one variable, it changes to all the ...
0
votes
0answers
20 views

Python Create Series Of Text Menus- Classes/Objects or Decorator Functions?

I am creating a series of text menus in Python. I've been told in Python conventions that I should only make classes/objects for data members that need to be maintained and manipulated. Going be this ...
0
votes
1answer
61 views

method returns a string…but why?

I am just coming to grips with Python so am trying to grasp 'rules of thumb' so I can understand how the bits and pieces work together. So for this code: string = "Hello World" string.replace ...
6
votes
4answers
18k views

Add an object to an array python

I am trying to add an object to an array list but since I'm adding the actual object when I try to reset the array thereafter, all the values in the array are reset. Is there an actual way how I can ...
8
votes
3answers
4k views

Python: how to format traceback objects

I have a traceback object that I want to show in the nice format I get when calling traceback.format_exc() Is there a builtin function for that, or a few lines of code?
-1
votes
0answers
47 views

In Python, what are classes, objects and methods? [closed]

Can I just have a simple beginner's (I'm not, but everything I've read describes it in very technical terms) definition of a class, an object and a method. I think a class is a group of functions ...
0
votes
0answers
22 views

Is it possible to have an ndb property that contains the key of a python object?

Sorry if this question allready have been answered. I coudn't find it, so please let me know if this thread already exists. I need to have a ndb property that allows to store python keys. I tried to ...
1
vote
2answers
45 views

Python: how to save a list with objects in a file?

im trying to create diferent objects (using Clases and objects) and saving them in a file to edit or retrive them later. However this how it looks. GlobalCategories=[] GlobalContent=[] def ...
0
votes
0answers
20 views

Converting Parser element to Class Object

I Have tried out the following code for Converting parser element to a class object But it did n't work properly ..... Hope some one can help me to solve it ... import xml.etree.ElementTree as ET ...
0
votes
1answer
21 views

Adding new member variables to python objects?

I have started reading the "Beginning python from novice to professional" by Magnus Lie Hetland, and what struck me today is an ability of an objects to create new member variables, even though those ...
30
votes
7answers
18k views

Compare object instances for equality by their attributes in Python

What is the best way to compare two instances of some object for equality in Python? I'd like to be able to do something like Example: doc1 = ErrorDocument(path='/folder',title='Page') doc2 = ...
80
votes
7answers
78k views

Call a parent class's method from child class in Python?

When creating a simple object hierarchy in Python, I'd like to be able to invoke methods of the parent class from a derived class. In Perl and Java, there is a keyword for this (super). In Perl, I ...
4
votes
3answers
76 views

How to make two objects have the same id in python?

If I have a class like below: class Point(object): def __init__(self, x, y): self.x = x self.y = y And have 2 objects: a = Point(1,2) b = Point(1,2) How can I modify class ...
0
votes
0answers
12 views

Python: VMware Object data

How does one get all the property values from an object. For example a method returned me an object, but when I print it out there's only type and value displayed. For example I've got an ...

1 2 3 4 5 36
15 30 50 per page