Re: [Tutor] Programming Ideas, need some focus

2008-01-18 Thread Danny Navarro
http://www.pythonchallenge.com/ is a great way to learn Python.

Danny

On Jan 16, 2008 4:58 PM, Fiyawerx <[EMAIL PROTECTED]> wrote:

> I've been over google for hours now, and I'm sort of at a lull in my
> learning, as I don't really have a current "goal". I know I could set some
> easy goal like to learn a specific function or feature, but I still have a
> hard time with that approach also. I was wondering if anyone knows of any
> sites where people might request "projects" almost like rentacoder, but for
> free stuff and/or just for fun. Almost an 'It would be nice if I had a
> program that did this.. " type of thing to give me some direction. Or does
> anyone else have any ideas for some types of programs that might actually
> prove useful to people for beginners to work on?
>
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] data structure question

2008-01-18 Thread Tiger12506
> 
> class Task(object):
> def __init__(self, cargo, children=[]):
> self.cargo = cargo
> self.children = children
>
> def __str__(self):
> s = '\t'.join(self.cargo)
> return s
>
> def add_child(self,child):
> self.children = self.children + [child]

This is an excellent start.
self.children = self.children +[child]
can be
self.children.append(child)

Building on your concept and Kent's suggestions, I wish to list some things 
that will
help me to organize this...

* Each task is a container for other tasks (children)  (Essentially a *list* 
of other tasks)
* Each task has 'cargo' which is a string
* Each task can print it's direct contents, or a full recursive print is 
available

This helps, I think.

So the answer is -> when you add a child to self.children, make it an 
instance of Task
Oh ~ and ~

class Task(object):
   ...
def recursive_print(self, level=0):
print "\t"*level + self.cargo
for x in self.children:
  recursive_print(x,level+1)

should take care of the recursive printing with level control 

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Converting binary file date into a file?

2008-01-18 Thread Eric Brunson
Ole Jensen wrote:
> Hi
>  
> I made a small python program at home and tried to send by email 
> attachments to my studymates.
> The attachment however shows up as a strange text
>  
> the first lines look like this:
>  
> M1F]R<_AG(#(@+2 R(&=E;F5R871O PROTECTED])4"!O
> M;&EE<'5M<&4)4"!V86YD<'5M<&4)4"!F M5&EM92 P( [EMAIL PROTECTED]( DS-C(S-C N," ),3(R,BXR,C(R,C(R
> M,B ),30V-"[EMAIL PROTECTED] ... 
> @X.2
>  
> ),3$R+C(S,S,S,S,S,R ),S0Y,3,T+C$W,[EMAIL PROTECTED]
> M,PT*5&EM92 Q( [EMAIL PROTECTED]( DS-34S-# N," ),3(R,BXR,C(R
>  
> I was thinking that it might be the binary representation of my .py 
> files? (the files were not compresses, just basic .py-files)
> If so is there anyways its possible to convert it back into an 
> ordinary text file? through either Python og Windows?

Your email application attached the files using a standard called MIME 
(Multipurpose Internet Mail Extensions, see: 
http://www.faqs.org/rfcs/rfc2045.html

Part of the standards involves the choice of using a base64 encoding to 
ensure the attachment is 7-bit clean to properly transfer over SMTP, 
that's what you're seeing is the encoded attachment.

Several things may have happened.  1) the program you used to send the 
mail didn't perform the MIME attaching correctly and didn't include the 
proper information for the receiver to decode, 2) something corrupted 
the email in transit or 3) the email client reading the email doesn't 
know how to handle MIME.

If the problem is not 2 then you could open the email with a different 
mail application or you could save the raw email to a file and try to 
use python or other tools to extract the content.

Check out http://docs.python.org/lib/module-email.html for details on 
extracting MIME from email messages or simply look at 
http://docs.python.org/lib/module-base64.html for info on decoding the 
attachment after you've manually extracted the encoded text from the file.

Hope that's at least a little bit of help,
e.

>  
> I ain'tt gonna be back to my own PC for the rest of the weekend so 
> some of the study work requires me to decode the attachments.
>  
> All help highly appriciated
> Best regards
>  
> Ole Jensen
> 
>
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>   

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Converting binary file date into a file?

2008-01-18 Thread Ole Jensen
Hi

I made a small python program at home and tried to send by email attachments
to my studymates.
The attachment however shows up as a strange text

the first lines look like this:

M1F]R<_AG(#(@+2 R(&=E;F5R871Ohttp://groups.google.com/groups/unlock?msg=c42d7058ff6b0c28&hl=en&_done=/group/gruppe-b1/browse_thread/thread/23a5c2bfae647d8b%3Fhl%3Den>
@X.2 ),3$R+C(S,S,S,S,S,R ),S0Y,3,T+C$W,[EMAIL PROTECTED]
M,PT*5&EM92 Q( [EMAIL PROTECTED]( DS-34S-# N," ),3(R,BXR,C(R

I was thinking that it might be the binary representation of my .py files?
(the files were not compresses, just basic .py-files)
If so is there anyways its possible to convert it back into an ordinary text
file? through either Python og Windows?

I ain'tt gonna be back to my own PC for the rest of the weekend so some of
the study work requires me to decode the attachments.

All help highly appriciated
Best regards

Ole Jensen
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] data structure question

2008-01-18 Thread Terry Carroll
On Fri, 18 Jan 2008, Alexander wrote:

> I'm trying to write a small todo list/task manager...

Hi, Alexander.  Not to derail your actual question, but have you looked at 
Task Coach? It's a small todo list/task manager, written in Python using 
wxPython.

It does much, perhaps all, of what you're looking for, and it's open 
source.  You might be able to take it and either use it as-is, or modify 
it to meet your needs.  (And donate back the changes, if you feel 
generous.)

http://www.taskcoach.org/
http://sourceforge.net/projects/taskcoach/

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] interview questions

