Re: pls help me with this prog

2012-10-21 Thread 88888 Dihedral
On Friday, October 19, 2012 4:40:42 PM UTC+8, inshu chauhan wrote: > 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 prin

Re: A desperate lunge for on-topic-ness

2012-10-21 Thread Steven D'Aprano
On Sat, 20 Oct 2012 14:18:47 +, Grant Edwards wrote: > On 2012-10-20, Dennis Lee Bieber wrote: > >> Strangely, we've gone from 80-character fixed width displays to >> who-knows-what (if I drop my font size I can probably get nearly 200 >> characters across in full-screen mode)... >> >>

Re: change the first letter into uppercase (ask)

2012-10-21 Thread Zero Piraeus
: On 20 October 2012 20:22, Dennis Lee Bieber wrote: > Based on the documentation, most of that pattern is fluff: (?#...) > is considered a comment. The comment isn't entirely fluff ... it provides a Google target for whoever's marking OP's assignment, should they choose to look it up:

Re: A desperate lunge for on-topic-ness

2012-10-21 Thread Chris Angelico
On Sun, Oct 21, 2012 at 7:07 PM, Steven D'Aprano wrote: > On Sat, 20 Oct 2012 14:18:47 +, Grant Edwards wrote: >> True, but nobody prints source code out on paper do they? > > I do. > > There's nothing better than spreading out a dozen sheets of source code > over a table to get a good, high-l

Re: A desperate lunge for on-topic-ness

2012-10-21 Thread Steven D'Aprano
On Sun, 21 Oct 2012 20:20:41 +1100, Chris Angelico wrote: > On Sun, Oct 21, 2012 at 7:07 PM, Steven D'Aprano > wrote: >> On Sat, 20 Oct 2012 14:18:47 +, Grant Edwards wrote: >>> True, but nobody prints source code out on paper do they? >> >> I do. >> >> There's nothing better than spreading o

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 cor

Re: printing (was: A desperate lunge for on-topic-ness)

2012-10-21 Thread Tim Chase
On 10/21/12 05:00, Steven D'Aprano wrote: > I seriously do print out source code. When I'm having trouble > seeing how the parts of a module fit together, reading print-outs > is a good way around the problem. I don't print my personal code--both in light of the fact that I know it much more intim

Re: A desperate lunge for on-topic-ness

2012-10-21 Thread Gene Heskett
On Sunday 21 October 2012 07:02:26 Steven D'Aprano did opine: > On Sat, 20 Oct 2012 14:18:47 +, Grant Edwards wrote: > > On 2012-10-20, Dennis Lee Bieber wrote: > >>Strangely, we've gone from 80-character fixed width displays to > >> > >> who-knows-what (if I drop my font size I can prob

Python 3.3 can't sort memoryviews as they're unorderable

2012-10-21 Thread Mark Lawrence
http://docs.python.org/dev/whatsnew/3.3.html states "memoryview comparisons now use the logical structure of the operands and compare all array elements by value". So I'd have thought that you should be able to compare them and hence sort them, but this is the state of play. Python 3.3.0 (v3.

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

2012-10-21 Thread Zero Piraeus
: On 21 October 2012 06:09, inshu chauhan wrote: > I am new to python and have a little problem to solve .. > import cv This module is not used in your code [and isn't part of the standard library]. > from math import floor, sqrt, ceil You're only using one of these functions. > from numpy i

Re: A desperate lunge for on-topic-ness

2012-10-21 Thread Chris Angelico
On Sun, Oct 21, 2012 at 9:00 PM, Steven D'Aprano wrote: > Er, no. Note spelling of "source code" vs "souce code". Hence the grin. Ahh. I totally didn't see that, I'm way too used to reading past typos. Sure. Printing out *source* code, that's altogether different. Me, though, I don't print anyth

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

2012-10-21 Thread Jussi Piitulainen
inshu chauhan writes: > 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

Re: Interest in seeing sh.py in the stdlib

2012-10-21 Thread Jason Friedman
> I'm interested in making sh.py more accessible to help bring Python forward > in the area of shell scripting, so I'm interested in seeing if sh would be > suitable for the standard library. Is there any other interest in something > like this? Pretty slick. My only concern is portability, are

Re: A desperate lunge for on-topic-ness

2012-10-21 Thread DJC
On 20/10/12 15:18, Grant Edwards wrote: On 2012-10-20, Dennis Lee Bieber wrote: Strangely, we've gone from 80-character fixed width displays to who-knows-what (if I drop my font size I can probably get nearly 200 characters across in full-screen mode)... But at the same time w

RE: Python does not take up available physical memory

2012-10-21 Thread Pradipto Banerjee
I tried this on a different PC with 12 GB RAM. As expected, this time, reading the data was no issue. I noticed that for large files, Python takes up 2.5x size in memory compared to size on disk, for the case when each line in the file is retained as a string within a Python list. As an anecdote

get each pair from a string.

2012-10-21 Thread Vincent Davis
I am looking for a good way to get every pair from a string. For example, input: x = 'apple' output 'ap' 'pp' 'pl' 'le' I am not seeing a obvious way to do this without multiple for loops, but maybe there is not :-) In the end I am going to what to get triples, quads... also. Thanks Vincent -

Re: get each pair from a string.

2012-10-21 Thread Emile van Sebille
On 10/21/2012 11:33 AM, Vincent Davis wrote: I am looking for a good way to get every pair from a string. For example, input: x = 'apple' output 'ap' 'pp' 'pl' 'le' I am not seeing a obvious way to do this without multiple for loops, but maybe there is not :-) In the end I am going to what to ge

Re: get each pair from a string.

2012-10-21 Thread Ian Kelly
On Sun, Oct 21, 2012 at 12:33 PM, Vincent Davis wrote: > I am looking for a good way to get every pair from a string. For example, > input: > x = 'apple' > output > 'ap' > 'pp' > 'pl' > 'le' > > I am not seeing a obvious way to do this without multiple for loops, but > maybe there is not :-) Use

