Re: [Tutor] url parsing

2009-02-15 Thread Daniele
use this if you want to take a hammer to crack a nut :D import os url = 'http://this/is/my/url/to/parse' os.path.basename(url) #gives "parse" os.path.dirname(url) #gives 'http://this/is/my/url/to' ___ Tutor maillist - Tutor@python.org http://mail.pytho

[Tutor] modular program

2009-03-01 Thread Daniele
Hi, I'd like to write a python program which can be easily extended by other people. Where can I find some "best practices" for writing modular programs? I thought about a txt file containing function calls that my program will parse and execute in order, or is it better just to execute every .py f

Re: [Tutor] Tutor Digest, Vol 61, Issue 3

2009-03-01 Thread Daniele
> From: W W > Subject: Re: [Tutor] modular program >>Where can I find some "best practices" for writing modular programs? >> I thought about a txt file containing function calls that my program will >> parse and execute in order, or is it better just to execute every .py file >> in a certain "mod

Re: [Tutor] [Edited] Plug-in enabled Program

2009-03-02 Thread Daniele
> -- Messaggio inoltrato -- > From: "Alan Gauld" > To: tu...@python.org > Subject: Re: [Tutor] Tutor Digest, Vol 61, Issue 3 > > OK, To do that you need to provide an intrerface in your code > that the plug-in can use. That is to say you must call a documented > set of functions/me

Re: [Tutor] (no subject)

2009-03-17 Thread Daniele
> From: dukelx2...@gmail.com > To: tu...@python.org > Honestly I'm doing tutorials, I'm not in school.  I am trying to learn it for > my own sake. > I got the *'s to come up but they are not forming the way I would like it to. >  So that why I was asking for help. I suppose the trick here is to

Re: [Tutor] (no subject)

2009-03-24 Thread Daniele
> -- Messaggio inoltrato -- > Jared White wrote: > >>      ** >>    *      I cant get a code to work for this bottom half,  Can >> anyone help me Hi Jared, try this: for i in range(-10,11): print '*'*(11-abs(i)) ___

Re: [Tutor] (no subject)

2009-03-24 Thread Daniele
> From: Padmanaban Ganesan > Subject: Re: [Tutor] (no subject) > Could any one explain me whats this in it abs(i)??? >>> for i in range(-10,11): >>>   print '*'*(11-abs(i)) I'll try to explain it: with the first line you are looping through all integer from i = -10 to 10 the idea is to

Re: [Tutor] how to manage an encrypted file?

2009-06-22 Thread Daniele
> From: Wayne > If you want the most basic encryption you could simply XOR the file. It's > fairly easy to break, though, because the same character patterns will be > present as with your original file. Actually if you do it properly this kind of encryption is unbreakable, but you'd have to:

Re: [Tutor] how to manage an encrypted file?

2009-06-22 Thread Daniele
> From: "Alan Gauld" > To: tu...@python.org > Date: Mon, 22 Jun 2009 14:15:55 +0100 > Subject: Re: [Tutor] how to manage an encrypted file? >> >> there must be a Security Now episode that explains the thing pretty >> well (could be this one http://www.grc.com/sn/sn-011.htm). > > Eek! I tried to re

Re: [Tutor] General design question

2008-07-02 Thread Daniele
range(n, m) you can use the formula [ m*(m-1) - n*(n-1) ] / 2 or the equivalent (m+n-1)*(m-n)/2. Sorry for pointing out this last thing, of course it is not general at all, but maybe you'll find it useful anyway. Daniele ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Configuration File Pattern

2008-07-21 Thread Daniele
is there e third way? Thanks, Daniele ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Configuration File Pattern

2008-07-21 Thread Daniele
> What I use in this situation is the INI config file parser in the > standard lib. It's easy to use > > http://docs.python.org/lib/module-ConfigParser.html > Awesome! Really easy and intuitive. Thanks a lot ___ Tutor maillist - Tutor@python.org http:

[Tutor] urllib2 and php authentication

2008-07-26 Thread Daniele
t doesn't work. I get an html page back from the opener saying username and/or password are invalid. Can anyone point me in the right direction? thanks a lot, Daniele ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Name Generator

2008-09-19 Thread Daniele
Hi list, I'd like to implement a Name Generator based on a grammar ( http://en.wikipedia.org/wiki/Context-free_grammar). Are there any standard modules that automatically generate words based on a grammar? thanks for help, Daniele ___ Tutor mai

[Tutor] audio splitting with python

2008-10-02 Thread Daniele
Hi list, I'd like to split an ogg audio file into pieces (small enough to fit in an audio cd). Can anybody suggest me a python module to do that? Thanks, Daniele ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How trustworthy are pseudo-random numbers?

2008-10-03 Thread Daniele
>> [Alec Henriksen] >> > How trustworthy is the "randomness" generated by the random module? >> >> Python uses the Mersenne Twister algorithm for generating >> pseudo-random numbers, and that's one of the highest-quality methods >> known. >From here http://en.wikipedia.org/wiki/Pseudorandom_number

Re: [Tutor] How trustworthy are pseudo-random numbers?

2008-10-03 Thread Daniele
2008/10/3 Andre Engels <[EMAIL PROTECTED]>: > On Fri, Oct 3, 2008 at 4:11 PM, Daniele <[EMAIL PROTECTED]> wrote: > If you used every atom in the known universe as a computer, then let > them turn out a billion combinations a second for the entire time > since the big bang

[Tutor] Default parameter in class method

2008-10-07 Thread Daniele
f __init__(self): self.field='Default' def myMethod(self, parameter=self.field): pass I'm getting an error like "name 'self' is not defined"; it seems I cannot access self.field in the method definition. Is there a work-around (or maybe just the proper

Re: [Tutor] Default parameter in class method

2008-10-07 Thread Daniele
2008/10/7 Kent Johnson <[EMAIL PROTECTED]>: > On Tue, Oct 7, 2008 at 10:08 AM, Daniele <[EMAIL PROTECTED]> wrote: > def myMethod(self, parameter=_marker): > if parameter==_marker: >parameter = self.field Thanks Kent and Alan, I've understood the point and I t

[Tutor] what does the "@" operator mean?

2008-12-17 Thread Daniele
> From: "Alan Gauld" > Subject: Re: [Tutor] what does the "@" operator mean? Thinking it's quite funny, I'll keep on with italian words: the @ is called "chiocciola" which means snail, while # is called "cancelletto" which is a small gate As you see italian words are quite close to the sign shap

Re: [Tutor] Deleting recursive folder definition

2009-01-12 Thread Daniele
;s what > has > happened, it was a CASE tool that I was using that actually did the damage. > Any ideas? Hi Alan, I would try to boot from a linux live cd and remove the folder that way, also try the unlink unix command. Daniele ___ Tutor mai