Re: where do my python files go in linux?

2008-01-13 Thread A.T.Hofkamp
On 2008-01-12, Jorgen Bodde <[EMAIL PROTECTED]> wrote: > Question 1. Where do I put the bulk of python scripts in a normal > linux environment? > Question 2. Should I use *.pyc rather then *.py files to speed up > executing as the user cannot write to /usr/bin or any other dir in the > system and e

Re: Recieving emails in python

2008-01-13 Thread Shane Geiger
[EMAIL PROTECTED] wrote: > I m trying to create something simple a mailing list similar to yahoo > groups > I m stumbling at the part where the python recieves messages via say > [EMAIL PROTECTED] > > how to make python recieve emails and process it > after that it is str

Re: Recieving emails in python

2008-01-13 Thread mobiledreamers
ok i dont want to write an mta i want to use another mta to recieve emails on say - [EMAIL PROTECTED] so can i start reading the emails to python from that mta How to set this up to read messages from the mta sending out email we are using sendmail so we ll continue using that for now thanks It

Recieving emails in python

2008-01-13 Thread mobiledreamers
I m trying to create something simple a mailing list similar to yahoo groups I m stumbling at the part where the python recieves messages via say [EMAIL PROTECTED] how to make python recieve emails and process it after that it is straight forward processing in python inserting in db etc -- http:/

(bit)torrent source code help

2008-01-13 Thread Astan Chee
Hi, Im using windows XP and I was wondering if anyone had any experience in compiling (using py2exe) the official bittorrent client ( http://download.bittorrent.com/dl/BitTorrent-5.2.0.tar.gz ) or any bittorrent client open source and written in python. I ask since I am trying to make several o

Re: time.time or time.clock

2008-01-13 Thread Ron Adam
Fredrik Lundh wrote: > John Machin wrote: > >> AFAICT that was enough indication for most people to use time.clock on >> all platforms ... > > which was unfortunate, given that time.clock() isn't even a proper clock > on most Unix systems; it's a low-resolution sample counter that can > happi

Re: time.time or time.clock

2008-01-13 Thread Ron Adam
John Machin wrote: > On Jan 14, 7:05 am, Ron Adam <[EMAIL PROTECTED]> wrote: >> I'm having some cross platform issues with timing loops. It seems >> time.time is better for some computers/platforms and time.clock others, but > > Care to explain why it seems so? > >> it's not always clear which

Threaded server

2008-01-13 Thread Giampaolo Rodola'
Hi, I'm trying to run an asynchronous FTP server I wrote into a thread for being able to run a test suite against it. The code below is the threaded FTP server code I'm using: --- snippet --- class FTPd(threading.Thread): def __init__(self): self.active = False threading.Thre

Re: Slicing wrapped numpy arrays

2008-01-13 Thread Robert Kern
Martin Manns wrote: > On Sun, 13 Jan 2008 16:03:16 -0600 > Robert Kern <[EMAIL PROTECTED]> wrote: > >> Martin Manns wrote: >>> Hi, >>> >>> I have created a class that wraps a numpy array of custom objects. I >>> would like to be able to slice respective objects (without copying >>> the array if po

Re: Great Python books for the beginner

2008-01-13 Thread MooJoo
In article <[EMAIL PROTECTED]>, GeneralCody <[EMAIL PROTECTED]> wrote: > On 2008-01-12 08:03:42 +0100, Landon <[EMAIL PROTECTED]> said: > > > Hi, I'm a freshman in college and I'm going to be taking an intro to > > programming course next semester which mainly uses Python, so I > > thought it mi

Re: How to get user home directory on Windows

2008-01-13 Thread Tim Golden
Martin P. Hellwig wrote: > Giampaolo Rodola' wrote: >> Hi all, >> I'm trying to use the pywin32 extension to find out the user's home >> directory but currently I didn't find a solution yet. >> What I'd need to do is not getting the home directory of the currently >> logged in user but something li

Re: import gzip error (please help)

2008-01-13 Thread syahreza.octadian
On Jan 11, 7:14 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > the core zlib library (libz.so) isn't installed on your machine. but in my machine there is file -rwxr-xr-x 1 bin bin48576 Sep 20 2006 /usr/local/lib/ python2.5/lib-dynload/zlib.so if i have to install zlib library c

Re: i am new guy for this discussion group

2008-01-13 Thread bill.wu
On Jan 14, 2:03 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Jan 13, 3:03 pm, "bill.wu" <[EMAIL PROTECTED]> wrote: > > > i am new guy to learn python,also for this discussion group, i am > > chinese. > > nice to meet you, everyone. > > Hi and welcome onboard. > > If you're new to program

Re: How to get user home directory on Windows

2008-01-13 Thread Martin P. Hellwig
Giampaolo Rodola' wrote: > Hi all, > I'm trying to use the pywin32 extension to find out the user's home > directory but currently I didn't find a solution yet. > What I'd need to do is not getting the home directory of the currently > logged in user but something like: > get_homedir("frank")

Re: Slicing wrapped numpy arrays

2008-01-13 Thread Martin Manns
On Sun, 13 Jan 2008 16:03:16 -0600 Robert Kern <[EMAIL PROTECTED]> wrote: > Martin Manns wrote: > > Hi, > > > > I have created a class that wraps a numpy array of custom objects. I > > would like to be able to slice respective objects (without copying > > the array if possible). > > > > I have b

Re: converting JSON to string

2008-01-13 Thread Gowri
On Jan 12, 2:58 am, Jeroen Ruigrok van der Werven <[EMAIL PROTECTED] nomine.org> wrote: > -On [20080112 08:38], Gowri ([EMAIL PROTECTED]) wrote: > > >Actually, I have one other problem after all this. I see that if I try > >to construct JSON output as above, it is of the form > >[{'isbn': u'1-56592

Re: paging in python shell

2008-01-13 Thread Tim Roberts
"Alex K" <[EMAIL PROTECTED]> wrote: > >Does anyone know if the python shell supports paging or if I should >look into iPython? Thank you so much. "Paging" is an overloaded term. What do you mean, exactly? Do you mean something like piping the output into "more"? The Python shell does that for t

Re: time.time or time.clock

2008-01-13 Thread Fredrik Lundh
John Machin wrote: > AFAICT that was enough indication for most people to use time.clock on > all platforms ... which was unfortunate, given that time.clock() isn't even a proper clock on most Unix systems; it's a low-resolution sample counter that can happily assign all time to a process that

Re: Slicing wrapped numpy arrays

2008-01-13 Thread Robert Kern
Martin Manns wrote: > Hi, > > I have created a class that wraps a numpy array of custom objects. I > would like to be able to slice respective objects (without copying the > array if possible). > > I have browsed the doc and found some hints at __getitem__. However, I > still do not grasp how to

Re: time.time or time.clock

2008-01-13 Thread John Machin
On Jan 14, 7:05 am, Ron Adam <[EMAIL PROTECTED]> wrote: > I'm having some cross platform issues with timing loops. It seems > time.time is better for some computers/platforms and time.clock others, but Care to explain why it seems so? > it's not always clear which, so I came up with the followin

Slicing wrapped numpy arrays

2008-01-13 Thread Martin Manns
Hi, I have created a class that wraps a numpy array of custom objects. I would like to be able to slice respective objects (without copying the array if possible). I have browsed the doc and found some hints at __getitem__. However, I still do not grasp how to do it. How do I implement __getitem

Re: *SPAM*: 04.6/4.0 - Re: Manually installing PIL

2008-01-13 Thread j igisbert.etra-id
My PDA runs with Windows Mobile 2003 SE could you or someone please explain me what to do? Thanks a lot for your effort. -Original Message- From: Fredrik Lundh <[EMAIL PROTECTED]> To: python-list@python.org Date: Sun, 13 Jan 2008 21:18:37 +0100 Subject: *SPAM*: 04.6/4.0 - Re: Manua

Re: LANG, locale, unicode, setup.py and Debian packaging

2008-01-13 Thread Donn
> Now you are mixing two important concepts - the *contents* > of the file with the *name* of the file. Then I suspect the error may be due to the contents having been written in utf8 from previous runs. Phew! It's bedtime on my end, so I'll try it again when I get a chance during the week. Th

Re: LANG, locale, unicode, setup.py and Debian packaging

2008-01-13 Thread Martin v. Löwis
> Now, I want to open that file from Python, and I create a path with > os.path.join() and an os.listdir() which results in this byte string: > paf = ['/home/donn/.fontypython/M\xc3\x96gul.pog'] > > I *think* that the situation is impossible because the system cannot resolve > the correct filena

Re: Great Python books for the beginner

2008-01-13 Thread Graeme Glass
On Jan 12, 9:03 am, Landon <[EMAIL PROTECTED]> wrote: > Hi, I'm a freshman in college and I'm going to be taking an intro to > programming course next semester which mainly uses Python, so I > thought it might be a good time to pick up Python beyond the scope of > the class as well. The text book f

Re: Manually installing PIL

2008-01-13 Thread Fredrik Lundh
j igisbert.etra-id wrote: > this. I have download Imaging-1.1.6 source code, and I found PIL folder, > but not binary file. If I download windows exe installer, it works > great, but I want to install manually for installing it on my PDA as the name implies, the source code distribution co

time.time or time.clock

2008-01-13 Thread Ron Adam
I'm having some cross platform issues with timing loops. It seems time.time is better for some computers/platforms and time.clock others, but it's not always clear which, so I came up with the following to try to determine which. import time # Determine if time.time is better than t

Re: *SPAM*: 06.2/6.0 - Re: Manually installing PIL

2008-01-13 Thread j igisbert.etra-id
Dear Fredik, I have tried to copy PIL folder into my application folder. I am using Tkinter also, and when I want to put an image as label I do: photo1 = Image.open(r"Myimage.gif") photo = ImageTk.PhotoImage(photo1) llogo =Label(root, image=photo,bg="white",height=60) And I receive an e

Re: Exceptions - How do you make it work like built-in exceptions?

2008-01-13 Thread Mark Tolonen
"Lie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >A built-in exceptions, when raised, would print traceback that points > out the offending code, like this: > > Traceback (most recent call last): > File "F:\dir\code.py", line 43, in >a = 1/0 <<<--- > ZeroDivisionError: inte

Re: LANG, locale, unicode, setup.py and Debian packaging

2008-01-13 Thread Donn
Well, that didn't take me long... Can you help with this situation? I have a file named "MÖgul.pog" in this directory: /home/donn/.fontypython/ I set my LANG=C Now, I want to open that file from Python, and I create a path with os.path.join() and an os.listdir() which results in this byte string

Re: i am new guy for this discussion group

2008-01-13 Thread [EMAIL PROTECTED]
On Jan 13, 3:03 pm, "bill.wu" <[EMAIL PROTECTED]> wrote: > i am new guy to learn python,also for this discussion group, i am > chinese. > nice to meet you, everyone. Hi and welcome onboard. If you're new to programming in general, you may want to join the tutor mailing-list. http://mail.python.or

Re: LANG, locale, unicode, setup.py and Debian packaging

2008-01-13 Thread Donn
Martin, I want to thank you for your patience, you have been sterling. I have an overview this evening that I did not have this morning. I have started fixing my code and the repairs may not be that extreme after all. I'll hack-on and get it done. I *might* bug you again, but I'll resist at all

Re: LANG, locale, unicode, setup.py and Debian packaging

2008-01-13 Thread Martin v. Löwis
> What happens if there is a filename that cannot be represented in it's > entirety? i.e. every character is 'replaced'. Does it simply vanish, or does > it appear as "?" ? :) The latter. I did open(u"\u20ac\u20ac","w") in an UTF-8 locale, then did "LANG=C ls", and it gave me ?? (as

Re: where do my python files go in linux?

2008-01-13 Thread Florian Diesch
"Jorgen Bodde" <[EMAIL PROTECTED]> wrote: > I am trying to make a debian package. I am following the tutorial by > Horst Jens > (http://showmedo.com/videos/video?name=linuxJensMakingDeb&fromSeriesID=37) > and it is very informative. However one thing my app has and his > doesn't, is multiple pyth

Re: LANG, locale, unicode, setup.py and Debian packaging

2008-01-13 Thread Donn
> No. It may use replacement characters (i.e. a question mark, or an empty > square box), but if you don't see such characters, then the terminal has > successfully decoded the file names. Whether it also correctly decoded > them is something for you to check (i.e. do they look right?) Okay. So, t

Re: LANG, locale, unicode, setup.py and Debian packaging

2008-01-13 Thread Martin v. Löwis
> Could it not be that the app doing the output (say konsole) could be > displaying a filename as best as it can (doing the ignore/replace) trick and > using whatever fonts it can reach) and this would disguise the situation? No. It may use replacement characters (i.e. a question mark, or an emp

Re: How to get user home directory on Windows

2008-01-13 Thread Tim Golden
thebjorn wrote: > On Jan 12, 6:50 pm, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: >> Update. >> I found a way for getting the home directory of the user but it >> requires to validate the user by providing username+password: >> >> def get_homedir(username, password): >> token = win32security

wxpython-wx.CheckListBox: changing item bacgkground color

2008-01-13 Thread Massi
Hi everyone! In my application (under windows) I'm using a wx.checklistbox. I would like the background color of an item to become red whenever an EVT_LISTBOX_DCLICK occurs. Is there any simple way to achieve it? Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list

i am new guy for this discussion group

2008-01-13 Thread bill.wu
i am new guy to learn python,also for this discussion group, i am chinese. nice to meet you, everyone. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get user home directory on Windows

2008-01-13 Thread thebjorn
On Jan 12, 6:50 pm, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > Update. > I found a way for getting the home directory of the user but it > requires to validate the user by providing username+password: > > def get_homedir(username, password): > token = win32security.LogonUser( > us

Re: Exceptions - How do you make it work like built-in exceptions?

2008-01-13 Thread Chris
On Jan 13, 4:14 pm, Lie <[EMAIL PROTECTED]> wrote: > A built-in exceptions, when raised, would print traceback that points > out the offending code, like this: > > Traceback (most recent call last): > File "F:\dir\code.py", line 43, in > a = 1/0 <<<--- > ZeroDivisionError: integer division o

Re: super, decorators and gettattribute

2008-01-13 Thread thebjorn
On Jan 13, 1:51 pm, Richard Szopa <[EMAIL PROTECTED]> wrote: > On Jan 13, 8:59 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > > On Sat, 12 Jan 2008 14:23:52 -0800, Richard Szopa wrote: > > > However, I am very surprised to learn that > > > > super_object.__getattr__(name)(*args, **kwar

Exceptions - How do you make it work like built-in exceptions?

2008-01-13 Thread Lie
A built-in exceptions, when raised, would print traceback that points out the offending code, like this: Traceback (most recent call last): File "F:\dir\code.py", line 43, in a = 1/0 <<<--- ZeroDivisionError: integer division or modulo by zero a user-made exception, when raised, would prin

Re: Simple List division problem

2008-01-13 Thread thebjorn
On Jan 13, 2:02 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > thebjorn wrote: > > > Eh... > > oh, forgot that it was "pulling requirements out of thin air" week on > c.l.python. Well, the OP requirements were to control the number of chunks, not the size of them, so I guess we both got it wrong

Re: about sort a list with integer key

2008-01-13 Thread lotrpy
On 1月13日, 下午8时32分, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > Use lambda when it works better for you, the speed difference is > marginal in practice anyway. itemgetter is not (and was never > intended to be) a general substitute for functions, as you've > discovered. > > The marginal speed differ

Re: LANG, locale, unicode, setup.py and Debian packaging

2008-01-13 Thread Donn
> If you can all ls them, and if the file names come out right, then > they'll have the same encoding. Could it not be that the app doing the output (say konsole) could be displaying a filename as best as it can (doing the ignore/replace) trick and using whatever fonts it can reach) and this woul

Re: Simple List division problem

2008-01-13 Thread Paul Rubin
thebjorn <[EMAIL PROTECTED]> writes: > Perhaps something like this? > > def chop(lst, length): > from itertools import islice > it = iter(lst) > z = [list(islice(it, length)) for i in xrange(1 + len(lst) // length)] > if len(z) > 1: > z[-2].extend(z.pop()) # the last item w

Re: LANG, locale, unicode, setup.py and Debian packaging

2008-01-13 Thread Martin v. Löwis
> I guess I'm confused by that. I can ls them, so they appear and thus have > characters displayed. I can open and cat them and thus the O/S can access > them, but I don't know whether their characters are strictly in ascii-limits > or drawn from a larger set like unicode. I mean, I have seen Ja

Re: Magic function

2008-01-13 Thread R�diger Werner
Well as I understand your problem now, you would not like all instances of an specific object that are still alive, but all references to an object (created somewhere, sometimes) in an local context (stack frame), that are accessible from 'that' context ( but also from many others). However in pyt

Re: Simple List division problem

2008-01-13 Thread Fredrik Lundh
thebjorn wrote: > Eh... oh, forgot that it was "pulling requirements out of thin air" week on c.l.python. > def chop(lst, length): > n = len(lst) / length > z = [lst[i:i+n] for i in xrange(0, len(lst), n)] > if len(z[-1]) < n and len(z) > 1: > z[-2].extend(z.pop(-1)) >

Re: __init__ explanation please

2008-01-13 Thread Ben Finney
Jeroen Ruigrok van der Werven <[EMAIL PROTECTED]> writes: > -On [20080113 01:41], Erik Lind ([EMAIL PROTECTED]) wrote: > >I'm new to Python, and OOP. I've read most of Mark Lutz's book and > >more online and can write simple modules, but I still don't

Re: Simple List division problem

2008-01-13 Thread thebjorn
On Jan 13, 1:05 pm, thebjorn <[EMAIL PROTECTED]> wrote: > On Jan 12, 8:33 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > > > marcstuart wrote: > > > How do I divide a list into a set group of sublist's- if the list is > > > not evenly dividable ? consider this example: > > > > x = [1,2,3,4,5,6

Re: super, decorators and gettattribute

2008-01-13 Thread Richard Szopa
On Jan 13, 8:59 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Sat, 12 Jan 2008 14:23:52 -0800, Richard Szopa wrote: > > However, I am very surprised to learn that > > > super_object.__getattr__(name)(*args, **kwargs) > > > getattr(super_object, name)(*args, **kwargs) > > > are not eq

Re: __init__ explanation please

2008-01-13 Thread Fredrik Lundh
Erik Lind wrote: > I'm new to Python, and OOP. I've read most of Mark Lutz's book and more > online and can write simple modules, but I still don't get when __init__ > needs to be used as opposed to creating a class instance by assignment. nothing is ever created by plain assignment in Python;

Re: about sort a list with integer key

2008-01-13 Thread Hrvoje Niksic
lotrpy <[EMAIL PROTECTED]> writes: > if i want sort each line by the first part,(it's a integer, in fact). > don't know how to do it with itemgetter. > key = int(itemgetter(0)) is wrong, key = lambda x:int(x[0]) works. > but s.b. told me itemgetter execute more quickly . Use lambda when it works

Re: sqlite3 is it in the python default distro?

2008-01-13 Thread Martin Marcher
On Saturday 12 January 2008 21:34 Martin Marcher wrote: > a) Is sqlite included in the python default distribution > b) In real life can I consider (on linux) that an installation of python > includes the sqlite stuff? forgive my that was pebcack. I wasn't reading the docs fully so I thought I nee

Re: __init__ explanation please

2008-01-13 Thread Fredrik Lundh
Jeroen Ruigrok van der Werven wrote: > I personally tend to see __init__ or __new__ as equivalent to what other > languages call a constructor. > > (And I am sure some people might disagree with that. ;)) given that they do different things, I'm not sure it's that helpful to describe them *both

Re: about sort a list with integer key

2008-01-13 Thread Fredrik Lundh
lotrpy wrote: > key = int(itemgetter(0)) is wrong, key = lambda x:int(x[0]) works. > but s.b. told me itemgetter execute more quickly . so you're more interested in speed than in correctness? ;-) operator.itemgetter is a function factory that creates a *function* that fetches the given item fr

Re: LANG, locale, unicode, setup.py and Debian packaging

2008-01-13 Thread Donn
> So on *your* system, today: what encoding are the filenames encoded in? > We are not talking about arbitrary files, right, but about font files? > What *actual* file names do these font files have? > > On my system, all font files have ASCII-only file names, even if they > are for non-ASCII chara

Re: Simple List division problem

2008-01-13 Thread thebjorn
On Jan 12, 8:33 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > marcstuart wrote: > > How do I divide a list into a set group of sublist's- if the list is > > not evenly dividable ? consider this example: > > > x = [1,2,3,4,5,6,7,8,9,10] > > y = 3 # number of lists I want to break x into > > z

Re: LANG, locale, unicode, setup.py and Debian packaging

2008-01-13 Thread Martin v. Löwis
>> I would advise against such a strategy. Instead, you should first >> understand what the encodings of the file names actually *are*, on >> a real system, and draw conclusions from that. > I don't follow you here. The encoding of file names *on* a real system are > (for Linux) byte strings of po

Re: LANG, locale, unicode, setup.py and Debian packaging

2008-01-13 Thread Donn
Martin, > Yes. It does so when it fails to decode the byte string according to the > file system encoding (which, in turn, bases on the locale). That's at least one way I can weed-out filenames that are going to give me trouble; if Python itself can't figure out how to decode it, then I can also

Re: LANG, locale, unicode, setup.py and Debian packaging

2008-01-13 Thread Martin v. Löwis
> I have found that os.listdir() does not always return unicode objects when > passed a unicode path. Sometimes "byte strings" are returned in the list, > mixed-in with unicodes. Yes. It does so when it fails to decode the byte string according to the file system encoding (which, in turn, bases

about sort a list with integer key

2008-01-13 Thread lotrpy
hi, if I want sort each line ,by the last part,of a file, below is the source. from operator import itemgetter content = (line.split() for line in file('foo.txt', 'rb')) for cursor, line in enumerate(sorted(content, key = itemgetter(-1), reverse = True)): print cursor, ' '.join(line) the conten

Re: __init__ explanation please

2008-01-13 Thread Jeroen Ruigrok van der Werven
-On [20080113 01:41], Erik Lind ([EMAIL PROTECTED]) wrote: >I'm new to Python, and OOP. I've read most of Mark Lutz's book and more >online and can write simple modules, but I still don't get when __init__ >needs to be used as opposed to creating a class instance

Mailinglist/newsgroup gateway

2008-01-13 Thread Jeroen Ruigrok van der Werven
-On [20080112 23:30], Dan Upton ([EMAIL PROTECTED]) wrote: >Why was this ever on the Python list (I assume it started as spam), >and why on earth has it continued? The Python mailinglist is a gateway to/from comp.lang.python for all I know. So anything idiotic getting posted there might make its w

Re: [Kamaelia] TCPClient: How to sense connection failure?

2008-01-13 Thread Bjoern Schliessmann
Michael Sparks wrote: > The behaviour you're seeing sounds odd (which is hopefully > encouraging :-), but it's not clear from the description whether > its a bug in your code or Kamaelia. One question I really have as > a result is what version are you using? Oh sorry, it's the versions from MegaP

Re: *** AMERICAN BASTARDS DESERVE TO BE RAPED ***

2008-01-13 Thread James Matthews
When did this list become a politics dialog? Please keep on topic "Python"! Thanks James On Jan 12, 2008 8:07 PM, Joe Riopel <[EMAIL PROTECTED]> wrote: > On Jan 12, 2008 2:00 PM, radiosrfun <[EMAIL PROTECTED]> wrote: > > Whether we agree on "tactics" or not - if it come to a battlefield with the

paypal python library

2008-01-13 Thread mobiledreamers
I m trying to program the paypal for accepting payments Aret there python libraries for the same thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: ftplib question (cannot open data connection)

2008-01-13 Thread Laszlo Nagy
> BUT: active FTP does not just send the data to the port that was in > the random port that was sent to the server... it addresses to the port > you sent, but it sends its data response FROM port 20. This means the > response looks like a totally unsolicited connection attempt from the > ou

Re: Elementary string-formatting

2008-01-13 Thread Matt Nordhoff
Odysseus wrote: > Hello, group: I've just begun some introductory tutorials in Python. > Taking off from the "word play" exercise at > > > > I've written a mini-program to tabulate the number of characters in each > word in a fi

Re: LANG, locale, unicode, setup.py and Debian packaging

2008-01-13 Thread Donn
Martin, Thanks, food for thought indeed. > On Unix, yes. On Windows, NTFS and VFAT represent file names as Unicode > strings always, independent of locale. POSIX file names are byte > strings, and there isn't any good support for recording what their > encoding is. I get my filenames from two sour

Re: Elementary string-formatting

2008-01-13 Thread Odysseus
In article <[EMAIL PROTECTED]>, Gary Herron <[EMAIL PROTECTED]> wrote: > Odysseus wrote: > > > > print '%2u %6u %4.2f' % \ > > (i, wordcounts[i], 100.0 * wordcounts[i] / wordcounts[0]) > > > Using 4.2 is the problem. The first digit (your 4) give the total > number of characters to use for

Re: Graphics Module

2008-01-13 Thread Gabriel
On 11 ene, 22:51, Mike <[EMAIL PROTECTED]> wrote: > On Jan 11, 3:31 pm, "Gabriel" <[EMAIL PROTECTED]> wrote: > > > Hi all ! > > > I'm developing a math program that shows graphics of functions. > > I would hear suggestions about the way of drawing 2D . > > > Thanks a lot for your answers. > > > - G

Re: Elementary string-formatting

2008-01-13 Thread John Machin
On Jan 13, 8:43 pm, Odysseus <[EMAIL PROTECTED]> wrote: > In article > <[EMAIL PROTECTED]>, > Roberto Bonvallet <[EMAIL PROTECTED]> wrote: > > > Put this at the beginning of your program: > > > from __future__ import division > > > This forces all divisions to yield floating points values: > >

Re: Elementary string-formatting

2008-01-13 Thread Odysseus
In article <[EMAIL PROTECTED]>, Roberto Bonvallet <[EMAIL PROTECTED]> wrote: > Put this at the beginning of your program: > > from __future__ import division > > This forces all divisions to yield floating points values: Thanks for the tip. May I assume the div operator will still behave

Re: Elementary string-formatting

2008-01-13 Thread Odysseus
In article <[EMAIL PROTECTED]>, John Machin <[EMAIL PROTECTED]> wrote: > > You obviously haven't tried float(n / m), or you wouldn't be asking. True, it was a very silly idea. > Most legible and slowest first: > 1. float(n) / float(m) > 2. n / float(m) > 3. 1.0 * n / m > Recommendation: go

Re: LANG, locale, unicode, setup.py and Debian packaging

2008-01-13 Thread Martin v. Löwis
> It seems to me that filenames are like snapshots of the locales where they > originated. On Unix, yes. On Windows, NTFS and VFAT represent file names as Unicode strings always, independent of locale. POSIX file names are byte strings, and there isn't any good support for recording what their e

Re: __init__ explanation please

2008-01-13 Thread Daniel Fetchinson
Please keep discussion on the list.. > > I'm not sure if I understand your question correctly but maybe this will > > help: > > > > If you want code to be run upon creating an instance of your class you > > would use __init__. Most common examples include setting attributes on > > the instance

Re: super, decorators and gettattribute

2008-01-13 Thread Marc 'BlackJack' Rintsch
On Sat, 12 Jan 2008 14:23:52 -0800, Richard Szopa wrote: > However, I am very surprised to learn that > > super_object.__getattr__(name)(*args, **kwargs) > > getattr(super_object, name)(*args, **kwargs) > > are not equivalent. This is quite odd, at least when with len() > and .__len__, str() an