Re: get each pair from a string.

2012-10-21 Thread Vincent Davis
@Emile, I feel a little stupid, in my mind it was more difficult than in reality. x = 'apple' for f in range(len(x)-1): print(x[f:f+2]) @Ian, Thanks for that I was just looking in to that. I wonder which is faster I have a large set of strings to process. I'll try some timings if I get a chan

Re: get each pair from a string.

2012-10-21 Thread Mark Lawrence
On 21/10/2012 19:33, Vincent Davis wrote: I am looking for a good way to get every pair from a string. For example, input: x = 'apple' output 'ap' 'pp' 'pl' 'le' I am not seeing a obvious way to do this without multiple for loops, but maybe there is not :-) In the end I am going to what to get t

Re: get each pair from a string.

2012-10-21 Thread Emile van Sebille
On 10/21/2012 11:51 AM, Ian Kelly wrote: On Sun, Oct 21, 2012 at 12:33 PM, Vincent Davis wrote: I am looking for a good way to get every pair from a string. For example, input: x = 'apple' output 'ap' 'pp' 'pl' 'le' I am not seeing a obvious way to do this without multiple for loops, but maybe

Re: get each pair from a string.

2012-10-21 Thread Ian Kelly
On Sun, Oct 21, 2012 at 12:58 PM, Vincent Davis wrote: > x = 'apple' > for f in range(len(x)-1): > print(x[f:f+2]) > > @Ian, > Thanks for that I was just looking in to that. I wonder which is faster I > have a large set of strings to process. I'll try some timings if I get a > chance later tod

Re: A desperate lunge for on-topic-ness

2012-10-21 Thread Steven D'Aprano
On Sun, 21 Oct 2012 22:43:07 +1100, Chris Angelico wrote: > On Sun, Oct 21, 2012 at 9:00 PM, Steven D'Aprano > wrote: >> Er, no. Note spelling of "source code" vs "souce code". Hence the grin. > > Ahh. I totally didn't see that, I'm way too used to reading past typos. As a programmer, doesn't t

Re: A desperate lunge for on-topic-ness

2012-10-21 Thread Grant Edwards
On 2012-10-21, Steven D'Aprano wrote: > On Sun, 21 Oct 2012 22:43:07 +1100, Chris Angelico wrote: > >> On Sun, Oct 21, 2012 at 9:00 PM, Steven D'Aprano >> wrote: >>> Er, no. Note spelling of "source code" vs "souce code". Hence the grin. >> >> Ahh. I totally didn't see that, I'm way too used to

Re: get each pair from a string.

2012-10-21 Thread Emile van Sebille
On 10/21/2012 12:06 PM, Ian Kelly wrote: On Sun, Oct 21, 2012 at 12:58 PM, Vincent Davis wrote: x = 'apple' for f in range(len(x)-1): print(x[f:f+2]) @Ian, Thanks for that I was just looking in to that. I wonder which is faster I have a large set of strings to process. I'll try some timin

Re: A desperate lunge for on-topic-ness

2012-10-21 Thread Roy Smith
In article , Grant Edwards wrote: > On 2012-10-21, Steven D'Aprano wrote: > > On Sun, 21 Oct 2012 22:43:07 +1100, Chris Angelico wrote: > > > >> On Sun, Oct 21, 2012 at 9:00 PM, Steven D'Aprano > >> wrote: > >>> Er, no. Note spelling of "source code" vs "souce code". Hence the grin. > >> > >>

Re: A desperate lunge for on-topic-ness

2012-10-21 Thread Chris Angelico
On Mon, Oct 22, 2012 at 6:11 AM, Steven D'Aprano wrote: > On Sun, 21 Oct 2012 22:43:07 +1100, Chris Angelico wrote: > >> On Sun, Oct 21, 2012 at 9:00 PM, Steven D'Aprano >> wrote: >>> Er, no. Note spelling of "source code" vs "souce code". Hence the grin. >> >> Ahh. I totally didn't see that, I'm

Re: Python does not take up available physical memory

2012-10-21 Thread Tim Delaney
On 22 October 2012 01:14, Pradipto Banerjee < pradipto.baner...@adainvestments.com> wrote: > I tried this on a different PC with 12 GB RAM. As expected, this time, > reading the data was no issue. I noticed that for large files, Python takes > up 2.5x size in memory compared to size on disk, for t

Re: Interest in seeing sh.py in the stdlib

2012-10-21 Thread Alex Clark
On 2012-10-21 16:59:16 +, Dennis Lee Bieber said: On Sun, 21 Oct 2012 07:41:52 -0600, Jason Friedman declaimed the following in gmane.comp.python.general: Pretty slick. My only concern is portability, are there other examples of modules (excepting Win32) that work on some platforms and

Re: A desperate lunge for on-topic-ness

2012-10-21 Thread Chris Angelico
On Mon, Oct 22, 2012 at 7:19 AM, Roy Smith wrote: > Of course, the same can happen in Python. I could do: > > foo = "default value" > if blah == 47: >fooo = "some other value" > print foo > > No syntax error, no NameError, just the wrong thing printing. Yeah, that's the worst kind of bug. No

Re: get each pair from a string.

2012-10-21 Thread Joshua Landau
On 21 October 2012 19:33, Vincent Davis wrote: > I am looking for a good way to get every pair from a string. For example, > input: > x = 'apple' > output > 'ap' > 'pp' > 'pl' > 'le' > > I am not seeing a obvious way to do this without multiple for loops, but > maybe there is not :-) > In the end

Re: A desperate lunge for on-topic-ness

2012-10-21 Thread Joshua Landau
On 21 October 2012 21:38, Chris Angelico wrote: > On Mon, Oct 22, 2012 at 7:19 AM, Roy Smith wrote: > > Of course, the same can happen in Python. I could do: > > > > foo = "default value" > > if blah == 47: > >fooo = "some other value" > > print foo > > > > No syntax error, no NameError, ju

Re: get each pair from a string.

2012-10-21 Thread Vlastimil Brom
2012/10/21 Vincent Davis : > I am looking for a good way to get every pair from a string. For example, > input: > x = 'apple' > output > 'ap' > 'pp' > 'pl' > 'le' > > I am not seeing a obvious way to do this without multiple for loops, but > maybe there is not :-) > In the end I am going to what to

Re: A desperate lunge for on-topic-ness

2012-10-21 Thread Walter Hurry
On Sat, 20 Oct 2012 16:37:23 -0400, Roy Smith wrote: > sys.stderr.write("Error: Can't find the file 'settings.py' > in the directory containing %r.\nYou'll have to run django-profile.py, > passing it your settings module.\n(If the file settings.py does indeed > exist, it's causing an

Recursive Generator Error?

2012-10-21 Thread David
I have a tree-like data structure, the basic elements are hash tables, and they are grouped into lists, like [[{'a':1},[{'b':2}]]]. And I want to flat the lists and visit hash table one by one, like {'a':1}, {'b':2}. But my program didn't work as I wish. When it entered the 2nd flat_yield, it thre

Re: Recursive Generator Error?

2012-10-21 Thread Terry Reedy
On 10/21/2012 7:29 PM, David wrote: I have a tree-like data structure, the basic elements are hash tables, and they are grouped into lists, like [[{'a':1},[{'b':2}]]]. And I want to flat the lists and visit hash table one by one, like {'a':1}, {'b':2}. But my program didn't work as I wish. When

program loaded in memory

2012-10-21 Thread Anatoli Hristov
Hello, I need an advice about a small script I run 24/24 7/7. It's a script converted to EXE using py2exe and this script takes - grows 30kb RAM on each loop which means that for 10hours it grows up with 180mb memory. is there something I can do ? >From the ini file I'm loading only the URL and t

Re: program loaded in memory

2012-10-21 Thread Dave Angel
On 10/21/2012 08:02 PM, Anatoli Hristov wrote: > Hello, > > I need an advice about a small script I run 24/24 7/7. > > It's a script converted to EXE using py2exe and this script takes - > grows 30kb RAM on each loop which means that for 10hours it grows up > with 180mb memory. is there something I

Re: get each pair from a string.

2012-10-21 Thread Vincent Davis
@vbr Thats interesting. I would never have come up with that. Vincent On Sun, Oct 21, 2012 at 3:48 PM, Vlastimil Brom wrote: > vbr -- http://mail.python.org/mailman/listinfo/python-list

Re: program loaded in memory

2012-10-21 Thread Anatoli Hristov
Yes sorry, the name var(interval) is loaded from the ini file and also the Url. The reason is that the ini file will be configured from someone else. Example of the file URL = www # define your url interval = 1 # minutes for sync I see in the task manager each time it downloads the file that it g

Re: get each pair from a string.

2012-10-21 Thread Vincent Davis
To All, I appreciate the range of answers and the time each of you take to think about and answer my question. Whether or not I use them I find them all educational. Thanks again. Vincent On Mon, Oct 22, 2012 at 2:03 AM, Emile van Sebille wrote: > On 10/21/2012 12:06 PM, Ian Kelly wrote: > >>

Re: Recursive Generator Error?

2012-10-21 Thread David
On Monday, October 22, 2012 7:59:53 AM UTC+8, Terry Reedy wrote: > On 10/21/2012 7:29 PM, David wrote: > > > I have a tree-like data structure, the basic elements are hash tables, > > > and they are grouped into lists, like [[{'a':1},[{'b':2}]]]. > > > And I want to flat the lists and visit hash

Re: program loaded in memory

2012-10-21 Thread Dave Angel
On 10/21/2012 08:31 PM, Anatoli Hristov wrote: > Yes sorry, the name var(interval) is loaded from the ini file and also > the Url. The reason is that the ini file will be configured from > someone else. Example of the file > > URL = www # define your url > interval = 1 # minutes for sync > > I se

Re: Recursive Generator Error?

2012-10-21 Thread Steven D'Aprano
On Sun, 21 Oct 2012 17:40:41 -0700, David wrote: > If I have one "yield" in function, the function will become generator, Almost correct. The function becomes a *generator function*, that is, a function that returns a generator object. Sometimes people abbreviate that to "generator", but that i

Re: Preventing crap email from google?

2012-10-21 Thread Ben Finney
Grant Edwards writes: > Posts made via the google-groups web site are a problem, and I plonked > them all years and years ago... Walter Hurry writes: > It is Google bloody Groups which is the problem. I should have plonked > posts from there ages ago, and am about to remedy that omission. Wh

Re: get each pair from a string.

2012-10-21 Thread Ian Foote
On 22/10/12 09:03, Emile van Sebille wrote: So, as OP's a self confessed newbie asking about slicing, why provide an example requiring knowledge of tee, enumerate, next and izip? Because not only the newbie will read the thread? I for one was interested to see all the different possible appro

Re: A desperate lunge for on-topic-ness

2012-10-21 Thread Steven D'Aprano
On Mon, 22 Oct 2012 07:22:18 +1100, Chris Angelico wrote: > On Mon, Oct 22, 2012 at 6:11 AM, Steven D'Aprano > wrote: >>> Ahh. I totally didn't see that, I'm way too used to reading past >>> typos. >> >> As a programmer, doesn't that screw up your debugging ability? > > Reading-past-typos appli