Re: -1/2

2008-06-22 Thread Terry Reedy
Serve Lau wrote: What is the expected result of -1/2 in python? Python 3.0b1 (r30b1:64403M, Jun 19 2008, 14:56:09) [MSC v.1500 32 bit (Intel)] n win32 Type "help", "copyright", "credits" or "license" for more information. >>> -1/2 -0.5 as expected ;-) -1//2 is as Gary Herron specified from

Re: Trying to Learn Packages

2008-06-22 Thread Saul Spatz
Cédric Lucantis wrote: Le Sunday 22 June 2008 16:07:37 Saul Spatz, vous avez écrit : Hi, I'm making a project into my first package, mainly for organization, but also to learn how to do it. I have a number of data files, both experimental results and PNG files. My project is organized as a ro

Re: rightclick-copy in IDLE?

2008-06-22 Thread Miki
> when i rightclick in python idle i get set breakpoint or something. > > n options i dont find a way to change to the normal copy/paste options. Under "Preferences ..." menu you'll find "Keys" tab, there you can change the keys bindings to whatever you want. HTH, -- Miki <[EMAIL PROTECTED]> http:

POP3_SSL Error

2008-06-22 Thread Roopesh
Hi, While using poplib to fetch mails from my gmail account, I am getting the following error: Exception is POP3_SSL instance has no attribute 'sslobj' Can anyone tell me what this error means. Thanks and Regards Roopesh -- http://mail.python.org/mailman/listinfo/python-list

Re: Learning Python in a group

2008-06-22 Thread Mensanator
On Jun 22, 5:43�am, "Jonathan Roberts" <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm looking to learn Python (as my first programming language) and I'm > pretty sure I'd be more successful doing this with a group of other > people. > > I've currently got one other person to learn with me, and we pla

Re: Bind compiled code to name?

2008-06-22 Thread Giuseppe Ottaviano
class D:pass d = D() exec source_code in d.__dict__ print d.some_name Notice that this will also give you d.__builtins__, which you might want to del afterwards. If you want to mimic an import you can also do this: import types D = types.ModuleType('D') exec source_code in D.__dict__ print D.

Re: Tkinter canvas drag/drop obstacle

2008-06-22 Thread Simon Forman
On Jun 22, 7:41 pm, Peter Pearson <[EMAIL PROTECTED]> wrote: > On Fri, 20 Jun 2008 13:41:35 -0300, Guilherme Polo <[EMAIL PROTECTED]> wrote: > > On Fri, Jun 20, 2008 at 1:11 PM, Peter Pearson <[EMAIL PROTECTED]> wrote: > >> Tkinter makes it very easy to drag jpeg images around on a > >> canvas, but

Re: An idiom for code generation with exec

2008-06-22 Thread eliben
Thanks for all the replies in this post. Just to conclude, I want to post a piece of code I wrote to encapsulate function creation in this way: def create_function(code): """ Create and return the function defined in code. """ m = re.match('\s*def\s+([a-zA-Z_]\w*)\s*\(', code) if m

Re: Learning Python in a group

2008-06-22 Thread Satya Kiran
You can count me in too.I've been into python for sometime now. I agree that a collaborative learning makes it fun and helps you reach your goal faster. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pattern Matching Over Python Lists

2008-06-22 Thread eliben
> Fair enough. To help you understand the method I used, I'll give you > this hint. It's true that regex on works on strings. However, is there > any way to convert arbitrarily complex data structures to string > representations? You don't need to be an experienced Python user to > answer to this ;

Re: Pattern Matching Over Python Lists

2008-06-22 Thread Chris
On Jun 19, 9:03 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Jun 20, 10:45 am, Chris <[EMAIL PROTECTED]> wrote: > > > On Jun 17, 1:09 pm, [EMAIL PROTECTED] wrote: > > > > Kirk Strauser: > > > > > Hint: recursion. Your general algorithm will be something like: > > > > Another solution is to use

Re: Tkinter canvas drag/drop obstacle

2008-06-22 Thread Peter Pearson
On Fri, 20 Jun 2008 13:41:35 -0300, Guilherme Polo <[EMAIL PROTECTED]> wrote: > On Fri, Jun 20, 2008 at 1:11 PM, Peter Pearson <[EMAIL PROTECTED]> wrote: >> Tkinter makes it very easy to drag jpeg images around on a >> canvas, but I would like to have a "target" change color when >> the cursor drag

Re: Fast and easy GUI prototyping with Python

2008-06-22 Thread Michael Torrie
Pete Kirkham wrote: > 2008/6/21 Val-Amart <[EMAIL PROTECTED]>: > >> Use PyQt. You will gain great portability +all the functionality built >> in qt. >> You can try PyGTK also, though i wont recommend it. >> > Why would you not recommend it? I've been using it for a mall project, and > would like t

Re: -1/2

2008-06-22 Thread [EMAIL PROTECTED]
On Jun 22, 2:32 pm, "Serve Lau" <[EMAIL PROTECTED]> wrote: > What is the expected result of -1/2 in python? I would say -1, but it depends on whether the "-" is a unary minus. >>> -1/2 -1 >>> 3 -1/2 3 -- http://mail.python.org/mailman/listinfo/python-list

Re: binary number format ? format character %b or similar.

2008-06-22 Thread Mensanator
On Jun 22, 4:07�pm, Ken Starks <[EMAIL PROTECTED]> wrote: > weheh wrote: > > I don't know if you found this example: > >http://www.daniweb.com/code/snippet285.html > > Thanks for that. The offerings are very similar to the > algorithms I wrote myself. > > It wasn't the solution I was after,really;

Re: Learning Python: Code critique please

2008-06-22 Thread William McBrine
On Sun, 22 Jun 2008 08:44:25 -0500, Saul Spatz wrote: > macoovacany wrote: >> http://macoovacany.wordpress.com/ > When I tried to run it, I got all kinds of syntax errors because of > non-ASCII characters; namely, you have fancy left and right single and > double quotes. That's probably WordPress

Re: listcomprehension, add elements?

2008-06-22 Thread John Machin
On Jun 23, 9:23 am, Paul Hankin <[EMAIL PROTECTED]> wrote: > On Jun 23, 10:32 am, cirfu <[EMAIL PROTECTED]> wrote: > > > [a+b for a,b in zip(xrange(1,51), xrange(50,0,-1))] > > > [51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, > > 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,

Re: listcomprehension, add elements?

2008-06-22 Thread Paul Hankin
On Jun 23, 10:32 am, cirfu <[EMAIL PROTECTED]> wrote: > [a+b for a,b in zip(xrange(1,51), xrange(50,0,-1))] > > [51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, > 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, > 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51

Re: listcomprehension, add elements?

2008-06-22 Thread Jeff
On Jun 22, 6:32 pm, cirfu <[EMAIL PROTECTED]> wrote: > [a+b for a,b in zip(xrange(1,51), xrange(50,0,-1))] > > [51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, > 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, > 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,

listcomprehension, add elements?

2008-06-22 Thread cirfu
[a+b for a,b in zip(xrange(1,51), xrange(50,0,-1))] [51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51] i want to add all the elemtns a s well. can

rightclick-copy in IDLE?

2008-06-22 Thread cirfu
when i rightclick in python idle i get set breakpoint or something. n options i dont find a way to change to the normal copy/paste options. -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting column names from a cursor using ODBC module?

2008-06-22 Thread dananrg
Thanks Chris and John. Chris, this worked perfectly with the ODBC module that ships with Python Win32: > column_names = [d[0] for d in cursor.description] John, I've never heard of pyodbc but I'll have to look into it. Thanks again. Dana -- http://mail.python.org/mailman/listinfo/python-list

Regular expression problem

2008-06-22 Thread abranches
Hello everyone. I'm having a problem when extracting data from HTML with regular expressions. This is the source code: You are ready in the next12M 48S And I need to get the remaining time. Until here, isn't a problem getting it, but if the remaining time is less than 60 seconds then the source

Re: binary number format ? format character %b or similar.

2008-06-22 Thread Ken Starks
weheh wrote: I don't know if you found this example: http://www.daniweb.com/code/snippet285.html Thanks for that. The offerings are very similar to the algorithms I wrote myself. It wasn't the solution I was after,really; that's easy. It was whether anything had found its way into the standa

ImportError: cannot import name QtCore. using PyInstaller.1-3 and PyQt4 and Python 2.5

2008-06-22 Thread asoft
Please i need help with this. I just started using python and i hace run into several issues. The on that i can't tackle is the issue of no being able to compile the python code using PyQt4 application It gives the error ImportError: cannot import name QtCore. . I tries the trunk from the snv, but

Re: Learning Python in a group

2008-06-22 Thread AngelinaCarmen
I would like to be a part of this if enough people are able to join up, I nabbed python less than two days ago, and have been trying to absorb as much as I can out of websites and practice projects. Learning this together would speed up the process slightly because we could share tips and such, all

Re: Bind compiled code to name?

2008-06-22 Thread Martin v. Löwis
>> d = {} >> exec source_code in d >> some_name = d['some_name'] > > This works quite well! I can't believe after googling for half on hour I > didn't notice this "exec ... in ..." syntax. > One more thing though, is there a way to access "some_name" as a > attribute, instead as a dictionary: >

Re: binary number format ? format character %b or similar.

2008-06-22 Thread weheh
I don't know if you found this example: http://www.daniweb.com/code/snippet285.html -- > I'm was wanting to format a positive integer in binary, > and not finding it--to my surprise--I rolled my own version. > > Is this already in python, or have I missed it somewhere? > > I have Googled around

Re: Way to unblock sys.stdin.readline() call

2008-06-22 Thread joamag
On Jun 21, 11:34 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > joamag wrote: > > Is there any possible way to unblock the sys.stdin.readline() call > > from a different thread. > > If you want the thread to do something 'else' when no input is > available, would this work?  Put readline in a thread

Re: An idiom for code generation with exec

2008-06-22 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > On 20 juin, 21:44, eliben <[EMAIL PROTECTED]> wrote: ... >> The generic version has to make a lot of decisions at runtime, based >> on the format specification. >> Extract the offset from the spec, extract the length. ... ... > Just my 2 cents. Truth is that as long as i

binary number format ? format character %b or similar.

2008-06-22 Thread Ken Starks
I'm was wanting to format a positive integer in binary, and not finding it--to my surprise--I rolled my own version. Is this already in python, or have I missed it somewhere? I have Googled around a bit, and found a few threads on the subject, but they all seem to fizzle out. (e.g. : INPUT 35,

pyTTS says, '"SAPI" not supported'

2008-06-22 Thread weheh
I'm running Python 2.3 and calling pyTTS. I've had it working forever. Today, I ran out of disk space. After deleting some of my personal files, for no apparent reason, pyTTS no longer runs. For the statement tts = pyTTS.Create() I get the error message: ValueError: "SAPI" not

Re: -1/2

2008-06-22 Thread Gary Herron
Christian Heimes wrote: Serve Lau wrote: What is the expected result of -1/2 in python? 0 No. That's not right. (It would be in C/C++ and many other languages.) See my other response for the correct answer. Gary Herron Christian -- http://mail.python.org/mailman/listinfo

Re: -1/2

2008-06-22 Thread Gary Herron
Serve Lau wrote: What is the expected result of -1/2 in python? -- http://mail.python.org/mailman/listinfo/python-list From the manual: The result is always rounded towards minus infinity: 1/2 is 0, (-1)/2 is -1, 1/(-2) is -1, and (-1)/(-2) is 0. Gary Herron -- http://mail.python.org/mai

Re: -1/2

2008-06-22 Thread Christian Heimes
Serve Lau wrote: > What is the expected result of -1/2 in python? 0 Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: Bind compiled code to name?

2008-06-22 Thread Karlo Lozovina
"Martin v. Löwis" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > d = {} > exec source_code in d > some_name = d['some_name'] This works quite well! I can't believe after googling for half on hour I didn't notice this "exec ... in ..." syntax. One more thing though, is there a way to acc

Re: Storing value with limits in object

2008-06-22 Thread Josip
> I bet you didn't even try this, unless your definition of "works" > includes a "RuntimeError: maximum recursion depth exceeded". Here's a > a working version: Actually, the version I'm using is somewhat bigger. I removed docstrings and recklessly stripped away some methods to make it shorter con

Re: pyHook and py2exe

2008-06-22 Thread jim-on-linux
On Sunday 22 June 2008 10:40, Gandalf wrote: > hi every one. > I have program which uses this pyHook lib, and when > I try to compile it using py2exe the pyhook don't > work. it gives me no error. the program works fine > beside the function of this lib. why does it append > ? > > is their any solu

Re: Bind compiled code to name?

2008-06-22 Thread Martin v. Löwis
> If string `source_code` contains Python source code, how can I execute > that code, and bind it to some name? I tried compiling with: > > code_object = compile(source_code, 'errorfile', 'exec') > > but then what to do with `code_object`? > > P.S. > If my intentions aren't that clear, thi

-1/2

2008-06-22 Thread Serve Lau
What is the expected result of -1/2 in python? -- http://mail.python.org/mailman/listinfo/python-list

Re: install py2exe in vista

2008-06-22 Thread jim-on-linux
On Saturday 21 June 2008 13:28, Herman wrote: > I want to install it in > vistal#>, but i get this message in the process: > could not create... py2exe-py2.5 I forwarded your question but you may want to ask again at the link below. [EMAIL PROTEC

Re: Storing value with limits in object

2008-06-22 Thread Josip
> Why not make it a function? > > function assignLimited(value, vmin, vmax): > value = max(vmin, value) > value = min(vmax, value) > return value > > > a = assignLimited(7, 0, 10) > > > Seems like it solves your problem relatively cleanly. > Note: I also removed min/max variables becaus

Re: Storing value with limits in object

2008-06-22 Thread Josip
> Why not make it a function? > > function assignLimited(value, vmin, vmax): > value = max(vmin, value) > value = min(vmax, value) > return value > > > a = assignLimited(7, 0, 10) > > > Seems like it solves your problem relatively cleanly. > Note: I also removed min/max variables becaus

Bind compiled code to name?

2008-06-22 Thread Karlo Lozovina
If string `source_code` contains Python source code, how can I execute that code, and bind it to some name? I tried compiling with: code_object = compile(source_code, 'errorfile', 'exec') but then what to do with `code_object`? P.S. If my intentions aren't that clear, this is what I'm tryi

Re: Learning Python in a group

2008-06-22 Thread oesoriano
I might be interested in joining your group. I'm trying to learn python, too, but tend to get frustrated by the isolation. can you send me, or post, some details? - O -- http://mail.python.org/mailman/listinfo/python-list

Re: Learning Python in a group

2008-06-22 Thread George Oliver
On Jun 22, 3:43 am, "Jonathan Roberts" <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm looking to learn Python (as my first programming language) and I'm > pretty sure I'd be more successful doing this with a group of other > people. hi Jon, I'm in the same situation as you and think a co-op method o

Re: Web Crawler - Python or Perl?

2008-06-22 Thread subeen
On Jun 13, 1:26 am, Chuck Rhode <[EMAIL PROTECTED]> wrote: > On Mon, 09 Jun 2008 10:48:03 -0700, disappearedng wrote: > > I knowPythonbut notPerl, and I am interested in knowing which of > > these two are a better choice. > > I'm partial to *Python*, but, the last time I looked, *urllib2* didn't >

Re: Learning Python in a group

2008-06-22 Thread Jonathan Roberts
> I'm sure that many (myself included) would be happy to help out, but > due to timezone differences, working hours, etc you may only get > responses up to 24 hours (or more) later. Awesome, heh I'm sure we'll have questions for the list in good time :) > > What needs does your (non-face-to-face)

Re: My n00bie brain hurts after "Python setup.py install".

2008-06-22 Thread John Nagle
John Machin wrote: On Jun 22, 9:05 am, [EMAIL PROTECTED] wrote: I downloaded Mark Pilgrims's feedparser.py in a zipfile to my Windows machine, unzipped it and tried to install it to no avail. Eggs are part of a new experimental package distribution scheme. Don't worry about it. Yes. "Eg

Re: Trying to Learn Packages

2008-06-22 Thread Cédric Lucantis
Le Sunday 22 June 2008 16:07:37 Saul Spatz, vous avez écrit : > Hi, > > I'm making a project into my first package, mainly for organization, but > also to learn how to do it. I have a number of data files, both > experimental results and PNG files. My project is organized as a root > directory, w

Re: Trying to Learn Packages

2008-06-22 Thread David
On Sun, Jun 22, 2008 at 4:07 PM, Saul Spatz <[EMAIL PROTECTED]> wrote: > Hi, > > I'm making a project into my first package, mainly for organization, but > also to learn how to do it. I have a number of data files, both > experimental results and PNG files. My project is organized as a root > dir

Re: QTableWidget non editable

2008-06-22 Thread Antonio Valentino
On 22 Giu, 17:11, Antonio Valentino <[EMAIL PROTECTED]> wrote: > Ciao a tutti, > ho un QTableWidget che ho reso non editabile settando editTriggers a > NoEditTriggers. > > Il problema è che adesso non posso selezionare una cela e copiarne il > contenuto nella clipboard. > > Come posso risolvere il

Re: Getting column names from a cursor using ODBC module?

2008-06-22 Thread Michael Mabin
The pyodb module doesn't implement this behavior. You would have to create a dictionary of column positions and column names in advance. On Sat, Jun 21, 2008 at 3:52 PM, Chris <[EMAIL PROTECTED]> wrote: > On Jun 21, 3:58 pm, [EMAIL PROTECTED] wrote: > > Is there any way to retrieve column names

[PyQt4] QTableWidget non editable

2008-06-22 Thread Antonio Valentino
Ciao a tutti, ho un QTableWidget che ho reso non editabile settando editTriggers a NoEditTriggers. Il problema è che adesso non posso selezionare una cela e copiarne il contenuto nella clipboard. Come posso risolvere il problema? Grazie in anticipo antonio -- http://mail.python.org/mailman/list

Re: How to convert a ">" into a >

2008-06-22 Thread dominique
On Jun 22, 6:45 am, Tim Roberts <[EMAIL PROTECTED]> wrote: > dominique <[EMAIL PROTECTED]> wrote: > >On Jun 21, 1:37 pm, John Machin <[EMAIL PROTECTED]> wrote: > > >> Look at the operator module. In your above example: > > >> return { > >>'>': operator.gt, > >>'=': operator.eq, > >>'<':

pyHook and py2exe

2008-06-22 Thread Gandalf
hi every one. I have program which uses this pyHook lib, and when I try to compile it using py2exe the pyhook don't work. it gives me no error. the program works fine beside the function of this lib. why does it append ? is their any solution? I would be glad to know if anyone ever experienced thi

Trying to Learn Packages

2008-06-22 Thread Saul Spatz
Hi, I'm making a project into my first package, mainly for organization, but also to learn how to do it. I have a number of data files, both experimental results and PNG files. My project is organized as a root directory, with two subdirectories, src and data, and directory trees below them.

Re: Storing value with limits in object

2008-06-22 Thread Larry Bates
Josip wrote: I'm trying to limit a value stored by object (either int or float): class Limited(object): def __init__(self, value, min, max): self.min, self.max = min, max self.n = value def set_n(self,value): if value < self.min: # boundary check self.

Re: Learning Python: Code critique please

2008-06-22 Thread Saul Spatz
macoovacany wrote: http://macoovacany.wordpress.com/ When I tried to run it, I got all kinds of syntax errors because of non-ASCII characters; namely, you have fancy left and right single and double quotes. Once I replaced these with the ASCII equivalents, it worked fine. I suggest you use a

Re: Storing value with limits in object

2008-06-22 Thread George Sakkis
On Jun 22, 5:44 am, "Josip" <[EMAIL PROTECTED]> wrote: > I'm trying to limit a value stored by object (either int or float): > > class Limited(object): > def __init__(self, value, min, max): > self.min, self.max = min, max > self.n = value > def set_n(self,value): >

Re: Learning Python in a group

2008-06-22 Thread David
On Sun, Jun 22, 2008 at 1:52 PM, Jonathan Roberts <[EMAIL PROTECTED]> wrote: >> If you want people to meet with you (in person) as a mentor you should >> probably ask on your local Python or Linux users group mailing list. > > We're not really too worried about doing it in person - mostly because >

Re: Learning Python in a group

2008-06-22 Thread Jonathan Roberts
> If you want people to meet with you (in person) as a mentor you should > probably ask on your local Python or Linux users group mailing list. We're not really too worried about doing it in person - mostly because the people doing it so far are all at least 1000 miles away from each other :) Bes

Re: Storing value with limits in object

2008-06-22 Thread Josip
> In theory you could hack Python's internal locals or globals > dictionary so that it did something unusual while looking up your > object. But in practice this doesn't work, because the returned > objects (when you call globals() or locals()) attributes are readonly. > Probably because those inte

Re: Learning Python in a group

2008-06-22 Thread David
On Sun, Jun 22, 2008 at 12:43 PM, Jonathan Roberts <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm looking to learn Python (as my first programming language) and I'm > pretty sure I'd be more successful doing this with a group of other > people. > > I've currently got one other person to learn with me

Re: Fast and easy GUI prototyping with Python

2008-06-22 Thread Pete Kirkham
2008/6/21 Val-Amart <[EMAIL PROTECTED]>: > Use PyQt. You will gain great portability +all the functionality built > in qt. > You can try PyGTK also, though i wont recommend it. > Why would you not recommend it? I've been using it for a mall project, and would like to know if there's some pit waiti

Re: Storing value with limits in object

2008-06-22 Thread David
On Sun, Jun 22, 2008 at 12:24 PM, Josip <[EMAIL PROTECTED]> wrote: >> Not with normal vars, because = is a rebinding operator in Python, >> rather than assignment. >> >> You can do (close to) the above with object properties. >> >> David. > > Yes, but it's done with built-in types like int and floa

Re: Learning Python in a group

2008-06-22 Thread Henry Read
I'm a beginner, too.But python wasn't my first programming language. On Sun, Jun 22, 2008 at 6:43 PM, Jonathan Roberts <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm looking to learn Python (as my first programming language) and I'm > pretty sure I'd be more successful doing this with a group of ot

Learning Python in a group

2008-06-22 Thread Jonathan Roberts
Hi all, I'm looking to learn Python (as my first programming language) and I'm pretty sure I'd be more successful doing this with a group of other people. I've currently got one other person to learn with me, and we plan to work remotely over the net using tools such as IM/VoiP/Gobby/WIkis etc. W

Re: Storing value with limits in object

2008-06-22 Thread Josip
> Not with normal vars, because = is a rebinding operator in Python, > rather than assignment. > > You can do (close to) the above with object properties. > > David. Yes, but it's done with built-in types like int and float. I suspect I could subclass from them and implement limits, but I would h

Re: Storing value with limits in object

2008-06-22 Thread David
On Sun, Jun 22, 2008 at 11:44 AM, Josip <[EMAIL PROTECTED]> wrote: > I'm trying to limit a value stored by object (either int or float): > > class Limited(object): >def __init__(self, value, min, max): >self.min, self.max = min, max >self.n = value >def set_n(self,value): >

Storing value with limits in object

2008-06-22 Thread Josip
I'm trying to limit a value stored by object (either int or float): class Limited(object): def __init__(self, value, min, max): self.min, self.max = min, max self.n = value def set_n(self,value): if value < self.min: # boundary check self.n = self.min

Re: Fast and easy GUI prototyping with Python

2008-06-22 Thread Sebastian "lunar" Wiesner
Michael Torrie <[EMAIL PROTECTED]>: > [EMAIL PROTECTED] wrote: >> 2) The Qt vs. .NET API. I have no experience with Qt's API and a >> rudimentary experience with the .NET API (seems powerfull but also big >> and complex). > > Qt's API is very very good. Easy to use and extremely powerful. Note

Re: flock seems very unsafe, python fcntl bug?

2008-06-22 Thread Jens Henrik Leonhard Jensen
Your problem is that open(...,'w') is not locked. Use something like: lockf = open('aaa', 'a') fnctl.flock(lockf,fnctl.LOCK_EX) file = open('aaa', 'w') file.write('asdf') file.close() lockf.close() [EMAIL PROTECTED] wrote: I ran following 2 programs (lock1, lock2) at almost same time, to write

Ruby doctest

2008-06-22 Thread Paddy
I monitor changes to the Wikipedia doctest page, and so noticed a change in the Ruby implementation of doctest. Scooting around their implementation I found that they have an !!! special directive that says drop into the interpreter at this point when testing allowing debugging in context. http://