Re: [Tutor] smtp project

2010-01-17 Thread Alan Plum
y probably just deliver the mail locally or forward them to a local message queue for a separate SMTP sender). Hope that helped a bit, Alan Plum ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] get (x)range borders

2010-01-28 Thread Alan Plum
gt; a xrange(20, 30) >>> a[0] 20 >>> a[-1] 29 Please note that the border will always be one step off if you're looking for the values you originally provided: the endpoint is always given as exclusive. If you want to know the step, you probably need to calcu

Re: [Tutor] language aid

2010-02-04 Thread Alan Plum
ples. words = [] w = ('aimer', 'love') words.append(w) The only problem with this approach is that it's not as easy to use as a dict, but as I was doing a word trainer, it was supposed to be randomly accessed anyway. Cheers, Alan Plum ___

Re: [Tutor] string to list

2010-02-11 Thread Alan Plum
ent is usually used for). In the case of your code, your lambda was: lambda x: x[0] and lambda x: x[1] If applied to a tuple or list, this works like this: >>> mytuple = ('a','b') >>> l1 = lambda x: x[0] >>> l2 = lamb

Re: [Tutor] os.environ question

2009-11-12 Thread Alan Plum
Ahoy! On Do, 2009-11-12 at 06:34 +0300, Khalid Al-Ghamdi wrote: > can anyone tell me why on python 2.6 i can enter os.environ and then > get all the items that that pertain to the os while on python 3 you > just get the following: > > with no items? Seems like os.environ has changed a little si

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

Re: [Tutor] Unexpected iterator

2009-11-15 Thread Alan Plum
On So, 2009-11-15 at 15:12 +, Stephen Nelson-Smith wrote: > > To upack your variables a and b you need an iterable object on the right > > side, which returns you exactly 2 variables > > What does 'unpack' mean? I've seen a few Python errors about packing > and unpacking. What does it mean?

Re: [Tutor] opening a file directly from memory

2009-11-17 Thread Alan Plum
Dammit. Meant to send this over the list. Sorry, Alan. On Di, 2009-11-17 at 21:33 +, Alan Gauld wrote: > Unices, like Linux have file association tables - but these > are often associated with the desktop environment - KDE, Gnome etc. > Finally for text files you should check the EDITOR and V

Re: [Tutor] How to get new messages from maildir?

2009-11-25 Thread Alan Plum
Ahoy! On Di, 2009-11-24 at 23:47 +, chombee wrote: > I'm using the standard mailbox module to read a maildir, but it seems to > be quite difficult to do some simple things. Is there any way to > identify a message as new, unread, unseen or something similar? What > about finding the most re

Re: [Tutor] working with bit arrays

2009-12-02 Thread Alan Plum
On Mi, 2009-12-02 at 13:08 -0500, Robert Berman wrote: > Hi, > > I am trying to represent a number as a list of bits: for example the > bit representation of the integer 8. I did find a number of articles > pertaining to a module called bitarray but I was unable to > download/install that package.

Re: [Tutor] When max() doesn't work as expected

2009-12-04 Thread Alan Plum
On Fr, 2009-12-04 at 08:21 +0100, spir wrote: > By the way, is there any reason why the compare func parameter is called > 'key'? I'd guess because what you provide creates keys for the values in the collection to sort them by. What else to call it? "Comparators" compare two values, "hashes" don'

Re: [Tutor] mod_python authentication

2009-12-07 Thread Alan Plum
nd ready for use, Google is your friend. Depending on what you use there are plenty of CGI-compatible packages and WSGI frameworks to choose from. Cheers, Alan Plum ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] mod_python authentication

2009-12-08 Thread Alan Plum
any non-commercial authorities will still trigger security warnings in most browsers, so the only way to get one that isn't counter-productive (i.e. diminishes trust rather than increasing it -- dodgy certificates are still valid certificates) is to shell out the big money -- and unless you'

Re: [Tutor] print IP address range to stdout

2009-12-22 Thread Alan Plum
On Di, 2009-12-22 at 10:53 +0100, MK wrote: > Hi there, > > i have some logical problem. I dont get it done to write my for loops in > that way that the ip address range which is given as arguments are > correct processed. Meaning that only the ips are printed which the > user defines as argument.

Re: [Tutor] print IP address range to stdout

2009-12-22 Thread Alan Plum
ip in range(start, end+1): blocks = [] for i in range(4): blocks.append((ip & (0xff << (8 * i))) >> (8 * i)) print '.'.join(blocks) Hope this helps. I haven't run this code, so you might want to make sure it works correctly before using it. Cheer

Re: [Tutor] print IP address range to stdout

2009-12-22 Thread Alan Plum
Hi again, On Di, 2009-12-22 at 12:46 +0100, Alan Plum wrote: > # Now generate the addresses: > for ip in range(start, end+1): > blocks = [] > for i in range(4): > blocks.append((ip & (0xff << (8 * i))) >> (8 * i)) > print '.'.join

Re: [Tutor] How to open the closed file again?

2010-01-05 Thread Alan Plum
want to refactor this into an object. Cheers, Alan Plum ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor