[Tutor] getting python 3 to run from the command line

2009-11-14 Thread Khalid Al-Ghamdi
Hi, for some reason I haven't been able to get python 3 to work from the the command line. I've added it to the the path in the the system variables but still no luck. when I try to run python 2.6 it works flawlessly, though, bearing in mind that it wasn't added to the system variables! i'm runni

Re: [Tutor] parsing XML into a python dictionary

2009-11-14 Thread Alan Gauld
"Christopher Spears" wrote I've been working on a way to parse an XML document and convert it into a python dictionary. I want to maintain the hierarchy of the XML. Here is the sample XML I have been working on: Neil Gaiman Glyn Dillon Charles Vess This is my first stab at

Re: [Tutor] getting python 3 to run from the command line

2009-11-14 Thread Mark Tolonen
"Khalid Al-Ghamdi" wrote in message news:dfac564f0911140040y27e0bee5ub02aa2de2b02f...@mail.gmail.com... Hi, for some reason I haven't been able to get python 3 to work from the the command line. I've added it to the the path in the the system variables but still no luck. when I try to run p

Re: [Tutor] parsing XML into a python dictionary

2009-11-14 Thread Kent Johnson
On Sat, Nov 14, 2009 at 1:14 AM, Christopher Spears wrote: > I've been working on a way to parse an XML document and convert it into a > python dictionary.  I want to maintain the hierarchy of the XML.  Here is the > sample XML I have been working on: > > >   >    Neil Gaiman >    Glyn Dillon >

Re: [Tutor] getting python 3 to run from the command line

2009-11-14 Thread Kent Johnson
On Sat, Nov 14, 2009 at 3:40 AM, Khalid Al-Ghamdi wrote: > Hi, > for some reason I haven't been able to get python 3 to work from the the > command line. I've added it to the the path in the the system variables but > still no luck. when I try to run python 2.6 it works flawlessly, though, > beari

Re: [Tutor] Iterable Understanding

2009-11-14 Thread Stephen Nelson-Smith
Hi, >> for log in logs: >>  l = log.getline() >>  print l >> >> This gives me three loglines.  How do I get more?  Other than while True: >> > I presume that what you want is to get all lines from each log. Well... what I want to do is create a single, sorted list by merging a number of other sor

Re: [Tutor] getting python 3 to run from the command line

2009-11-14 Thread Dave Angel
Khalid Al-Ghamdi wrote: Hi, for some reason I haven't been able to get python 3 to work from the the command line. I've added it to the the path in the the system variables but still no luck. when I try to run python 2.6 it works flawlessly, though, bearing in mind that it wasn't added to the sy

Re: [Tutor] getting python 3 to run from the command line

2009-11-14 Thread Alan Gauld
"Khalid Al-Ghamdi" wrote for some reason I haven't been able to get python 3 to work from the the command line. I've added it to the the path in the the system variables but still no luck. when I try to run python 2.6 it works flawlessly, though, bearing in mind that it wasn't added to the s

Re: [Tutor] Iterable Understanding

2009-11-14 Thread Wayne Werner
On Sat, Nov 14, 2009 at 7:34 AM, Stephen Nelson-Smith wrote: > > Well... what I want to do is create a single, sorted list by merging a > number of other sorted lists. > > Just write your own merge: (simplified and probably inefficient and first thing off the top of my head) newlist = [] for x, y

Re: [Tutor] Iterable Understanding

2009-11-14 Thread Stephen Nelson-Smith
Gah! Failed to reply to all again! On Sat, Nov 14, 2009 at 1:43 PM, Stephen Nelson-Smith wrote: > Hi, >> I'm not 100% sure to understand your needs and intention; just have a try. >> Maybe what you want actually is rather: >> >> for log in logs: >>  for line in log: >>    print l > > Assuming yo

Re: [Tutor] Iterable Understanding

2009-11-14 Thread Stephen Nelson-Smith
Hi Wayne, > Just write your own merge: > (simplified and probably inefficient and first thing off the top of my head) > newlist = [] > for x, y, z in zip(list1, list2, list3): I think I need something like izip_longest don't I, since the list wil be of varied length? Also, where do these lists c

Re: [Tutor] Iterable Understanding

2009-11-14 Thread Wayne Werner
On Sat, Nov 14, 2009 at 8:49 AM, Stephen Nelson-Smith wrote: > Hi Wayne, > > > Just write your own merge: > > (simplified and probably inefficient and first thing off the top of my > head) > > newlist = [] > > for x, y, z in zip(list1, list2, list3): > > I think I need something like izip_longest