2008-01-18 Thread Varsha Purohit
Hello All,
   I have an interview in python program development. Can i know some
interview questions in python ? If you know any website where i can refer
that would be helpful.

thanks,
-- 
Varsha Purohit,
Graduate Student
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] [tutor] Interview questions in python and wxpython

2008-01-18 Thread Varsha Purohit
Hello All,
   I have an interview in python program development. Can i know some
interview questions in python ? If you know any website where i can refer
that would be helpful.

thanks,

-- 
Varsha Purohit,
Graduate Student
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Converting binary file date into a file?

2008-01-18 Thread Tiger12506
Many email clients encode attachments in base-64. I think there are standard 
modules in python which should be able to decode this.

> Hi
>
> I made a small python program at home and tried to send by email 
> attachments
> to my studymates.
> The attachment however shows up as a strange text
>
> the first lines look like this:
>
> M1F]R<_AG(#(@+2 R(&=E;F5R871O PROTECTED])4"!O
> M;&EE<'5M<&4)4"!V86YD<'5M<&4)4"!F M5&EM92 P( [EMAIL PROTECTED]( DS-C(S-C N," ),3(R,BXR,C(R,C(R
> M,B ),30V-"[EMAIL 
> PROTECTED]
> @X.2 ),3$R+C(S,S,S,S,S,R ),S0Y,3,T+C$W,[EMAIL PROTECTED]
> M,PT*5&EM92 Q( [EMAIL PROTECTED]( DS-34S-# N," ),3(R,BXR,C(R
>
> I was thinking that it might be the binary representation of my .py files?
> (the files were not compresses, just basic .py-files)
> If so is there anyways its possible to convert it back into an ordinary 
> text
> file? through either Python og Windows?
>
> I ain'tt gonna be back to my own PC for the rest of the weekend so some of
> the study work requires me to decode the attachments.
>
> All help highly appriciated
> Best regards
>
> Ole Jensen
>





> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
> 

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] data structure question

2008-01-18 Thread Tiger12506
>def recursive_print(self, level=0):
>print "\t"*level + self.cargo
>for x in self.children:
>  recursive_print(x,level+1)

Whoops. should be

for x in self.children:
x.recursive_print(level+1)
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] data structure question

2008-01-18 Thread Alexander
Hi all,

I'm trying to write a small todo list/task manager and I'm having
trouble creating the right data structure to hold the tasks. The
program should have a command line interface.

This is what I want it to do:

* A list of tasks, where each task has a number of attributes.
Each task should be able to have subtasks.

* Persistence.

* A way to display all the tasks, with subtasks indented.

* A way to filter/search on the attributes of the tasks.

What I've tried so far is something like this:


class Task(object):
def __init__(self, cargo, children=[]):
self.cargo = cargo
self.children = children

def __str__(self):
s = '\t'.join(self.cargo)
return s

def add_child(self,child):
self.children = self.children + [child]



cargo is a list of the attributes of the task, such as task text,
status, deadline etc

What I'm having trouble with is:

* What data structure should all the Task instances be held in?

* How to traverse all the tasks, both with recursion into the subtasks
and not. I need the traversal both to create a nice string with the
task information for printing (here I need level-aware indentation),
and to be able to search the tasks by their attributes.

I suspect what I need is a tree, but I want one with multiple roots. I
only envision having <100 tasks at any one time so I don't need a
database backend. Persistence I think I've solved by having the
container data structure dump/load itself using pickle.

Best regards,

Alexander
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Teach-yourself game design site... for Python?

2008-01-18 Thread bhaaluu
Greetings,
There are several beginning tutorials at the PyGame site:
http://pygame.org/news.html
-- 
b h a a l u u at g m a i l dot c o m
http://www.geocities.com/ek.bhaaluu/python/index.html

On Jan 18, 2008 3:23 PM, Kent Johnson <[EMAIL PROTECTED]> wrote:
> James Newton wrote:
> > Hi folks,
> >
> > I've just come across this article on the BBC site:
> >
> > 
>
> > So my question is: is there something similar in the Python community?
>
> I don't know of a collaborative, teaching community like that. There are
> a couple of frameworks for creating games in Python (pygame, pyglet) and
> the PyWeek challenge http://www.pyweek.org/ encourages game development
> and sharing.
>
> Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Teach-yourself game design site... for Python?

2008-01-18 Thread Kent Johnson
James Newton wrote:
> Hi folks,
> 
> I've just come across this article on the BBC site:
> 
> 

> So my question is: is there something similar in the Python community?

I don't know of a collaborative, teaching community like that. There are 
a couple of frameworks for creating games in Python (pygame, pyglet) and 
the PyWeek challenge http://www.pyweek.org/ encourages game development 
and sharing.

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Teach-yourself game design site... for Python?

2008-01-18 Thread James Newton
Hi folks,

I've just come across this article on the BBC site:



You can see some of the games that are either created collaboratively or
designed to be improved collaboratively at:



Here's the home page for the My G-Life site:




So my question is: is there something similar in the Python community?

James


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Programming Ideas, need some focus

2008-01-18 Thread Simón A. Ruiz
I'll second that.

It's quite an interesting mental gymnastics challenge, and will get you 
familiar with a lot of the modules. They also have helpful forums for 
when you get stuck.

Simón

Danny Navarro wrote:
> http://www.pythonchallenge.com/ is a great way to learn Python.
> 
> Danny
> 
> On Jan 16, 2008 4:58 PM, Fiyawerx < [EMAIL PROTECTED] 
> > wrote:
> 
> I've been over google for hours now, and I'm sort of at a lull in my
> learning, as I don't really have a current "goal". I know I could
> set some easy goal like to learn a specific function or feature, but
> I still have a hard time with that approach also. I was wondering if
> anyone knows of any sites where people might request "projects"
> almost like rentacoder, but for free stuff and/or just for fun.
> Almost an 'It would be nice if I had a program that did this.. "
> type of thing to give me some direction. Or does anyone else have
> any ideas for some types of programs that might actually prove
> useful to people for beginners to work on?
> 
> ___
> Tutor maillist  -  Tutor@python.org 
> http://mail.python.org/mailman/listinfo/tutor
> 
> 
> 
> 
> 
> 
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] data structure question

2008-01-18 Thread Kent Johnson
Alexander wrote:

> * A list of tasks, where each task has a number of attributes.
> Each task should be able to have subtasks.

Sounds like you should keep the Task objects in a list :-)
Possibly just the top-level tasks should be in the list...

> * A way to filter/search on the attributes of the tasks.
> 
> What I've tried so far is something like this:
> 
> 
> class Task(object):
>   def __init__(self, cargo, children=[]):

Don't use mutable objects as default arguments! See
http://effbot.org/pyfaq/why-are-default-values-shared-between-objects.htm
for an explanation.

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Programming Ideas, need some focus

2008-01-18 Thread Michael Langford
For those of you interested in hacking on the OLPC, IBM is putting up
a tutorial that goes through all the stuff with Qemu etc:

http://www.ibm.com/developerworks/linux/edu/l-dw-linux-xo-python-i.html?S_TACT=105AGX03&S_CMP=HP%3Cbr%3E

On 1/16/08, Fiyawerx <[EMAIL PROTECTED]> wrote:
> I've been over google for hours now, and I'm sort of at a lull in my
> learning, as I don't really have a current "goal". I know I could set some
> easy goal like to learn a specific function or feature, but I still have a
> hard time with that approach also. I was wondering if anyone knows of any
> sites where people might request "projects" almost like rentacoder, but for
> free stuff and/or just for fun. Almost an 'It would be nice if I had a
> program that did this.. " type of thing to give me some direction. Or does
> anyone else have any ideas for some types of programs that might actually
> prove useful to people for beginners to work on?
>
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>


-- 
Michael Langford
Phone: 404-386-0495
Consulting: http://www.RowdyLabs.com
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] data structure question

2008-01-18 Thread Alan Gauld

"Tiger12506" <[EMAIL PROTECTED]> wrote

> class Task(object):
>   ...
>def recursive_print(self, level=0):
>print "\t"*level + self.cargo
>for x in self.children:
>  recursive_print(x,level+1)

 x.recursive_print(level+1)

Is what you meant I think :-)

Alan G.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] data structure question

2008-01-18 Thread Alan Gauld

"Tiger12506" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>>def recursive_print(self, level=0):
>>print "\t"*level + self.cargo
>>for x in self.children:
>>  recursive_print(x,level+1)
>
> Whoops. should be
>
> for x in self.children:
>x.recursive_print(level+1)

Ah, you already caught it, my gmane feed ruinning a bit slow...

Alan G 


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor