Re: download x bytes at a time over network

2009-03-16 Thread Saurabh
> This isn't exactly how things work.  The server *sends* you bytes.  It can > send you a lot at once.  To some extent you can control how much it sends > before it waits for you to catch up, but you don't have anywhere near > byte-level control (you might have something like 32kb or 64kb level > c

OMPC- m-script to python script convertor

2009-03-16 Thread gopal mishra
Hi, I am trying to convert Matlab script to python script using OMPC.( http://ompc.juricap.com/ ) My matlab code is (.m file) Npts=100; R=0.5; X=[0:1/Npts:1]'; Y=[0:0.01:1]'; for i=1:Npts+1 if(X(i) <= .5) Ytop(i)=1.0; Ybot(i)=0.0; else

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-16 Thread Rhodri James
On Tue, 17 Mar 2009 02:41:23 -, MRAB wrote: Rhodri James wrote: On Tue, 17 Mar 2009 01:47:32 -, MRAB wrote: I'm not against putting a comma in the format to indicate that grouping should be used just as a dot indicates that a decimal point should be used. The locale would say wh

Re: having a function called after the constructor/__init__ is done

2009-03-16 Thread Michael Spencer
thomas.han...@gmail.com wrote: ... So any ideas on how to get a function called on an object just after __init__ is done executing? -- http://mail.python.org/mailman/listinfo/python-list Yes, you *can* use metaclasses - you need to override the type.__call__ method, which is what normally ca

Re: having a function called after the constructor/__init__ is done

2009-03-16 Thread Steven D'Aprano
On Mon, 16 Mar 2009 20:11:18 -0700, thomas.han...@gmail.com wrote: > Hi all, > > We've been breaking our heads over a good way of accomplishing an > "on_load" event in our multitouch GUI frameowork PyMT. We think we'd > like to trigger an "on_load" event after a class is fully instantiated ... >

Re: having a function called after the constructor/__init__ is done

2009-03-16 Thread Armin Moradi
class MyClass(object): def __init__(self, really_init=True): self.a = 3 self.b = 4 # other initialization if really_init: on_load() def on_load(self): print 'hello!' class B(MyClass): def __init__(self): super(B, self).__init__(False) s

Re: having a function called after the constructor/__init__ is done

2009-03-16 Thread alex goretoy
__del__ I use it to close a mysql connection -Alex Goretoy http://www.goretoy.com E. B. White - "Be obscure clearly." On Mon, Mar 16, 2009 at 10:11 PM, thomas.han...@gmail.com < thomas.han...@gmail.com> wrote: > Hi all, > > We've been breaking our heads over a good way of accomplishing an > "

cool things you can do with dict

2009-03-16 Thread alex goretoy
I though this was cool so I'd post about it, its one of the recipes class peanutsdict(dict): def __init__(self,default=None): dict.__init__(self) self.default = default def __getitem__(self,key): if key in self: return dict.__getitem__(self,key)

Re: Newbie question: How do I add elements to **kwargs in a function?

2009-03-16 Thread Aaron Garrett
On Mar 16, 9:59 pm, Chris Rebert wrote: > On Mon, Mar 16, 2009 at 7:48 PM, Aaron Garrett > > > > wrote: > > I have spent quite a bit of time trying to find the answer on this > > group, but I've been unsuccessful. Here is what I'd like to be able to > > do: > > > def A(**kwargs): > >    kwargs['e

having a function called after the constructor/__init__ is done

2009-03-16 Thread thomas.han...@gmail.com
Hi all, We've been breaking our heads over a good way of accomplishing an "on_load" event in our multitouch GUI frameowork PyMT. We think we'd like to trigger an "on_load" event after a class is fully instantiated (or just a function call for simplicity, so you dont need to worry about our specif

Re: Newbie question: How do I add elements to **kwargs in a function?

2009-03-16 Thread alex goretoy
I think you may need to do something like this in your code, this is what I will be doing here shortly too class peanutsdict(dict): __slots__ = ['defaultZZz'] def __init__(self,default=None): dict.__init(self) self.default = default def __getitem__(self,key): i

Re: Newbie question: How do I add elements to **kwargs in a function?

2009-03-16 Thread Chris Rebert
On Mon, Mar 16, 2009 at 7:48 PM, Aaron Garrett wrote: > I have spent quite a bit of time trying to find the answer on this > group, but I've been unsuccessful. Here is what I'd like to be able to > do: > > def A(**kwargs): >    kwargs['eggs'] = 1 > > def B(**kwargs): >    print(kwargs) > > def C(*

Newbie question: How do I add elements to **kwargs in a function?

2009-03-16 Thread Aaron Garrett
I have spent quite a bit of time trying to find the answer on this group, but I've been unsuccessful. Here is what I'd like to be able to do: def A(**kwargs): kwargs['eggs'] = 1 def B(**kwargs): print(kwargs) def C(**kwargs): A(**kwargs) B(**kwargs) I'd like to be able to make a

Re: PyWin32 for Python 3.x

2009-03-16 Thread Mark Tolonen
"cgoldberg" wrote in message news:6047c263-c6cb-4357-ad9b-96b61ec7e...@j8g2000yql.googlegroups.com... Release 213 is out already: Tim, Mark, this is great news.. thanks for tracking 3.x so closely. I big barrier for me to eventually adopt 3.x is the ability to use pywin32. thanks! -Corey

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-16 Thread MRAB
Rhodri James wrote: On Tue, 17 Mar 2009 01:47:32 -, MRAB wrote: I'm not against putting a comma in the format to indicate that grouping should be used just as a dot indicates that a decimal point should be used. The locale would say what characters would be used for them. I would prefer

Re: Run on Startup

2009-03-16 Thread MRAB
Ian Mallett wrote: Hi, I'd like to make a program that automatically runs on startup (right after login). How should I do that? Put it in the folder: C:\Documents and Settings\\Start Menu\Programs\Startup The exact path depends on your login/username and I'm assuming that Windows is insta

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-16 Thread Rhodri James
On Tue, 17 Mar 2009 01:47:32 -, MRAB wrote: I'm not against putting a comma in the format to indicate that grouping should be used just as a dot indicates that a decimal point should be used. The locale would say what characters would be used for them. I would prefer the format to have a

Run on Startup

2009-03-16 Thread Ian Mallett
Hi, I'd like to make a program that automatically runs on startup (right after login). How should I do that? Thanks, Ian -- http://mail.python.org/mailman/listinfo/python-list

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-16 Thread MRAB
Rhodri James wrote: On Mon, 16 Mar 2009 23:04:58 -, MRAB wrote: It should probably(?) be: financial = Locale(group_sep=",", grouping=[3]) print("my number is {0:10n:fin}".format(1234567, fin=financial)) The format "10n" says whether to use separators or a decimal point; the lo

Re: Why does Python not return first line?

2009-03-16 Thread Steven D'Aprano
On Mon, 16 Mar 2009 15:20:18 -0700, Falcolas wrote: > FWIW, I've rarely seen a \r by itself, even in Windows (where it's > usually \r\n). Unix generally just outputs the \n, so my guess is that > some other process which created the output removed newline characters, > but didn't account for the c

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-16 Thread Rhodri James
On Mon, 16 Mar 2009 23:04:58 -, MRAB wrote: It should probably(?) be: financial = Locale(group_sep=",", grouping=[3]) print("my number is {0:10n:fin}".format(1234567, fin=financial)) The format "10n" says whether to use separators or a decimal point; the locale "fin" says what

Can python quickly display results like bash?

2009-03-16 Thread robert song
Hello, everyone. python can be debugged with pdb, but if there anyway to get a quick view of the python execution. Just like sh -x of bash command. I didn't find that there is an option of python that can do it. besh wishes, robert -- http://mail.python.org/mailman/listinfo/python-list

Re: Integer arithmetic in hardware descriptions

2009-03-16 Thread JanC
bearophileh...@lycos.com wrote: > JanC: >> In most "modern" Pascal dialects the overflow checks can be (locally) >> enabled or disabled with compiler directives in the source code, > > I think that was possible in somewhat older versions of Pascal-like > languages too (like old Delphi versions, an

Re: multiprocessing.sharedctypes and built-in locks

2009-03-16 Thread Ahmad Syukri b
On Mar 16, 5:19 pm, Aaron Brady wrote: > It's not one of the guarantees that Python > makes.  Operations aren't atomic by default, such as unless stated > otherwise.   Well, in the documentation for RawArray: "Note that setting and getting an element is potentially non-atomic – use Array() instea

Re: switch to interactive mode

2009-03-16 Thread nntpman68
Hi JBW. code.interact() does what I wanted. Great !!! Thanks N JBW wrote: On Mon, 16 Mar 2009 23:49:34 +0100, nntpman68 wrote: I'd like, that a python script can be started by just calling it (clicking on it), but that the script can decide to enter interactive mode if certain conditio

Re: switch to interactive mode

2009-03-16 Thread Mike Driscoll
On Mar 16, 5:49 pm, nntpman68 wrote: > Hi > > I know about two ways to enter python interactive mode > > 1.) just start python > > 2.) run python -i pythonscript.py > > What I am looking for is slightly different: > > I'd like, that a python script can be started by just calling it > (clicking on

Re: Style question - defining immutable class data members

2009-03-16 Thread Rhodri James
On Mon, 16 Mar 2009 09:31:59 -, Aaron Brady wrote: [snippety snip] Otherwise, either /1, every instance has its own entries for class functions, and subsequent changes to the class don't affect existing instances, or /2, every method call is of the form x.__class__.foo ( ). They're both b

Re: switch to interactive mode

2009-03-16 Thread JBW
On Mon, 16 Mar 2009 23:49:34 +0100, nntpman68 wrote: > I'd like, that a python script can be started by just calling it > (clicking on it), > > but that the script can decide to enter interactive mode if certain > conditions occur. > > Is this possible? Don't know about the clicky-clicky part,

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-16 Thread MRAB
Rhodri James wrote: On Mon, 16 Mar 2009 02:36:43 -, MRAB wrote: The field name can be an integer or an identifier, so the locale could be too, provided that you know where to look it up! financial = Locale(group_sep=",", grouping=[3]) print("my number is {0:10n:{fin}}".format(1

switch to interactive mode

2009-03-16 Thread nntpman68
Hi I know about two ways to enter python interactive mode 1.) just start python 2.) run python -i pythonscript.py What I am looking for is slightly different: I'd like, that a python script can be started by just calling it (clicking on it), but that the script can decide to enter interac

Re: error writing str to binary stream - fails in Python 3.0.1, works in 2.x

2009-03-16 Thread John Machin
On Mar 17, 9:29 am, "R. David Murray" wrote: > walle...@gmail.com wrote: > > On Mar 16, 4:10 pm, Benjamin Peterson wrote: > > >   gmail.com> writes: > > > > > self.out.write(b'BM') worked beautifully.  Now I also have a similar > > > > issue, for instance: > > > > self.out.write("%c" % y) is also

Re: error writing str to binary stream - fails in Python 3.0.1, works in 2.x

2009-03-16 Thread Scott David Daniels
R. David Murray wrote: ... Here is some example code that works: out=open('temp', "wb") out.write(b"BM") def write_int(out, n): bytesout=bytes(([n&255), (n>>8)&255, (n>>16)&255, (n>>24)&255]) out.write(bytesout) write_int(out, 125) or even: import struct

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-16 Thread Rhodri James
On Mon, 16 Mar 2009 02:36:43 -, MRAB wrote: The field name can be an integer or an identifier, so the locale could be too, provided that you know where to look it up! financial = Locale(group_sep=",", grouping=[3]) print("my number is {0:10n:{fin}}".format(1234567, fin=financia

ANN: eGenix pyOpenSSL Distribution 0.8.1-0.9.8j-1

2009-03-16 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix.com pyOpenSSL Distribution Version 0.8.1-0.9.8j-1 An easy to install and use repackaged distribution of the pyOpenSSL Python interfa

Re: Guidance on writing a top-like console

2009-03-16 Thread cgoldberg
> >> I am interested in writing an application that functions like a Unix > >> or Linux top in the way it displays data. > >> It should be command-line based but dynamically refreshing. also check out the source for "dstat". It is written in python and displays top-like information and more. It

Re: error writing str to binary stream - fails in Python 3.0.1, works in 2.x

2009-03-16 Thread R. David Murray
walle...@gmail.com wrote: > On Mar 16, 4:10 pm, Benjamin Peterson wrote: > >   gmail.com> writes: > > > > > > > > > self.out.write(b'BM') worked beautifully.  Now I also have a similar > > > issue, for instance: > > > self.out.write("%c" % y) is also giving me the same error as the other > > > sta

Re: Why does Python not return first line?

2009-03-16 Thread Falcolas
On Mar 15, 6:25 pm, Gilles Ganault wrote: > address = re_address.search(response) > if address: > address = address.group(1).strip() > > #Important! > for item in ["\t","\r"," "]: > address = address.replace(item,"") > As you found, your script works just f

Re: How to interface with C# without IronPython

2009-03-16 Thread Mudcat
On Mar 13, 8:37 pm, Christian Heimes wrote: > Chris Rebert wrote: > > Haven't used it, butPythonfor .NET sounds like it might be what you > > want:http://pythonnet.sourceforge.net/ > > I've done some development for and with PythonDotNET. It's definitely > the right thing. It works with .NET, Mono

Re: Problem: Terminal (OS X) window exits immediately on opening. & Solution.

2009-03-16 Thread Lou Pecora
Python wrote: On 16 mrt 2009, at 22:10, Lou Pecora wrote: why don't you just execute the script directly form the terminal? then you will be able to read all error messages... and you can delete all the files you want just my 2c Arno Because the shell process in the Terminal window would

Re: error writing str to binary stream - fails in Python 3.0.1, works in 2.x

2009-03-16 Thread Terry Reedy
walle...@gmail.com wrote: Thanks for the assist. One more question, please. self.out.write(b'BM') worked beautifully. Now I also have a similar issue, for instance: self.out.write("%c" % y) is also giving me the same error as the other statement did. I tried self.out.write(bytes("%c" %y),

Re: error writing str to binary stream - fails in Python 3.0.1, works in 2.x

2009-03-16 Thread wallenpb
On Mar 16, 4:10 pm, Benjamin Peterson wrote: >   gmail.com> writes: > > > > > self.out.write(b'BM') worked beautifully.  Now I also have a similar > > issue, for instance: > > self.out.write("%c" % y) is also giving me the same error as the other > > statement did. > > I tried self.out.write(bytes

Re: Problem: Terminal (OS X) window exits immediately on opening. & Solution.

2009-03-16 Thread Lou Pecora
In article , Python wrote: > > -- > why don't you just execute the script directly form the terminal? > then you will be able to read all error messages... > and you can delete all the files you want > > just my 2c > > Arno Because the shell process in the Terminal window would exit right aft

Re: Problem: Terminal (OS X) window exits immediately on opening. & Solution.

2009-03-16 Thread Python
On 16 mrt 2009, at 22:10, Lou Pecora wrote: why don't you just execute the script directly form the terminal? then you will be able to read all error messages... and you can delete all the files you want just my 2c Arno Because the shell process in the Terminal window would exit right a

Re: error writing str to binary stream - fails in Python 3.0.1, works in 2.x

2009-03-16 Thread Benjamin Peterson
gmail.com> writes: > > self.out.write(b'BM') worked beautifully. Now I also have a similar > issue, for instance: > self.out.write("%c" % y) is also giving me the same error as the other > statement did. > I tried self.out.write(bytes("%c" %y),encoding=utf-8) in an attempt to > convert to bytes

Re: How to add months to a date?

2009-03-16 Thread Scott David Daniels
So, I see nobody has seen fit to make the obvious joke. I will demonstrate my lack of restraint, by answering: The way to add months to a date is to begin by asking about your date's early childhood. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/p

Re: Problem: Terminal (OS X) window exits immediately on opening. & Solution.

2009-03-16 Thread Python
On 16 mrt 2009, at 18:21, Lou Pecora wrote: Since this happened with a Python script and some people here use OS X and Terminal to run scripts I thought this might be helpful. I recently ran into this problem using Terminal and found the solution. I thought those who use the Terminal in OS

Re: is there an easy way to parse a nested list ?

2009-03-16 Thread Stef Mientki
thanks Aaron, Paul and Vlastimil, sorry I phrased my question wrong, I was looking for parsing an expression of an element of a nested list the code below seems to do what I'm looking for. cheers, Stef Aaron Brady wrote: On Mar 15, 6:44 pm, Stef Mientki wrote: hello, I need to parse a ne

Re: Pycon Spam

2009-03-16 Thread python
Andrew, I'm on a lot of Python (and Python related) mailing lists and haven't received a message like you described. Malcolm -- http://mail.python.org/mailman/listinfo/python-list

Re: error writing str to binary stream - fails in Python 3.0.1, works in 2.x

2009-03-16 Thread wallenpb
On Mar 16, 11:05 am, "R. David Murray" wrote: > walle...@gmail.com wrote: > > I am working with a bit of code that works ok in Python 2.x (tested > > fine in 2.5.4 and 2.6.1) but fails in 3.0.1. > > The code opens a file for binary output to witht the objective to > > produce a .bmp graphics file.

Pycon Spam

2009-03-16 Thread andrew cooke
Has anyone else received spam (unsolicited email) about PyCon 2009? I've just got an email from "Roy Hyunjin Han" <@columbia.edu> and as far as I can tell it's not associated with any list I've subscribed to. If it is spam I'm guessing the from address is fake (why would someone I don't know

Re: Lists aggregation

2009-03-16 Thread Mensanator
On Mar 16, 1:40 pm, Peter Otten <__pete...@web.de> wrote: > mattia wrote: > > I have 2 lists, like: > > l1 = [1,2,3] > > l2 = [4,5] > > now I want to obtain a this new list: > > l = [(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)] > > Then I'll have to transform the values found in the new list. > > Now, some

Re: print - bug or feature - concatenated format strings in a print statement

2009-03-16 Thread Scott David Daniels
bdb112 wrote: ... the difference between ... print(" %d, %d, buckle my shoe" % (1,2)) ... and ... print(" %d, " + " %d, buckle my shoe" % (1,2)) # a bug or a feature? A feature. a + b % c is a + (b % c) But do note that string constant concatentation is higher priority than the other ope

More copyright briefs

2009-03-16 Thread Scott David Daniels
On Groklaw, there is the motion filed by Harvard's Charles Nelson argues that "statutory damages for noncommercial defendants under copyright law are unconstitutional, unreasonable, and way out of proportion to any alleged injury to the plaintiffs." http://www.groklaw.net/article.php?story=200903

Re: String to sequence

2009-03-16 Thread S Arrowsmith
Peter Otten <__pete...@web.de> wrote: >assert s.startswith("[") >assert s.endswith("]") >s = s[1:-1] s.strip('[]') (I suppose it all depends on how much you can trust the consistency of the input.) -- \S under construction -- http://mail.python.org/mailman/listinfo/python-list

Re: Lists aggregation

2009-03-16 Thread Peter Otten
mattia wrote: > I have 2 lists, like: > l1 = [1,2,3] > l2 = [4,5] > now I want to obtain a this new list: > l = [(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)] > Then I'll have to transform the values found in the new list. > Now, some ideas (apart from the double loop to aggregate each element of > l1 with

Re: [ActivePython 2.5.1.1] Why does Python not return first line?

2009-03-16 Thread Scott David Daniels
Dennis Lee Bieber wrote: Teletypes, OTOH, really did use one character to advance the platen by a line, and a second to move the print-head to the left. (and may have needed "rub-out" characters to act as timing delays while the print-head moved) I remember writing a printer driver for a

Re: Lists aggregation

2009-03-16 Thread bearophileHUGS
mattia: > Now, some ideas (apart from the double loop to aggregate each element of > l1 with each element of l2): >>> from itertools import product >>> list(product([1,2,3], [4,5])) [(1, 4), (1, 5), (2, 4), (2, 5), (3, 4), (3, 5)] Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-

Re: Lists aggregation

2009-03-16 Thread Armin
On Monday 16 March 2009 15:07:06 mattia wrote: > I have 2 lists, like: > l1 = [1,2,3] > l2 = [4,5] > now I want to obtain a this new list: > l = [(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)] > Then I'll have to transform the values found in the new list. > Now, some ideas (apart from the double loop to agg

Lists aggregation

2009-03-16 Thread mattia
I have 2 lists, like: l1 = [1,2,3] l2 = [4,5] now I want to obtain a this new list: l = [(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)] Then I'll have to transform the values found in the new list. Now, some ideas (apart from the double loop to aggregate each element of l1 with each element of l2): - I want

Re: How to add months to a date (datetime object)?

2009-03-16 Thread Lorenzo
On Mar 15, 1:28 pm, tinn...@isbd.co.uk wrote: > I have a date in the form of a datetime object and I want to add (for > example) three months to it.  At the moment I can't see any very > obvious way of doing this.  I need something like:- > >     myDate = datetime.date.today() >     inc = datetime.

Problem: Terminal (OS X) window exits immediately on opening. & Solution.

2009-03-16 Thread Lou Pecora
Since this happened with a Python script and some people here use OS X and Terminal to run scripts I thought this might be helpful. I recently ran into this problem using Terminal and found the solution. I thought those who use the Terminal in OS X might be interested. The problem appeared sud

error writing str to binary stream - fails in Python 3.0.1, works in 2.x

2009-03-16 Thread R. David Murray
walle...@gmail.com wrote: > I am working with a bit of code that works ok in Python 2.x (tested > fine in 2.5.4 and 2.6.1) but fails in 3.0.1. > The code opens a file for binary output to witht the objective to > produce a .bmp graphics file. The code below illustrates the first of > several like

error writing str to binary stream - fails in Python 3.0.1, works in 2.x

2009-03-16 Thread wallenpb
I am working with a bit of code that works ok in Python 2.x (tested fine in 2.5.4 and 2.6.1) but fails in 3.0.1. The code opens a file for binary output to witht the objective to produce a .bmp graphics file. The code below illustrates the first of several like errors when a str object is attempte

Re: download x bytes at a time over network

2009-03-16 Thread Jean-Paul Calderone
On Mon, 16 Mar 2009 13:02:07 +0530, Saurabh wrote: I want to download content from the net - in chunks of x bytes or characters at a time - so that it doesnt pull the entire content in one shot. This isn't exactly how things work. The server *sends* you bytes. It can send you a lot at once.

Re: Encoding/decoding: Still don't get it :-/

2009-03-16 Thread Antoon Pardon
On 2009-03-13, Johannes Bauer wrote: > Peter Otten schrieb: > >> encoding = sys.stdout.encoding or "ascii" >> for row in rows: >> id, address = row[:2] >> print id, address.encode(encoding, "replace") >> >> Example: >> > u"ähnlich lölich üblich".encode("ascii", "replace") >> '?hnlich

2nd Call for Papers | Extended deadline: April 07 | CENTERIS'2009 - Conference on ENTERprise Information Systems | 2nd Call for Papers

2009-03-16 Thread CENTERIS'2009 - Conference on ENTERprise Information Systems
- Please consider contributing to and/or forwarding to the appropriate groups and peers the following call for papers. (please excuse us if you received this call more than once) - You are receiving this email because of your research activities on the conference topic. T

Re: how to identify the file system type of a drive?

2009-03-16 Thread Tim Golden
venutaurus...@gmail.com wrote: hi all, Is there any way to identify the File system type of a drive in python in Windows? Some thing like: C:\ -- NTFS D:\ -- FAT32.. import win32api import win32file def file_system (drive_letter): return win32api.GetVolumeInformation ( win32fil

Re: How to add months to a date (datetime object)?

2009-03-16 Thread Peter Pearson
On Sun, 15 Mar 2009 16:27:01 -0400, Roy Smith wrote: > In article , > Chris Rebert wrote: > >> Besides your behavior, one could equally well argue that a 31st repeat >> on months without a 31st should just be dropped, or that it should >> carry over onto the 1st of the next month (ignoring the c

Re: Guidance on writing a top-like console

2009-03-16 Thread Hyuga
On Feb 27, 6:08 pm, ntwrkd wrote: > I am interested in writing an application that functions like a Unix > or Linux top in the way it displays data. > It should be command-line based but dynamically refreshing. > > I'm not sure what I should take into account or how I might go about > implementing

Re: is there an easy way to parse a nested list ?

2009-03-16 Thread Paul McGuire
On Mar 16, 4:29 am, Vlastimil Brom wrote: > 2009/3/16 Vlastimil Brom : > > > > > 2009/3/16 Stef Mientki : > >> hello, > > >> I need to parse a nested list, given as a string, like this > > >> line = " A  [  B  [ C+2 ] + 3 ] " > > > ... > > >> thanks, > >> Stef > > > there is a "nestedExpr" (and pr

setattr() on "object" instance

2009-03-16 Thread R. David Murray
Sean DiZazzo wrote: > Why is it that you can setattr() on an instance of a class that > inherits from "object", but you can't on an instance of "object" > itself? > > >>> o = object() > >>> setattr(o, "x", 1000) > Traceback (most recent call last): > File "", line 1, in > AttributeError: 'obje

Re: setup.py install and bdist_egg

2009-03-16 Thread Hyuga
On Mar 13, 4:41 pm, Jasiu wrote: > Hey, > > I work at a company where I'm lucky enough to write web apps using > Python and WSGI :). We develop more and more stuff in Python and it's > becoming a mess of dependencies, so we thought we would create a > guideline for developers that describes the wh

Re: print - bug or feature - concatenated format strings in a print statement

2009-03-16 Thread R. David Murray
> On Mar 16, 5:00 pm, bdb112 wrote: > > #   is the difference between > > print(" %d,  %d, buckle my shoe" % (1,2)) > > #   and > > print(" %d, " + " %d, buckle my shoe" % (1,2)) > > # a bug or a feature? It is correct behavior. On the other hand, it is one of the, well, bugs, that is avoided by

Re: PyWin32 for Python 3.x

2009-03-16 Thread cgoldberg
> Release 213 is out already: Tim, Mark, this is great news.. thanks for tracking 3.x so closely. I big barrier for me to eventually adopt 3.x is the ability to use pywin32. thanks! -Corey -- http://mail.python.org/mailman/listinfo/python-list

how to identify the file system type of a drive?

2009-03-16 Thread venutaurus...@gmail.com
hi all, Is there any way to identify the File system type of a drive in python in Windows? Some thing like: C:\ -- NTFS D:\ -- FAT32.. so on.. Thank you, Venu Madhav. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to add months to a date (datetime object)?

2009-03-16 Thread Aahz
In article , John Machin wrote: >On Mar 16, 3:08=A0pm, a...@pythoncraft.com (Aahz) wrote: >> In article , >> Roy Smith =A0 wrote: Besides your behavior, one could equally well argue that a 31st repeat on months without a 31st should just be dropped, or that it should carry ove

Re: Upgrade Python on a Mac

2009-03-16 Thread Aahz
In article , Jorgen Grahn wrote: > >\begin{whine} > >Why is Python a "Framework" under "Libraries"? In any other Unix, a >third-party Python installation would have been placed in /usr/local/ >or /opt/. Also, editing a user's dotfiles while installing software >seems cruel and unusual -- to tha

Re: How to add months to a date (datetime object)?

2009-03-16 Thread tinnews
Ned Deily wrote: > In article <49bd42ac$0$512$bed64...@news.gradwell.net>, > tinn...@isbd.co.uk wrote: > > I was just hoping there was some calendar object in Python which could > > do all that for me (I need the handling of 31st and February etc.) > > Whatever your requirement, chances are date

Creating a 256 byte/block filesystem using FUSE in python

2009-03-16 Thread Sreejith K
Anyone got any idea of how to create a 256 byte/block filesystem using FUSE in python ? How to implement block level reads/writes instead of byte level reads/writes in fuse-python ? -- http://mail.python.org/mailman/listinfo/python-list

Re: A request (was: how to repeat function definitions less

2009-03-16 Thread Michele Simionato
On Mar 16, 8:08 am, Dennis Lee Bieber wrote: > On Sun, 15 Mar 2009 23:18:54 -0500, alex goretoy >         Many of your posts are actually exceeding the 500-line limit I've > set in my client for down-load -- yet have nothing worthy of 500 lines! Could this be the reason why I cannot see his messa

Re: Encoding/decoding: Still don't get it :-/

2009-03-16 Thread Gilles Ganault
On Fri, 13 Mar 2009 14:24:52 +0100, Peter Otten <__pete...@web.de> wrote: >It seems the database gives you the strings as unicode. When a unicode >string is printed python tries to encode it using sys.stdout.encoding >before writing it to stdout. As you run your script on the windows commmand >line

Re: Style question - defining immutable class data members

2009-03-16 Thread Aaron Brady
On Mar 15, 9:54 pm, "Rhodri James" wrote: > On Sun, 15 Mar 2009 23:26:04 -, Aaron Brady   > wrote: > > > > > > > On Mar 15, 1:50 pm, "Rhodri James" > > wrote: > >> On Sun, 15 Mar 2009 17:55:25 -, Aaron Brady   > >> wrote: > > >> > On Mar 15, 12:39 pm, John Posner wrote: > >> >> (My apo

Re: is there an easy way to parse a nested list ?

2009-03-16 Thread Vlastimil Brom
2009/3/16 Vlastimil Brom : > 2009/3/16 Stef Mientki : >> hello, >> >> I need to parse a nested list, given as a string, like this >> >> line = " A  [  B  [ C+2 ] + 3 ] " >> > ... >> >> thanks, >> Stef >> > > there is a "nestedExpr" (and probably other options, I'm not aware of ...:-) > ... > regard

Re: print - bug or feature - concatenated format strings in a print statement

2009-03-16 Thread alex goretoy
> > print(10 + 20 % 7) > a bug or a feature? It is a feature print ((10+20) % 7) -Alex Goretoy http://www.goretoy.com -- http://mail.python.org/mailman/listinfo/python-list

Re: setattr() on "object" instance

2009-03-16 Thread Duncan Booth
Ahmad Syukri b wrote: > On Mar 16, 1:21 pm, Sean DiZazzo wrote: >> Why is it that you can setattr() on an instance of a class that >> inherits from "object", but you can't on an instance of "object" >> itself? >> >> >>> o = object() >> >>> setattr(o, "x", 1000) >> >> Traceback (most recent call

Re: PyPy Progress (and Psyco)

2009-03-16 Thread James Matthews
Everything starts out small. I am sure that things will grow if there is a demand for it... On Mon, Mar 16, 2009 at 5:55 AM, JanC wrote: > andrew cooke wrote: > > > Fuzzyman wrote: > >> On Mar 15, 3:46 pm, Gerhard Häring wrote: > > [...] > >>> Me too. I doubt it, though. From an outside view, t

Re: VMware and pywin32 error...

2009-03-16 Thread James Matthews
The issue seems to be with your windows installation. Try getting another copy etc... There shouldn't be any issues I have tried and used both seamlessly On Mon, Mar 16, 2009 at 7:55 AM, dash dot <""wernermerkl\"@fujitsu(dash) siemens.com"> wrote: > Joshua Kugler schrieb: > >> dot wrote: >> >>> h

Re: is there an easy way to parse a nested list ?

2009-03-16 Thread Aaron Brady
On Mar 15, 6:44 pm, Stef Mientki wrote: > hello, > > I need to parse a nested list, given as a string, like this > > line = " A  [  B  [ C+2 ] + 3 ] " > > ( I probably can do it with find, but I guess that's not the most > elegant way, besides recusrion is not my strongest point) > > which should

Re: print - bug or feature - concatenated format strings in a print statement

2009-03-16 Thread John Machin
On Mar 16, 7:00 pm, bdb112 wrote: > #   is the difference between > print(" %d,  %d, buckle my shoe" % (1,2)) > #   and > print(" %d, " + " %d, buckle my shoe" % (1,2)) > # a bug or a feature? Here's a question for you: Is the difference between print(30 % 7) and print(10 + 20 % 7) a bug or

Re: multiprocessing.sharedctypes and built-in locks

2009-03-16 Thread Aaron Brady
On Mar 15, 11:42 pm, Ahmad Syukri b wrote: > On Mar 15, 6:19 am, Aaron Brady wrote: > > > > > Your code hung on my machine.  The call to 'main()' should be in an > > 'if __name__' block: > > > if __name__== '__main__': > >     main() > > > Is it possible you are just seeing the effects of the non

Re: is there an easy way to parse a nested list ?

2009-03-16 Thread Vlastimil Brom
2009/3/16 Stef Mientki : > hello, > > I need to parse a nested list, given as a string, like this > > line = " A  [  B  [ C+2 ] + 3 ] " > ... > > thanks, > Stef > Hi, I guess, you can use e.g. pyparsing; there is a "nestedExpr" (and probably other options, I'm not aware of ...:-) Check the example

Re: print - bug or feature - concatenated format strings in a print statement

2009-03-16 Thread bdb112
#whoops, the first output is actually 1, 2, buckle my shoe # in case it wasn't obvious On Mar 16, 5:00 pm, bdb112 wrote: > #   is the difference between > print(" %d,  %d, buckle my shoe" % (1,2)) > #   and > print(" %d, " + " %d, buckle my shoe" % (1,2)) > # a bug or a feature? > > First ou

print - bug or feature - concatenated format strings in a print statement

2009-03-16 Thread bdb112
# is the difference between print(" %d, %d, buckle my shoe" % (1,2)) # and print(" %d, " + " %d, buckle my shoe" % (1,2)) # a bug or a feature? First output ... print(" %d " + " %d, buckle my shoe" % (1,2)) Second output TypeError: not all arguments converted during string formatting Versio

Re: tkinter: loading file before entering mainloop

2009-03-16 Thread Eric Brunel
Peter Billam wrote: >> Peter Billam wrote: >> window = MainWindow(application) >> if (len(sys.argv) > 1) and os.path.exists(sys.argv[1]): >> window.loadFile(sys.argv[1]) >> application.mainloop() >> File "./midimix", line 465, in loadFile >> space0.grid(row=grid_row, >> pady=

Re: tkinter: loading file before entering mainloop

2009-03-16 Thread Peter Billam
Peter Billam wrote: >> They're multiplied up from >> canvas_height = self.canvas.winfo_height() >> so I guess mainloop already think it's idle, while grid is still >> taking 10ms to work out what goes where. On 2009-03-15, John McMonagle wrote: > You need to query the requested width and heigh

download x bytes at a time over network

2009-03-16 Thread Saurabh
I want to download content from the net - in chunks of x bytes or characters at a time - so that it doesnt pull the entire content in one shot. import urllib2 url = "http://python.org/"; handler = urllib2.urlopen(url) data = handler.read(100) print """Content :\n%s \n%s \n%s""" % ('=' * 100, data

Re: A request (was: how to repeat function definitions less

2009-03-16 Thread alex goretoy
sorry, I'll try to keep it cool -Alex Goretoy http://www.goretoy.com On Mon, Mar 16, 2009 at 2:08 AM, Dennis Lee Bieber wrote: > On Sun, 15 Mar 2009 23:18:54 -0500, alex goretoy > declaimed the following in > gmane.comp.python.general: > > > what is I just set > > "colors": self.opt['arg_opts_

Flags in fuse python

2009-03-16 Thread Sreejith K
Hi, I'm writing a file system under fuse-python. The main problem I'm facing now is that the flags which are provided by the fuse module when r/w are called, are screwing up the situation. I wrote a file class for fuse as shown below. class FlusterFile(object): def __init__(self,