[Tutor] getting python 3 to run from the command line (version 2)

2009-11-14 Thread Khalid Al-Ghamdi
hi all, I realize my question was previous question was phrased, well, vaguely, as I learn from your responses so here's version 2 of my question: i'm running windows vista and have python 30 ,31 and 26 installed.! when I try to run python form the command line by printing *python *to whichever

[Tutor] OT: Writing code while tired, counterproductive?

2009-11-14 Thread Modulok
List, This is kind off topic, but: Does anyone else find, writing code while tired to be counterproductive? It just seems like when I push myself to stay up late finishing a project, I sorely regret it the following day. Granted, Python is a fairly forgiving language and doesn't take the mental

Re: [Tutor] parsing XML into a python dictionary

2009-11-14 Thread Christopher Spears
Thanks!  I have a lot of XML files at work that users search through.  I want to parse the XML into a python dictionary and then read the dictionary into a database that users can use to search through the thousands of files. Basically, the user would submit a query like "Neil Gaiman" and then t

Re: [Tutor] Iterable Understanding

2009-11-14 Thread Alan Gauld
"Stephen Nelson-Smith" wrote List 1List 2List 3 (1, cat) (2, fish) (1, cabbage) (4, dog) (5, pig) (2, ferret) (5, phone) (6, horse) (3, sausage) Won't this result in the lowest number *per row* being added to the new list? Or am I misunderstanding how it w

Re: [Tutor] getting python 3 to run from the command line (version 2)

2009-11-14 Thread Alan Gauld
"Khalid Al-Ghamdi" wrote when i try to code something it just gives me a new line without any processing of the code. (for example:2+2 returns a new line) You mean you get to the >>> prompt? And you type 2+2 you get this: 2+2 With just a newline between your input and the next >>> pr

Re: [Tutor] Writing code while tired, counterproductive?

2009-11-14 Thread Alan Gauld
"Modulok" wrote Does anyone else find, writing code while tired to be counterproductive? Yes. Doing anything that is mentally taxing is usually a bad idea when tired! Alan G ___ Tutor maillist - Tutor@python.org To unsubscribe or change subsc

Re: [Tutor] getting python 3 to run from the command line (version 2)

2009-11-14 Thread Mark Tolonen
"Khalid Al-Ghamdi" wrote in message news:dfac564f0911140854v42fa4e0ehe5868517a50ef...@mail.gmail.com... hi all, I realize my question was previous question was phrased, well, vaguely, as I learn from your responses so here's version 2 of my question: i'm running windows vista and have pyth

Re: [Tutor] OT: Writing code while tired, counterproductive?

2009-11-14 Thread Kent Johnson
On Sat, Nov 14, 2009 at 12:43 PM, Modulok wrote: > Does anyone else find, writing code while tired to be counterproductive? I definitely find that there is a point of diminishing returns, where my productivity and the quality of code decline to the point where it is no longer worth it to continu

Re: [Tutor] OT: Writing code while tired, counterproductive?

2009-11-14 Thread Jose Amoreira
When I get really tired, I sort of slip into an half awaken state. I still have my eyes open, I still look at the code, I still think about the problem, but suddenly the lines come alive and start arguing with each other (and some times arguing with me!), or setting up dates, or singing in choir

Re: [Tutor] Should a beginner learn Python 3.x

2009-11-14 Thread Alan Plum
Ahoy! On Sa, 2009-11-14 at 20:49 +, Stephen Nelson-Smith wrote: > He's an absolute beginner with no programming experience at all. I > think he might be following 'Python Programming for the Absolute > Beginner", or perhaps some online guides. Should I advise him to > stick with 2.6 for a bi

[Tutor] Should a beginner learn Python 3.x

2009-11-14 Thread Stephen Nelson-Smith
My brother in law is learning python. He's downloaded 3.1 for Windows, and is having a play. It's already confused him that print "hello world" gives a syntax error He's an absolute beginner with no programming experience at all. I think he might be following 'Python Programming for the Abs

Re: [Tutor] Should a beginner learn Python 3.x

2009-11-14 Thread Alan Gauld
"Stephen Nelson-Smith" wrote Beginner", or perhaps some online guides. Should I advise him to stick with 2.6 for a bit, since most of the material out there will be for 2.x? Or since he's learning from scratch, should he jump straight to 3.x Version 3 support is getting there but I still

[Tutor] opening a file directly from memory

2009-11-14 Thread mjekl
I'm wondering if I must save a file to memory before opening it. By opening I mean displaying it to the user. I have a BLOB field in a db and I have managed to read the blob into a binary fileobject. I've also managed to write it to disk and then I open it by doubleclicking on it. But I was

[Tutor] Find Integer co-ordinates lying on a circle

2009-11-14 Thread Shashwat Anand
How to find all possible integer co-ordinates lying on a circle of given radius 'r'. If given the upper bound of 'r', I want to calculate all given co-ordinates lying for 0 <= r <= n Let's say the upper bound of radius is 5 All possible results are: radius 'r' - (x, y) 0 - (0, 0) 1 - (1, 0), (0, 1

Re: [Tutor] opening a file directly from memory

2009-11-14 Thread Dave Angel
mj...@iol.pt wrote: I'm wondering if I must save a file to memory before opening it. By opening I mean displaying it to the user. I have a BLOB field in a db and I have managed to read the blob into a binary fileobject. I've also managed to write it to disk and then I open it by doubleclic

Re: [Tutor] Find Integer co-ordinates lying on a circle

2009-11-14 Thread Dave Angel
Shashwat Anand wrote: How to find all possible integer co-ordinates lying on a circle of given radius 'r'. If given the upper bound of 'r', I want to calculate all given co-ordinates lying for 0 <= r <= n Let's say the upper bound of radius is 5 All possible results are: radius 'r' - (x, y) 0

Re: [Tutor] Find Integer co-ordinates lying on a circle

2009-11-14 Thread Shashwat Anand
> > Your "all possible results" isn't even close to all the points that match > the 0<= r <= 5. And I don't know how either spec justifies the set logic > you quoted. > > So I have to start over. I think you're trying to find all integer > co-ordinates which lie on or within a circle of given ra

Re: [Tutor] opening a file directly from memory

2009-11-14 Thread mjekl
da...@ieee.org wrote: mj...@iol.pt wrote: I'm wondering if I must save a file to memory before opening it. By opening I mean displaying it to the user. I have a BLOB field in a db and I have managed to read the blob into a binary fileobject. I've also managed to write it to disk and then I o

Re: [Tutor] Find Integer co-ordinates lying on a circle

2009-11-14 Thread Dave Angel
Shashwat Anand wrote: Your "all possible results" isn't even close to all the points that match the 0<= r <= 5. And I don't know how either spec justifies the set logic you quoted. So I have to start over. I think you're trying to find all integer co-ordinates which lie on or within

Re: [Tutor] opening a file directly from memory

2009-11-14 Thread Dave Angel
(You forgot to send this message to the list, so I'm forwarding it) mj...@iol.pt wrote: da...@ieee.org wrote: mj...@iol.pt wrote: I'm wondering if I must save a file to memory before opening it. By opening I mean displaying it to the user. I have a BLOB field in a db and I have managed to re

Re: [Tutor] Should a beginner learn Python 3.x

2009-11-14 Thread Kristin Wilcox
I started as an absolute beginner to with programming with Python 3. I remain a beginner but I've now installed 2.6 as well, because I found that some of the modules I wanted to use weren't available for 3.x. My personal experience was that the available literature/tutorials wasn't really a proble

Re: [Tutor] opening a file directly from memory

2009-11-14 Thread mjekl
da...@ieee.org wrote: (You forgot to send this message to the list, so I'm forwarding it) mj...@iol.pt wrote: da...@ieee.org wrote: mj...@iol.pt wrote: I'm wondering if I must save a file to memory before opening it. By opening I mean displaying it to the user. I have a BLOB field in a db

Re: [Tutor] Should a beginner learn Python 3.x

2009-11-14 Thread wesley chun
>> My brother in law is learning python. He's downloaded 3.1 for >> Windows, and is having a play. It's already confused him that print >> "hello world" gives a syntax error >> >> He's an absolute beginner with no programming experience at all. I >> think he might be following 'Python Progra

Re: [Tutor] Should a beginner learn Python 3.x

2009-11-14 Thread bibi midi
On Sun, Nov 15, 2009 at 10:37 AM, wesley chun wrote: > >> My brother in law is learning python. He's downloaded 3.1 for > >> Windows, and is having a play. It's already confused him that print > >> "hello world" gives a syntax error > >> > >> He's an absolute beginner with no programming ex