Nested For loop not running full

2013-04-26 Thread inshu chauhan
Hello everyone, I have this part of my code where I am trying to traverse over an image by running a for loop for both x and y co-ordinate axis. But the loop is terminating by just reading first pixel. Can think of a reason why this is happening ? The code is: for sy in xrange(0,

Re: Nested For loop not running full

2013-04-26 Thread inshu chauhan
On Fri, Apr 26, 2013 at 2:39 PM, Peter Otten __pete...@web.de wrote: inshu chauhan wrote: I have this part of my code where I am trying to traverse over an image by running a for loop for both x and y co-ordinate axis. But the loop is terminating by just reading first pixel. Can think

Re: Nested For loop not running full

2013-04-26 Thread inshu chauhan
, 2013 at 3:15 PM, Chris Angelico ros...@gmail.com wrote: On Fri, Apr 26, 2013 at 7:36 PM, inshu chauhan insidesh...@gmail.com wrote: On Fri, Apr 26, 2013 at 2:39 PM, Peter Otten __pete...@web.de wrote: f = open(...) in the code you are not showing with f == list(open

Running simultaneuos FOR loops

2013-04-23 Thread inshu chauhan
i have to implement the below line in one of my code: for p in sorted(segments.iterkeys()) and for k in sorted(class_count.iterkeys()) and for j in sorted(pixel_count.iterkeys()): Its giving me a syntax error which is obvious, but how can I make all three for loop run simultaneously or any

Re: Running simultaneuos FOR loops

2013-04-23 Thread inshu chauhan
, inshu chauhan insidesh...@gmail.com wrote: i have to implement the below line in one of my code: for p in sorted(segments.iterkeys()) and for k in sorted(class_count.iterkeys()) and for j in sorted(pixel_count.iterkeys()): Its giving me a syntax error which is obvious, but how can I

Re: Running simultaneuos FOR loops

2013-04-23 Thread inshu chauhan
zip isn't doing the required On Tue, Apr 23, 2013 at 12:28 PM, inshu chauhan insidesh...@gmail.comwrote: Yes Simultaneously means all three running at the same time, I looked up zip just now, but will it not disturb my dictionaries ? And yes the dictionaries have same number of keys

Re: Running simultaneuos FOR loops

2013-04-23 Thread inshu chauhan
Thanks Gary. Be clearer about the problem please. Do you wish to produce a loop that: On pass 1, each of p,k, and t hold the first item of their respective lists, and on pass 2, each of p,k, and t hold the second item of their respective lists, and so on until one (or all) lists

Re: Running simultaneuos FOR loops

2013-04-23 Thread inshu chauhan
, inshu chauhan insidesh...@gmail.comwrote: zip isn't doing the required On Tue, Apr 23, 2013 at 12:28 PM, inshu chauhan insidesh...@gmail.comwrote: Yes Simultaneously means all three running at the same time, I looked up zip just now, but will it not disturb my dictionaries ? And yes

Working with lists within Dictionaries

2013-04-18 Thread inshu chauhan
Hello Everyone, I am trying to work with lists and dictionaries together. In the following code I have to access pixels in a segmented image through a dictionary. But the problem is when I am trying to update the list through dict it is giving me this error of tuple, ofcourse because list indices

Can I iterate over a dictionary outside a function ?

2013-04-11 Thread inshu chauhan
I have a prog in which a functions returns a dict but when I try to iterate over the dict using iterkeys, It shows an error. I think its because only address of the dictionary is returned so cannot be iterated upon. Please suggest some way by which it can be made possible to iterate over the

Trying to understand working with dicts

2013-04-05 Thread inshu chauhan
Hello everyone, Here in my part of the code where cc is a dictionary. I want to understand what actually cc.iterkeys() and cc[k] actually doing. I am already reading http://docs.python.org/2/library/stdtypes.html#dict.items and http://www.tutorialspoint.com/python/python_dictionary.htm but still

Error in working with Dict

2013-04-01 Thread inshu chauhan
I have this program which is working with 2 dictionaries segments, class_counts.. but I am getting an error mentioned below the programme. import cv from itertools import * from math import floor, sqrt, ceil from numpy import array, dot, subtract, add, outer, argmax, linalg as lin def

working with dict : incrementing dict dynamically

2013-03-11 Thread inshu chauhan
I am trying to create a dictionary with a key and its values seraching from a data set. But something is going wrong. This is the first time I am working with dicts. My code is : import cv def Computesegclass(segimage): num_pixel = 0 for y in xrange(0, segimage.height): for x

working with csv module in python

2013-02-20 Thread inshu chauhan
I have 10 simple text files with 3 columns x,y,z delimited by space. I am trying to combine these 10 files to get a single text file. Eg. of data in 10 files is 299 446 2 I had written this prog for merging files: import csv import glob with open(rC:\Users\inshu.chauhan\Desktop\test2.arff,

Re: working with csv module in python

2013-02-20 Thread inshu chauhan
On Wed, Feb 20, 2013 at 11:26 AM, Roland Koebler r.koeb...@yahoo.de wrote: Hi, On Wed, Feb 20, 2013 at 10:50:54AM +0100, inshu chauhan wrote: I have 10 simple text files with 3 columns x,y,z delimited by space. I am trying to combine these 10 files to get a single text file. Eg

Re: working with csv module in python

2013-02-20 Thread inshu chauhan
On Wed, Feb 20, 2013 at 11:38 AM, inshu chauhan insidesh...@gmail.comwrote: On Wed, Feb 20, 2013 at 11:26 AM, Roland Koebler r.koeb...@yahoo.dewrote: Hi, On Wed, Feb 20, 2013 at 10:50:54AM +0100, inshu chauhan wrote: I have 10 simple text files with 3 columns x,y,z delimited by space

Re: working with csv module in python

2013-02-20 Thread inshu chauhan
On Wed, Feb 20, 2013 at 12:04 PM, Dave Angel da...@davea.name wrote: On 02/20/2013 05:38 AM, inshu chauhan wrote: On Wed, Feb 20, 2013 at 11:26 AM, Roland Koebler r.koeb...@yahoo.de wrote: snip If you only want to concat the files, I would use some shell-tools, like cat on Linux

IOerror : need urgent help

2013-02-19 Thread inshu chauhan
Here is my attempt to merge 10 files stored in a folder into a single file : import csv with open(C:\Users\inshu.chauhan\Desktop\test.arff, w) as w: writer = csv.writer(w) for f in glob.glob(C:\Users\inshu.chauhan\Desktop\For Model_600\*.arff): rows = open(f, r).readlines()

Re: IOerror : need urgent help

2013-02-19 Thread inshu chauhan
On Tue, Feb 19, 2013 at 4:54 PM, MRAB pyt...@mrabarnett.plus.com wrote: On 2013-02-19 15:27, inshu chauhan wrote: Here is my attempt to merge 10 files stored in a folder into a single file : import csv with open(C:\Users\inshu.chauhan\**Desktop\test.arff, w) as w: writer

Error in reading and writing CSV format file in python

2013-02-11 Thread inshu chauhan
In the programme below I am trying to read two csv format files and process them and write a new file with some of theirs data. import csv f1_reader = csv.reader(open(rZ:\Weka work\Feature_Vectors_Fullset_00.arff)) f2_reader = csv.reader(open(rZ:\Weka

Re: Error in reading and writing CSV format file in python

2013-02-11 Thread inshu chauhan
On Mon, Feb 11, 2013 at 1:26 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: inshu chauhan wrote: In the programme below I am trying to read two csv format files and process them and write a new file with some of theirs data. import csv f1_reader = csv.reader(open(rZ

Re: Error in reading and writing CSV format file in python

2013-02-11 Thread inshu chauhan
On Mon, Feb 11, 2013 at 2:02 PM, MRAB pyt...@mrabarnett.plus.com wrote: On 2013-02-11 12:44, inshu chauhan wrote: On Mon, Feb 11, 2013 at 1:26 PM, Steven D'Aprano steve+comp.lang.python@**pearwood.infosteve%2bcomp.lang.pyt...@pearwood.info mailto:steve+comp.lang.**pyt...@pearwood.infosteve

Re: Error in reading and writing CSV format file in python

2013-02-11 Thread inshu chauhan
On Mon, Feb 11, 2013 at 3:22 PM, Dave Angel da...@davea.name wrote: On 02/11/2013 06:00 AM, inshu chauhan wrote: In the programme below I am trying to read two csv format files and process them and write a new file with some of theirs data. import csv f1_reader = csv.reader(open(rZ:\Weka

Run time Error

2013-02-05 Thread inshu chauhan
Hello all, I am trying to run a small code of mine but I am getting a run time error. What is actually meant by run time error ? it is saying to contact programme administrator something. Why one would get this error ? and how to remove it ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Run time Error

2013-02-05 Thread inshu chauhan
On Tue, Feb 5, 2013 at 3:10 PM, Roy Smith r...@panix.com wrote: In article mailman.1366.1360073151.2939.python-l...@python.org, inshu chauhan insidesh...@gmail.com wrote: Hello all, I am trying to run a small code of mine but I am getting a run time error. What is actually meant

Re: Reading data from 2 different files and writing to a single file

2013-01-30 Thread inshu chauhan
On Mon, Jan 28, 2013 at 6:05 PM, Dennis Lee Bieber wlfr...@ix.netcom.comwrote: On Mon, 28 Jan 2013 14:31:31 +0100, inshu chauhan insidesh...@gmail.com declaimed the following in gmane.comp.python.general: In the code below I am trying to read 2 files f1 and f2 , extract some data from

Re: Reading data from 2 different files and writing to a single file

2013-01-30 Thread inshu chauhan
On Wed, Jan 30, 2013 at 2:23 PM, Dave Angel d...@davea.name wrote: On 01/30/2013 05:43 AM, inshu chauhan wrote: On Mon, Jan 28, 2013 at 6:05 PM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Mon, 28 Jan 2013 14:31:31 +0100, inshu chauhan insidesh...@gmail.com declaimed the following

Reading data from 2 different files and writing to a single file

2013-01-28 Thread inshu chauhan
In the code below I am trying to read 2 files f1 and f2 , extract some data from them and then trying to write them into a single file that is 'nf'. import cv f1 = open(rZ:\modules\Feature_Vectors_300.arff) f2 = open(rZ:\modules\Feature_Vectors_300_Pclass.arff) nf = open(rZ:\modules\trial.arff,

Re: Reading data from 2 different files and writing to a single file

2013-01-28 Thread inshu chauhan
Yes Chris, I understand, My Original code was for l in f1: sp = l.split(,) if len(sp)!= 12: continue else: ix = sp[0].strip() iy = sp[1].strip() for s in f2: st = s.split(,) if len(st)!= 11: continue else:

Re: Reading data from 2 different files and writing to a single file

2013-01-28 Thread inshu chauhan
In that case, Dave's suggestion to read into a list and iterate over the list is to be strongly considered. But I'm not entirely sure what your goal is here. Are you trying to make the Cartesian product of the two files, where you have one line in the output for each possible pair of matching

Re: Reading data from 2 different files and writing to a single file

2013-01-28 Thread inshu chauhan
Your current logic tries to scan through the first file, and for each line that has 12 elements, scans through the entire second file. It fails to actually do it, because you never do a seek on the second file. Now it appears your requirement is entirely different. I believe you have two

Re: Reading data from 2 different files and writing to a single file

2013-01-28 Thread inshu chauhan
That's zip not Zip Have you tried looking at the docs? Or even typing help(zip) at the python interpreter prompt? In rough terms, zip takes one element (line) from each of the iterators, and creates a new list that holds tuples of those elements. If you use it in this form:

using split for a string : error

2013-01-24 Thread inshu chauhan
Here I have a code which basically reads a csv file, tries to compare the last 2 items in each line of the file. f = open(rZ:\modules\Feature_Vectors_300_Pclass.arff) for l in f: sp = l.split(,) if len(sp) != 11: print of, l, else: #print sp[9], sp[10] if

Re: using split for a string : error

2013-01-24 Thread inshu chauhan
at the end. To remove those unwanted characters you could use the strip() function. So your code could be: if sp[9].strip() == sp[10].strip(): print Same class else: print Different class At least this works for me when I tried it... Am 24.01.2013 11:37, schrieb inshu chauhan: Here I

Re: using split for a string : error

2013-01-24 Thread inshu chauhan
Thanks a lot people.. :).. :) On Thu, Jan 24, 2013 at 1:10 PM, Tobias M. t...@tobix.eu wrote: Am 24.01.2013 13:02, schrieb Chris Angelico: On Thu, Jan 24, 2013 at 10:58 PM, Tobias M. t...@tobix.eu wrote: Chris Angelico wrote: I'd not consider the performance, but the correctness. If

Re: Error .. Please Help

2012-12-13 Thread inshu chauhan
if-else doesn't define a loop, but each of the for statements do. You have defined a classification for 8 of the possible colors, leaving millions of them undefined. If the first time through the loop you manage to hit one of those undefined ones, you'll have no value for classification.

Error .. Please Help

2012-12-12 Thread inshu chauhan
In this code : import cv g = open(PointCloudmitClass.txt, w) image = cv.LoadImageM(Z:/modules/intensity_01.tif, cv.CV_LOAD_IMAGE_UNCHANGED) print image for y in xrange(0,image.height): for x in xrange(0,image.width): color = image[y,x] if color == (0.0,0.0,0.0):

Re: Index Error

2012-11-21 Thread inshu chauhan
Yes i tried or also but no use . Explain no use. If you mean you still fail, then what else did you try? For example, did you try interchanging the two subscripts? I've suspected all along that the meanings of row and column, x and y, [0] and [1], height and width are possibly

Re: Index Error

2012-11-21 Thread inshu chauhan
def GenerateRing(x,y, N): Generates square rings around a point in data which has 300 columns(x) and 3000 rows(y) indices = [] for i in xrange(-N, N): indices.append((x+i, y-N)) indices.append((x+N, y+i)) indices.append((x-i, y+N))

Re: Index Error

2012-11-21 Thread inshu chauhan
I guess I have to use try and except as Chris suggested, this isn't working. -- http://mail.python.org/mailman/listinfo/python-list

Re: Error

2012-11-20 Thread inshu chauhan
thanx ..I understand the problem now.. On Wed, Nov 14, 2012 at 7:48 PM, MRAB pyt...@mrabarnett.plus.com wrote: On 2012-11-14 15:18, inshu chauhan wrote: for this code m getting this error : CODE : def ComputeClasses(data): radius = .5 points = [] for cy in xrange(0

Re: Error

2012-11-20 Thread inshu chauhan
I did the following changes in this part of my programme.. now the refereence error is removed but its showing me another error : def ComputeClasses(data): radius = .5 points = [] for cy in xrange(0, data.height): for cx in xrange(0, data.width): if data[cy,cx] ==

Re: Error

2012-11-20 Thread inshu chauhan
...@davea.name wrote: On 11/20/2012 07:31 AM, inshu chauhan wrote: I did the following changes in this part of my programme.. now the refereence error is removed but its showing me another error : def ComputeClasses(data): radius = .5 points = [] for cy in xrange(0

Index Error

2012-11-20 Thread inshu chauhan
def distance(c, p): dist = sqrt( ((c[0]-p[0])**2) + ((c[1]-p[1])**2) + ((c[2]-p[2])**2) ) return dist def GenerateRing(x,y, N): Generates square rings around a point in data which has 300 columns(x) and 3000 rows(y) indices = [] for

Re: Index Error

2012-11-20 Thread inshu chauhan
I am using python 2.7.3 , so can it be done in that ? On Tue, Nov 20, 2012 at 2:48 PM, Chris Angelico ros...@gmail.com wrote: On Wed, Nov 21, 2012 at 12:43 AM, inshu chauhan insidesh...@gmail.com wrote: I need help in this part as I am unable to device a method in which if the points

Re: Index Error

2012-11-20 Thread inshu chauhan
On Tue, Nov 20, 2012 at 3:00 PM, Chris Angelico ros...@gmail.com wrote: On Wed, Nov 21, 2012 at 12:57 AM, inshu chauhan insidesh...@gmail.com wrote: I am using python 2.7.3 , so can it be done in that ? (Please don't top-post; just delete the couple of blank lines that gmail oh so kindly

Re: Index Error

2012-11-20 Thread inshu chauhan
def GenerateRing(x,y, N): Generates square rings around a point in data which has 300 columns(x) and 3000 rows(y) indices = [] for i in xrange(-N, N): indices.append((x+i, y-N)) indices.append((x+N, y+i)) indices.append((x-i, y+N))

Re: Index Error

2012-11-20 Thread inshu chauhan
So did you read the following paragraphs? You should not be using and in that expression. Yes i tried or also but no use . You do not want and in that expression. The way you've coded it, it'll only skip items in which both indices are out of range. Change it to

Re: Index Error

2012-11-20 Thread inshu chauhan
The catch to the approach suggested by Chris is that you DON'T want to break out of the whole loop when one value is out of range. You only want to skip that one point. Yes I want to skip only that one point (centre) but try and expect seems to be the last option.. I would like to try other

Re: Index Error

2012-11-20 Thread inshu chauhan
I dont want error actually to come. With try nd except , the error will come but without affecting my prog... -- http://mail.python.org/mailman/listinfo/python-list

Error

2012-11-14 Thread inshu chauhan
for this code m getting this error : CODE : def ComputeClasses(data): radius = .5 points = [] for cy in xrange(0, data.height): for cx in xrange(0, data.width): if data[cy,cx] != (0.0,0.0,0.0): centre = data[cy, cx]

Fwd: error

2012-11-12 Thread inshu chauhan
No answers for my question ?? :O -- http://mail.python.org/mailman/listinfo/python-list

Re: error

2012-11-09 Thread inshu chauhan
http://www.ymlgroup.com/obscurehiddenlocation/downloads site, and imported it using from notzanzibar import DataType. No i haven't downloaded it.. and this site is not opening... Then you'd have instantiated it in some code like data = DataType(filename) and then the type of data

Re: error

2012-11-09 Thread inshu chauhan
I attached a wrong file...Right file is attached here On Fri, Nov 9, 2012 at 11:53 AM, inshu chauhan insidesh...@gmail.comwrote: http://www.ymlgroup.com/obscurehiddenlocation/downloads site, and imported it using from notzanzibar import DataType. No i haven't downloaded

Re: error

2012-11-09 Thread inshu chauhan
Please Ignore the above two files attached,,, See this one On Fri, Nov 9, 2012 at 12:47 PM, inshu chauhan insidesh...@gmail.comwrote: I attached a wrong file...Right file is attached here On Fri, Nov 9, 2012 at 11:53 AM, inshu chauhan insidesh...@gmail.comwrote: http

Re: error

2012-11-09 Thread inshu chauhan
Actually this one.. and its the last.. On Fri, Nov 9, 2012 at 2:59 PM, inshu chauhan insidesh...@gmail.com wrote: Please Ignore the above two files attached,,, See this one On Fri, Nov 9, 2012 at 12:47 PM, inshu chauhan insidesh...@gmail.comwrote: I attached a wrong file...Right file

Re: error

2012-11-08 Thread inshu chauhan
Actually data is neither a zanzibar nor a class nor a list.. its a yml image. with pixels I am trying to access pixels of a 3D image through this programme.. On Tue, Nov 6, 2012 at 8:59 PM, woooee woo...@gmail.com wrote: From this line, data appears to be a class if 0 ix data.width

error

2012-11-06 Thread inshu chauhan
I am getting this error while running my programme.. : error: index is out of range I cannot find a valid reason for it in my prog can somebody suggest what may be possible reasons for this error.. The part of the code is : def addpoints (data, points, ix, iy): # makes a list of relevant

Difference between range and xrange ??

2012-11-05 Thread inshu chauhan
what is the difference between range and xrange.. both seem to work the same. ? And which should be used where and in what situations.. ?? -- http://mail.python.org/mailman/listinfo/python-list

python and Open cv

2012-11-01 Thread inshu chauhan
How to load a yml file in python and work with it ?? I used : import cv data = cv.Load(Z:/data/xyz_0_ 300.yml) But when I print data.. it just gives the detail of the image like number of rows and columns etc I want read what is there in the pixel of the image.. I tried to

Fwd: python and Open cv

2012-11-01 Thread inshu chauhan
-- Forwarded message -- From: inshu chauhan insidesh...@gmail.com Date: Thu, Nov 1, 2012 at 1:26 PM Subject: Re: python and Open cv To: Mark Lawrence breamore...@yahoo.co.uk I am sorry.. but I need to know what are the rules and what about gmail ?? Many people are using gmail

pythonic way

2012-11-01 Thread inshu chauhan
what is the most pythonic way to do this : if 0 ix 10 and 0 iy 10 ??? -- http://mail.python.org/mailman/listinfo/python-list

Re: python and Open cv

2012-11-01 Thread inshu chauhan
On Thu, Nov 1, 2012 at 7:02 PM, Paul Rudin paul.nos...@rudin.co.uk wrote: Zero Piraeus sche...@gmail.com writes: There aren't any rules about gmail (except the unwritten rule that to be a real geek you need to use a mail client that takes a whole weekend to configure, and another three

Re: pythonic way

2012-11-01 Thread inshu chauhan
OK ..I got it.. On Thu, Nov 1, 2012 at 5:54 PM, Zero Piraeus sche...@gmail.com wrote: : On 1 November 2012 11:32, inshu chauhan insidesh...@gmail.com wrote: what is the most pythonic way to do this : if 0 ix 10 and 0 iy 10 ??? As everyone else has said, it's

working with yml files in python and opencv

2012-10-31 Thread inshu chauhan
How to load a yml file in python and work with it ?? I used : import cv data = cv.Load(Z:/data/xyz_0_300.yml) But when I print data.. it just gives the detail of the image like number of rows and columns etc I want read what is there in the pixel of the image.. can somebody

Re: can we append a list with another list in Python ?

2012-10-25 Thread inshu chauhan
item which should print: [1,2,3] [4,5,6] On Tue, Oct 23, 2012 at 10:10 PM, inshu chauhan insidesh...@gmail.comwrote: ok I got it guys... On Tue, Oct 23, 2012 at 10:08 PM, Joshua Landau joshua.landau...@gmail.com wrote: On 23 October 2012 21:06, Joshua Landau joshua.landau

Re: can we append a list with another list in Python ?

2012-10-25 Thread inshu chauhan
clist = alist, blist This may work i guess becuase i want list within list [ [1,2,3] , [4,5,6]] or if the clist initial contents were relevant, perhaps you mean clist += alist, blist But not this because it will simply concatenate the list like [1,2,3,4,5,6] .. I dont want this

Re: can we append a list with another list in Python ?

2012-10-25 Thread inshu chauhan
or if the clist initial contents were relevant, perhaps you mean clist += alist, blist But not this because it will simply concatenate the list like [1,2,3,4,5,6] .. I dont want this actaully... No, it won't. Try it to see Ok but it should be clist + = [alist, blist ]

Re: can we append a list with another list in Python ?

2012-10-25 Thread inshu chauhan
Is this what you mean: list_1 = [i for i in range(0,5)] list_2 = [i for i in range(5,11)] for i in list_2: ... list_1.append(i) ... list_1 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] or would another example help you out more? No but really sorry this is what I DONT WANT... The

Re: can we append a list with another list in Python ?

2012-10-25 Thread inshu chauhan
Yes Dave ..You are right and my problem is solved now.. Thanx to all... On Thu, Oct 25, 2012 at 11:55 AM, David Hutto dwightdhu...@gmail.comwrote: On Thu, Oct 25, 2012 at 5:51 AM, inshu chauhan insidesh...@gmail.com wrote: Is this what you mean: list_0 = [] list_1 = [i for i

Re: can we append a list with another list in Python ?

2012-10-25 Thread inshu chauhan
On Thu, Oct 25, 2012 at 12:04 PM, David Hutto dwightdhu...@gmail.comwrote: On Thu, Oct 25, 2012 at 5:58 AM, inshu chauhan insidesh...@gmail.com wrote: Yes Dave ..You are right and my problem is solved now.. Thanx to all... On Thu, Oct 25, 2012 at 11:55 AM, David Hutto dwightdhu

Re: can we append a list with another list in Python ?

2012-10-25 Thread inshu chauhan
On Thu, Oct 25, 2012 at 12:17 PM, David Hutto dwightdhu...@gmail.comwrote: On Thu, Oct 25, 2012 at 6:12 AM, inshu chauhan insidesh...@gmail.com wrote: On Thu, Oct 25, 2012 at 12:04 PM, David Hutto dwightdhu...@gmail.com wrote: On Thu, Oct 25, 2012 at 5:58 AM, inshu chauhan insidesh

classes

2012-10-24 Thread inshu chauhan
I was just trying out a programme for learning classes in python The prog below is showing an error which it should not show : class Bag: def __init__(self, x): self.data = [] def add(self, x): self.data.append(x) def addtwice(self, x): self.add(x)

Re: classes

2012-10-24 Thread inshu chauhan
I was just trying out a programme for learning classes in python The prog below is showing an error which it should not show : class Bag: def __init__(self, x): self.data = [] You do nothing with x here. Right so x shouldnot be in the argument. Fine *class Bag: def

Re: classes

2012-10-24 Thread inshu chauhan
but result is same as the number passed for adding twice On Wed, Oct 24, 2012 at 2:55 PM, Dave Angel d...@davea.name wrote: On 10/24/2012 08:11 AM, inshu chauhan wrote: I was just trying out a programme for learning classes in python The prog below is showing an error which it should

Re: classes

2012-10-24 Thread inshu chauhan
ok.. This was an example i was trying to run from http://docs.python.org/tutorial/classes.html ... On Wed, Oct 24, 2012 at 3:48 PM, Chris Angelico ros...@gmail.com wrote: On Thu, Oct 25, 2012 at 12:02 AM, inshu chauhan insidesh...@gmail.com wrote: I changed the programme

Appending a list using list obtained from a class

2012-10-24 Thread inshu chauhan
I am having a problem, I have a class which return me a list. I want to append another list using this list outside the Class. can i do it ? if yes how ? And can i use Userlist function for this ?? -- http://mail.python.org/mailman/listinfo/python-list

Re: Appending a list using list obtained from a class

2012-10-24 Thread inshu chauhan
: On 2012-10-24, at 7:37 AM, inshu chauhan insidesh...@gmail.com wrote: I am having a problem, I have a class which return me a list. I want to append another list using this list outside the Class. can i do it ? if yes how ? And can i use Userlist function for this ?? -- http

Re: Appending a list using list obtained from a class

2012-10-24 Thread inshu chauhan
the class is returning the list , and i want to append the list outside the class... main problem is this What do you mean the class is returning the list? Do you mean that a class stores a list internally and you want to be able to mutate that list? Do you mean that you have a class method

Fwd: can we append a list with another list in Python ?

2012-10-23 Thread inshu chauhan
-- Forwarded message -- From: Zero Piraeus sche...@gmail.com Date: Tue, Oct 23, 2012 at 11:14 AM Subject: Re: can we append a list with another list in Python ? To: inshu chauhan insidesh...@gmail.com : On 23 October 2012 05:01, inshu chauhan insidesh...@gmail.com wrote

Re: can we append a list with another list in Python ?

2012-10-23 Thread inshu chauhan
Thankyou.. but my problem is different than simply joining 2 lists and it is done now :) On Tue, Oct 23, 2012 at 11:38 AM, Joshua Landau joshua.landau...@gmail.comwrote: On 23/10/2012, inshu chauhan insidesh...@gmail.com wrote: can we append a list with another list in Python ? using

Re: can we append a list with another list in Python ?

2012-10-23 Thread inshu chauhan
ok I got it guys... On Tue, Oct 23, 2012 at 10:08 PM, Joshua Landau joshua.landau...@gmail.comwrote: On 23 October 2012 21:06, Joshua Landau joshua.landau...@gmail.comwrote: On 23 October 2012 21:03, Joshua Landau joshua.landau...@gmail.comwrote: On 23 October 2012 12:07, Jean-Michel

a prob.. error in prog ..dont knw how to correct

2012-10-21 Thread inshu chauhan
I am new to python and have a little problem to solve .. i have an array with x, y, z co-ordinates in it as a tuple. I am trying to find the distance between each point and sorting the points according to the min distance.. i have tried a prog but m stuck bcoz of this error which I am unable to

pls help me with this prog

2012-10-19 Thread inshu chauhan
in this prog I have written a code to calculate teh centre of a given 3D data.. but i want to calculate it for every 3 points not the whole data, but instead of giving me centre for every 3 data the prog is printing the centre 3 times... import cv from math import floor, sqrt, ceil from numpy