Re: Network game using mysql

2009-04-15 Thread Kushal Kumaran
2009/4/15 João Abrantes : > Good evening, > > I am making an online game that stores its data in a mysql database. The > thing is that I can't allow the players to interact directly with the > important tables of database (they could cheat if I give them access) so I > only allow them to write on a

Re: Beginner: Portable Python, BeautifulSoup & ScrapeNFeed

2009-04-15 Thread Brian
On Ubuntu: sudo apt-get install python-pyrss2gen python-beautifulsoup # download ScrapeNFeed Python: Not sure what's wrong with this but it's most of the code you'll need: --- from urllib import urlopen from BeautifulSoup import BeautifulSoup from PyRSS2Gen import RSSItem, Guid import Scr

Measuring time of a telnet connect

2009-04-15 Thread Fabian Lanze
Hi! I want to realize the following: I want to measure the time it takes to build up a telnet connection to a known host (ip/port). I tried to use subprocess.Popen to build the telnet connection and then to catch the "Trying to connect..." and "Connection established" output. But this didn't work

Re: Using Python after a few years of Ruby

2009-04-15 Thread Tim Hoffman
Hi For a rake alternative have a look at aap http://www.a-a-p.org/ It won't be a drop in replacement but, does provide similiar functionality ( i have used to drive delphi, visualstudio, borland c and bunch of other stuff build scripts to make a complete windows desktop app) and automagically bui

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-15 Thread M.-A. Lemburg
On 2009-04-15 02:32, P.J. Eby wrote: > At 10:59 PM 4/14/2009 +0200, M.-A. Lemburg wrote: >> You are missing the point: When breaking up a large package that lives in >> site-packages into smaller distribution bundles, you don't need namespace >> packages at all, so the PEP doesn't apply. >> >> The

Re: subprocess: reading from stdout hangs process termination, waiting for ENTER keyboard signal

2009-04-15 Thread giohappy
On 14 Apr, 18:52, MRAB wrote: > giohappywrote: > > Hello everyone. > > I'm trying to use subprocess module to launch a Windows console > > application. The application prints some results to standard output > > and then waits for the user to press any key to terminte. I can't > > control this beha

Re: Modifying the value of a float-like object

2009-04-15 Thread Peter Otten
[email protected] wrote: > Now, I would like to get the uncertainty on the result, even though we > have no idea of what quantities are used in lattice_spacing() for the > calculation (it can be attribute that are floats, attributes that are > FloatWithUncert, module globals defined

Re: Measuring time of a telnet connect

2009-04-15 Thread Jack diederich
On Wed, Apr 15, 2009 at 3:41 AM, Fabian Lanze wrote: > > I want to realize the following: I want to measure the time it takes to > build up a telnet connection to a known host (ip/port). I tried to use > subprocess.Popen to build the telnet connection and then to catch the > "Trying to connect..."

Re: Modifying the value of a float-like object

2009-04-15 Thread Eric . Le . Bigot
Ben F., you're right on the money! You expressed exactly what I'm looking for. Why should I want this? because the place in the code where (foo, baz) is calculated has _no idea_ of what foo and baz are, of where they were defined, etc.; on the other hand, the floatref class can keep track of the

Re: how to know argument name with which a function of extended c called

2009-04-15 Thread rahul
On Apr 14, 6:24 pm, John Machin wrote: > On Apr 14, 10:35 pm, rahul wrote: > > > Hi, > >   i need to write a 'c extension function' in this function i need to > > change argument value with  which this function called. > > The appropriate way for a function to give output is to return a > value,

json-rpc in Python

2009-04-15 Thread Roland Hedberg
Hi! Anyone got information on python implementations of JSON-RPC ? I'd like to run a jsonrpc server using mod_python in an Apache server. I know about, and have used for a while, Jan-Klaas Kollhof's implementation which used to be at http://json-rpc.org/, but isn't accessible anymore. The

Re: Measuring time of a telnet connect

2009-04-15 Thread Fabian Lanze
Jack diederich schrieb: Has anyone an idea how to solve this? import time import telnetlib start = time.time() conn = telnetlib.Telnet('localhost', 80) print time.time() - start Perfect! Thank you.. -- http://mail.python.org/mailman/listinfo/python-list

Python interpreters in threads crash the application

2009-04-15 Thread grbgooglefan
I have C application in which I have instantiated Python interpreter in each worker thread. When I start the program it crashes at different places in Python code but program never finishes normally. One such core dump is given below. Can you please help me in following queries? 1) Can we not us

Re: segmentation fault while using ctypes

2009-04-15 Thread Diez B. Roggisch
> > Thanks Diez, > > I used the gdb but it just crashed and kicked my out of gdb prompt. > how can I get a stack trace? That's odd, has never happened for me before. Can you show us what you do exactly, and what gdb & co say? Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Modifying the value of a float-like object

2009-04-15 Thread Dan Goodman
[email protected] wrote: Hello, Is there a way to easily build an object that behaves exactly like a float, but whose value can be changed? The goal is to maintain a list [x, y,…] of these float-like objects, and to modify their value on the fly (with something like x.value = 3.1

Re: how to know argument name with which a function of extended c called

2009-04-15 Thread John Machin
On Apr 15, 6:13 pm, rahul wrote: > On Apr 14, 6:24 pm, John Machin wrote: > > > > > On Apr 14, 10:35 pm, rahul wrote: > > > > Hi, > > >   i need to write a 'c extension function' in this function i need to > > > change argument value with  which this function called. > > > The appropriate way fo

Re: Modifying the value of a float-like object

2009-04-15 Thread Eric . Le . Bigot
To Peter: What I had in mind was to implement your calc() function; you could do something similar with your loop in the previous post by replacing "for f.shift..." by "f.shift = 1"; this would give you 2 values, which you can combine with your unused variable in order to obtain the same value as w

Something weird about re.finditer()

2009-04-15 Thread Gilles Ganault
Hello I stumbled upon something funny while downloading web pages and trying to extract one or more blocks from a page: Even though Python seems to return at least one block, it doesn't actually enter the for loop: == re_block = re.compile('before (.+?) after',re.I|re.S|re.M) #Here,

Re: Something weird about re.finditer()

2009-04-15 Thread John Machin
On Apr 15, 6:46 pm, Gilles Ganault wrote: > Hello > >         I stumbled upon something funny while downloading web pages and > trying to extract one or more blocks from a page: Even though Python > seems to return at least one block, it doesn't actually enter the for > loop: > > == > re_block

Re: Something weird about re.finditer()

2009-04-15 Thread Peter Otten
Gilles Ganault wrote: > I stumbled upon something funny while downloading web pages and > trying to extract one or more blocks from a page: Even though Python > seems to return at least one block, it doesn't actually enter the for > loop: > > == > re_block = re.compile('before (.+?) a

Re: Something weird about re.finditer()

2009-04-15 Thread Steven D'Aprano
On Wed, 15 Apr 2009 10:46:28 +0200, Gilles Ganault wrote: > Since "blocks" is no longer set to None after calling finditer()... but > doesn't contain a single block... what does it contain then? It probably took you twenty times more time and effort to ask the question than it would have to look

Re: sharing/swapping items between lists

2009-04-15 Thread Aaron Brady
On Apr 14, 9:45 pm, Ross wrote: > On Apr 14, 7:18 pm, Aaron Brady wrote: > > > > > On Apr 14, 7:01 pm, Aaron Brady wrote: > > > > On Apr 14, 12:37 pm, Ross wrote: > > > > > On Apr 14, 10:34 am, Ross wrote: > > > > > > On Apr 14, 5:57 am, [email protected] (Aahz) wrote: > > > > > > > In arti

Re: Automatically generating arithmetic operations for a subclass

2009-04-15 Thread Steven D'Aprano
On Tue, 14 Apr 2009 19:24:56 +0200, Sebastian Wiesner wrote: >> Is there a trick or Pythonic idiom to make arithmetic operations on a >> class return the same type, without having to manually specify each >> method? I'm using Python 2.5, so anything related to ABCs are not an >> option. >> >> Doe

Re: subprocess: reading from stdout hangs process termination, waiting for ENTER keyboard signal

2009-04-15 Thread Kushal Kumaran
On Wed, Apr 15, 2009 at 1:20 PM, giohappy wrote: > On 14 Apr, 18:52, MRAB wrote: >> giohappywrote: >> > Hello everyone. >> > I'm trying to use subprocess module to launch a Windows console >> > application. The application prints some results to standard output >> > and then waits for the user to

Re: Modifying the value of a float-like object

2009-04-15 Thread Eric . Le . Bigot
Dan, wow! This looks extremely promising! I initially tried to create a Float_ref class that inherits from numpy.array, so that objects of the new class behave like numpy.array in calculations, but also contain an "uncertainty" atribute, but this is apparently not allowed ("cannot create 'builti

Re: Re: Modifying the value of a float-like object

2009-04-15 Thread Dave Angel
[email protected] wrote: Thanks Dave for your thoughtful remarks, which you sent right when I was writing a response to the previous posts. I was wondering about a kind "mutable float"; so you're right, it's not fully a float, because it's mutable. I'd like to have an object that

Re: Modifying the value of a float-like object

2009-04-15 Thread Eric . Le . Bigot
Steven, I'd appreciate if you could refrain from criticizing so bluntly so many points. I'd be great if you trusted me more for knowing what I'm talking about; I've been a programmer for 25 years, now, and I pretty well know what my own code looks like! I appreciate your input, but please soften

Re: Re: Modifying the value of a float-like object

2009-04-15 Thread Dave Angel
Steven D'Aprano wrote: On Tue, 14 Apr 2009 14:45:47 -0400, Dave Angel wrote: The answer to your original question is no. If the value can be changed, then it doesn't behave like a float. And that's not just a pedantic answer, it's a serious consideration. Oh nonsense. Many programmi

Re: Modifying the value of a float-like object

2009-04-15 Thread Eric . Le . Bigot
To Dave A. and Piet: I appreciate your taking the time to make suggestions. I understand that there is a hitch in the approach that you describe, which I would like to insist on: how do you handle functions that use math.sin(), for instance? numpy does this kind of magic, but I'm not sure it's wi

Re: Modifying the value of a float-like object

2009-04-15 Thread Steven D'Aprano
On Wed, 15 Apr 2009 01:05:33 -0700, Eric.Le.Bigot wrote: > Ben F., you're right on the money! You expressed exactly what I'm > looking for. Why should I want this? because the place in the code > where (foo, baz) is calculated has _no idea_ of what foo and baz are, of > where they were defined,

Re: ANN: PyGUI 2.0.1

2009-04-15 Thread fyaqq
I got the same error too. On 4月14日, 上午2时47分, Andrew MacKeith wrote: > Greg Ewing wrote: > >PyGUI2.0.1 is available: > > >  http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ > > > Fixes some problems in setup.py affecting installation > > on Linux and Windows. > > > What isPyGUI? > >

Re: subprocess: reading from stdout hangs process termination, waiting for ENTER keyboard signal

2009-04-15 Thread giohappy
On 15 Apr, 11:20, Kushal Kumaran wrote: > On Wed, Apr 15, 2009 at 1:20 PM,giohappy wrote: > > On 14 Apr, 18:52, MRAB wrote: > >> giohappywrote: > >> > Hello everyone. > >> > I'm trying to use subprocess module to launch a Windows console > >> > application. The application prints some results to

Re: Modifying the value of a float-like object

2009-04-15 Thread Piet van Oostrum
> [email protected] (ELB) wrote: [snip] >ELB> A couple of ideas I had: >ELB> 1) Define a FloatWithUncert object, but get instance values as x(), as >ELB> in "x()+y()". The code is relatively legible. 'x' is mutable. But >ELB> formulas don't look so good, and you can't drop

Re: how to know argument name with which a function of extended c called

2009-04-15 Thread Aaron Brady
On Apr 15, 3:52 am, John Machin wrote: > On Apr 15, 6:13 pm, rahul wrote: > > > > > On Apr 14, 6:24 pm, John Machin wrote: > > > > On Apr 14, 10:35 pm, rahul wrote: > > > > > Hi, > > > >   i need to write a 'c extension function' in this function i need to > > > > change argument value with  wh

Re: Something weird about re.finditer()

2009-04-15 Thread Jeremiah Dodds
On Wed, Apr 15, 2009 at 9:46 AM, Gilles Ganault wrote: > Hello > >I stumbled upon something funny while downloading web pages and > trying to extract one or more blocks from a page: Even though Python > seems to return at least one block, it doesn't actually enter the for > loop: > >

Re: subprocess: reading from stdout hangs process termination, waiting for ENTER keyboard signal

2009-04-15 Thread giohappy
On 15 Apr, 11:38, giohappy wrote: > On 15 Apr, 11:20, Kushal Kumaran wrote: > > > > > On Wed, Apr 15, 2009 at 1:20 PM,giohappy wrote: > > > On 14 Apr, 18:52, MRAB wrote: > > >> giohappywrote: > > >> > Hello everyone. > > >> > I'm trying to use subprocess module to launch a Windows console > > >>

Re: Something weird about re.finditer()

2009-04-15 Thread Justin Ezequiel
On Apr 15, 4:46 pm, Gilles Ganault wrote: > re_block = re.compile('before (.+?) after',re.I|re.S|re.M) > > #Here, get web page and put it into "response" > > blocks = None > blocks = re_block.finditer(response) > if blocks == None: >         print "No block found" > else: >         print "Before b

Re: binary file compare...

2009-04-15 Thread Steven D'Aprano
On Wed, 15 Apr 2009 07:54:20 +0200, Martin wrote: >> Perhaps I'm being dim, but how else are you going to decide if two >> files are the same unless you compare the bytes in the files? > > I'd say checksums, just about every download relies on checksums to > verify you do have indeed the same fil

Re: 3D plotting in a GUI

2009-04-15 Thread Almar Klein
Hi, I'm actually busy writing a visualization package based on OpenGL. The interface is similar to matplotlib and Matlab. You can do regular plotting with it, but is also aimed at 3D visualization, including volume rendering. It's not quite finished yet, so I'm not sure if it'll help you right now

Equivalent to C bitmasks and enumerations

2009-04-15 Thread Ulrich Eckhardt
Greetings! I'm currently using Python to implement a set of tests for code that is otherwise written in C. This code was wrapped using Boost.Python and is then loaded into Python as module. What I often have in C is this: // bitfield (several flags combined) #define STATUS_OVERTEMP 1u #def

Re: Modifying the value of a float-like object

2009-04-15 Thread Arnaud Delobelle
[email protected] writes: > As for your idea of "straight-forward interval arithmetic", it's a > good one, but I'd have to redefine lots of functions from the math > module, to use them explicitly in my code, etc.: this is heavy; I was > looking for a light-weight alternative, where

Re: Modifying the value of a float-like object

2009-04-15 Thread Eric . Le . Bigot
It looks like Dan found what is in effect a mutable float (numpy.array). Now, with respect to the initial problem of having mutable floats that also contain an uncertainty attribute, I'd like to note that numpy.ndarray can be subclassed: it now looks possible to create a mutable float class that a

Re: HTML Conversion in python

2009-04-15 Thread [email protected]
On Apr 13, 5:43 pm, Aaron Watters wrote: > On Apr 13, 1:47 am, "[email protected]" > > wrote: > > Hello All, > >             Is there any library defined in Python which can convert a > > given text file into a html page. Basically, I require functions for > > creating tables or filling bac

Re: Interrupt Python C API

2009-04-15 Thread Piet van Oostrum
> [email protected] (g) wrote: >g> Hi, >g> I just have a design problem and don't know how to solve it. I call a >g> function which >g> executes a simple "PyRun_String(...)" command. >g> imagine the script while 1: pass is executed so the app would hang. Is >g> there any cha

Calling user defined functions from a different script..

2009-04-15 Thread [email protected]
Hello all, I have a situation where I need to call functions present in a different script whose hierarchy is something like below: C:\Pythonlib\uitl\script1.py {Place where my functions definitions are present} C:\Scripts\script2.py { Place where function calls are made} In

Re: Calling user defined functions from a different script..

2009-04-15 Thread John Machin
On Apr 15, 9:33 pm, "[email protected]" wrote: > Hello all, >           I have a situation where I need to call functions present in > a different script whose hierarchy is something like below: > > C:\Pythonlib\uitl\script1.py {Place where my functions definitions are > present} > > C:\Scri

Re: sharing/swapping items between lists

2009-04-15 Thread samwyse
On Apr 14, 7:01 pm, Aaron Brady wrote: > Here is an idea.  Create a list of all possible pairs, using > itertools.combinations.  You'll notice everyone gets equal play time > and equal time against each other on a pair-by-pair basis.  Then, call > random.shuffle until one player isn't playing on t

need to start a new project , can python do all that ?

2009-04-15 Thread Deep_Feelings
I want to start programming a new program (electronic health care center) in python and before start learning python i wanna make sure that python does have all the features i need to accomplish this project so i wanna ask you does python able to support these features : 1- cross platform (windows

Re: Calling user defined functions from a different script..

2009-04-15 Thread Esmail
I think taking a look at sys.path.append() might help. Esmail [email protected] wrote: Hello all, I have a situation where I need to call functions present in a different script whose hierarchy is something like below: C:\Pythonlib\uitl\script1.py {Place where my functions

Re: Modifying the value of a float-like object

2009-04-15 Thread Piet van Oostrum
> [email protected] (ELB) wrote: >ELB> To Dave A. and Piet: I appreciate your taking the time to make >ELB> suggestions. I understand that there is a hitch in the approach that >ELB> you describe, which I would like to insist on: how do you handle >ELB> functions that use math.

Re: need to start a new project , can python do all that ?

2009-04-15 Thread Brendon Wickham
Python is a programming language, and like practically any programming language it can do all those things. I'm not sure your requirements are based on a full understanding of the implications. A "health care center' cannot be made with a few "drag and drop", "plug and play" modules that you manipu

Re: need to start a new project , can python do all that ?

2009-04-15 Thread Chris Rebert
On Wed, Apr 15, 2009 at 5:22 AM, Deep_Feelings wrote: > I want to start programming a new program (electronic health care > center) in python and before start learning python i wanna make sure > that python does have all the features i need to accomplish this > project so i wanna ask you does pyth

Re: Calling user defined functions from a different script..

2009-04-15 Thread Aaron Brady
On Apr 15, 6:33 am, "[email protected]" wrote: > Hello all, >           I have a situation where I need to call functions present in > a different script whose hierarchy is something like below: > > C:\Pythonlib\uitl\script1.py {Place where my functions definitions are > present} > > C:\Scri

Re: need to start a new project , can python do all that ?

2009-04-15 Thread Krishnakant
On Wed, 2009-04-15 at 05:22 -0700, Deep_Feelings wrote: > I want to start programming a new program (electronic health care > center) in python and before start learning python i wanna make sure > that python does have all the features i need to accomplish this > project so i wanna ask you does pyt

Re: Modifying the value of a float-like object

2009-04-15 Thread Eric . Le . Bigot
Arnaud, your code is very interesting! On Apr 15, 1:00 pm, Arnaud Delobelle wrote: > I still don't understand why you need mutable floats. Here is why: the code that your proposed (or any code that does straightforward error propagation, for that matter) does not generally calculate uncertaintie

Re: need to start a new project , can python do all that ?

2009-04-15 Thread Tim Rowe
2009/4/15 Deep_Feelings : > I want to start programming a new program (electronic health care > center) in python and before start learning python i wanna make sure > that python does have all the features i need to accomplish this > project so i wanna ask you does python able to support these > fe

Re: sharing/swapping items between lists

2009-04-15 Thread Aaron Brady
On Apr 15, 6:57 am, samwyse wrote: > On Apr 14, 7:01 pm, Aaron Brady wrote: > > > Here is an idea.  Create a list of all possible pairs, using > > itertools.combinations.  You'll notice everyone gets equal play time > > and equal time against each other on a pair-by-pair basis.  Then, call > > ra

Python unit tests.

2009-04-15 Thread alessiogiovanni . baroni
Hi to all, how do I read the info at http://coverage.livinglogic.de ? For example, in http://coverage.livinglogic.de/Objects/funcobject.c.html, the count field, what it means? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: binary file compare...

2009-04-15 Thread Martin
On Wed, Apr 15, 2009 at 11:03 AM, Steven D'Aprano wrote: > The checksum does look at every byte in each file. Checksumming isn't a > way to avoid looking at each byte of the two files, it is a way of > mapping all the bytes to a single number. My understanding of the original question was a way t

Re: Modifying the value of a float-like object

2009-04-15 Thread Eric . Le . Bigot
Thanks, Piet! Before reading your post, I did not know that defining __float__() was enough for math.sin() to be able to calculate something! To summarize my current understanding for the original problem: - Mutable floats seem to be the only way of performing (correct) uncertainty calculations

Lambda alternative?

2009-04-15 Thread mousemeat
Hello all, I really like the lambda function for a particular task i have: I am writing some simulation software, working with many different materials. Each material with many different properties, some are temperature dependent, others aren't, some are defined by a function, some are a lookup ta

Re: sharing/swapping items between lists

2009-04-15 Thread Aaron Brady
On Apr 14, 9:45 pm, Ross wrote: > On Apr 14, 7:18 pm, Aaron Brady wrote: > > > > > On Apr 14, 7:01 pm, Aaron Brady wrote: > > > > On Apr 14, 12:37 pm, Ross wrote: > > > > > On Apr 14, 10:34 am, Ross wrote: > > > > > > On Apr 14, 5:57 am, [email protected] (Aahz) wrote: > > > > > > > In arti

Re: binary file compare...

2009-04-15 Thread Grant Edwards
On 2009-04-15, Martin wrote: > Hi, > > On Mon, Apr 13, 2009 at 10:03 PM, Grant Edwards wrote: >> On 2009-04-13, SpreadTooThin wrote: >> >>> I want to compare two binary files and see if they are the same. >>> I see the filecmp.cmp function but I don't get a warm fuzzy feeling >>> that it is doin

Re: Modifying the value of a float-like object

2009-04-15 Thread Steven D'Aprano
On Wed, 15 Apr 2009 05:59:39 -0400, Dave Angel wrote: > Steven D'Aprano wrote: >> On Tue, 14 Apr 2009 14:45:47 -0400, Dave Angel wrote: >> >> >>> The answer to your original question is no. If the value can be >>> changed, then it doesn't behave like a float. And that's not just a >>> pedantic a

Re: binary file compare...

2009-04-15 Thread Grant Edwards
On 2009-04-15, Martin wrote: > On Wed, Apr 15, 2009 at 11:03 AM, Steven D'Aprano > I'd still say rather burn CPU cycles than development hours (if I got > the question right), _Hours_? Calling the file compare module takes _one_line_of_code_. Implementing a file compare from scratch takes abo

Re: Python unit tests.

2009-04-15 Thread skip
> how do I read the info at http://coverage.livinglogic.de ? For > example, in http://coverage.livinglogic.de/Objects/funcobject.c.html, > the count field, what it means? Most likely it's the number of times that line was executed. Strong support for that comes from the fact that the

Re: How to create a virtual serial port?

2009-04-15 Thread Grant Edwards
On 2009-04-15, Dennis Lee Bieber wrote: > On Sun, 12 Apr 2009 03:20:30 + (UTC), JanC > declaimed the following in gmane.comp.python.general: > >> >> USB *is* a serial port... that's what the "S" stands for. ;) >> > It is a serial protocol, but it is a shared bus-based protocol, in > c

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-15 Thread P.J. Eby
At 09:51 AM 4/15/2009 +0200, M.-A. Lemburg wrote: On 2009-04-15 02:32, P.J. Eby wrote: > At 10:59 PM 4/14/2009 +0200, M.-A. Lemburg wrote: >> You are missing the point: When breaking up a large package that lives in >> site-packages into smaller distribution bundles, you don't need namespace >> p

Re: Lambda alternative?

2009-04-15 Thread Paul Rubin
[email protected] writes: > But, lambda functions can't be pickled. I would like to pickle my > objects, and i would really like to use parallel python (which > requires pickling). Maybe you could use marshal instead of pickle. Make sure to read the documentation carefully--there are some pitfa

Re: need to start a new project , can python do all that ?

2009-04-15 Thread Deep_Feelings
On Apr 15, 4:05 pm, Tim Rowe wrote: > 2009/4/15 Deep_Feelings : > > > I want to start programming a new program (electronic health care > > center) in python and before start learning python i wanna make sure > > that python does have all the features i need to accomplish this > > project so i wan

Re: Lambda alternative?

2009-04-15 Thread Duncan Booth
[email protected] wrote: > class material(object): > def __init__(self,density): > self.density=density > > airdensity=lambda T:10/(287*T) > air=material(airdensity) What exactly is your objection to using a named function here? def airdensity(T): return 10/(287*T)

Question to python C API

2009-04-15 Thread Andreas Otto
Hi, I have the following question ... I write a custom "*.init" method and expect a variable number or arguments This are my questions: 1.I need something like a for loop to analyse this arguments For now I try the "PyArg_ParseTupleAndKeywords" but i missing somehing

Re: Modifying the value of a float-like object

2009-04-15 Thread Piet van Oostrum
I think the term 'mutable float' is causing a lot of confusion. My solution I wouldn't call a mutable float, but a float container that tries to act like a float in a context where this is required. Another solution would have been to use automatically dereferencing pointers but that is something

Re: Lambda alternative?

2009-04-15 Thread Paul Rubin
Duncan Booth writes: > What exactly is your objection to using a named function here?... > Surely that would solve your pickle problem *and* give you more meaningful > tracebacks in your exceptions? I don't think it would help the pickle problem. -- http://mail.python.org/mailman/listinfo/python

Re: Lambda alternative?

2009-04-15 Thread Piet van Oostrum
> [email protected] (m) wrote: >m> Hello all, >m> I really like the lambda function for a particular task i have: I am >m> writing some simulation software, working with many different >m> materials. Each material with many different properties, some are >m> temperature dependent, others are

pyprocessing and exceptions

2009-04-15 Thread garyrob
Hi, We're still using Python 2.5 so this question is about the pyprocessing module rather than the multiprocessing module, but I'm guessing the answer is the same. I tend to use the Pool() object to create slave processes. If something goes wrong in the slave, an exception is raised there, which

Re: Modifying the value of a float-like object

2009-04-15 Thread Arnaud Delobelle
[email protected] writes: > Arnaud, your code is very interesting! > > On Apr 15, 1:00 pm, Arnaud Delobelle wrote: >> I still don't understand why you need mutable floats. > > Here is why: the code that your proposed (or any code that does > straightforward error propagation, for t

RELEASED Python 2.6.2

2009-04-15 Thread Barry Warsaw
On behalf of the Python community, I'm happy to announce the availability of Python 2.6.2. This is the latest production-ready version in the Python 2.6 series. Dozens of issues have been fixed since Python 2.6.1 was released back in December. Please see the NEWS file for all the gory de

Re: Lambda alternative?

2009-04-15 Thread mousemeat
On 15 Apr, 16:27, Piet van Oostrum wrote: > > [email protected] (m) wrote: > >m> Hello all, > >m> I really like the lambda function for a particular task i have: I am > >m> writing some simulation software, working with many different > >m> materials. Each material with many different proper

Re: iPython help, Docstring [source file open failed]

2009-04-15 Thread P. Kaminski
On 15 Kwi, 03:27, alex23 wrote: > On Apr 15, 5:35 am, Przemyslaw Kaminski wrote: > > > You may want to try: > > import pydoc > > b = pydoc.render_doc(timedelta) > > print b > > Isn't this exactly the same output you get from typing 'help > (timedelta)' though? Well, from this: Lets say I want m

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-15 Thread Aahz
[much quote-trimming, the following is intended to just give the gist, but the bits quoted below are not in directe response to each other] On Wed, Apr 15, 2009, P.J. Eby wrote: > At 09:51 AM 4/15/2009 +0200, M.-A. Lemburg wrote: >> >> [...] >> Again: the PEP is about creating a standard for nam

Re: sharing/swapping items between lists

2009-04-15 Thread samwyse
On Apr 15, 8:13 am, Aaron Brady wrote: > On Apr 15, 6:57 am, samwyse wrote: > > > Here's my idea: generate all possible pairs: > > > >>> import itertools > > >>> players = [chr(c) for c in xrange(ord('a'),ord('z')+1)] > > >>> all_pairs = list(itertools.combinations(players,2)) > > > partition th

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-15 Thread M.-A. Lemburg
On 2009-04-15 16:44, P.J. Eby wrote: > At 09:51 AM 4/15/2009 +0200, M.-A. Lemburg wrote: >> On 2009-04-15 02:32, P.J. Eby wrote: >> > At 10:59 PM 4/14/2009 +0200, M.-A. Lemburg wrote: >> >> You are missing the point: When breaking up a large package that >> lives in >> >> site-packages into smaller

Python Bug Day on April 23

2009-04-15 Thread Georg Brandl
Hi, I'd like to announce that there will be a Python Bug Day on April 23. As always, this is a perfect opportunity to get involved in Python development, or bring your own issues to attention, discuss them and (hopefully) resolve them together with the core developers. We will coordinate over IRC

Re: sharing/swapping items between lists

2009-04-15 Thread samwyse
On Apr 15, 8:56 am, Aaron Brady wrote: > > The randomizing solution isn't quite suitable for 16 teams.  With 5 > teams/1 court, and 5 teams/2 courts, 6 teams/2 courts, the solution > comes within seconds.  For 7 teams/3 courts, the solution takes a few > minutes. 7 teams/3 courts is the same as 8

Re: Python and XML Help

2009-04-15 Thread Scott David Daniels
ookrin wrote: I am still learning. And it's not that I won't take the advice for using ElementTree, I just currently don't know anything about it. I just didn't want to say, "I have no idea what you're talking about!" to Scott cause I figured that would be rude, but I guess so is not saying

Re: Python Bug Day on April 23

2009-04-15 Thread MRAB
Georg Brandl wrote: Hi, I'd like to announce that there will be a Python Bug Day on April 23. As always, this is a perfect opportunity to get involved in Python development, or bring your own issues to attention, discuss them and (hopefully) resolve them together with the core developers. We wi

Re: Lambda alternative?

2009-04-15 Thread Duncan Booth
Paul Rubin wrote: > Duncan Booth writes: >> What exactly is your objection to using a named function here?... >> Surely that would solve your pickle problem *and* give you more >> meaningful tracebacks in your exceptions? > > I don't think it would help the pickle

Re: Lambda alternative?

2009-04-15 Thread Duncan Booth
mousemeat wrote: > Will i then be able to pickle 'rock', and any object that may contain > 'rock' as one of it's fields? I'm not sure that i will, but i'll give > it a shot. > So long as the functions are defined at module level, not nested inside some other namespace it will work fine. -- htt

Re: Question to python C API

2009-04-15 Thread Stefan Behnel
Andreas Otto wrote: > I have the following question ... > > I write a custom "*.init" method and expect a variable number or arguments What's a "*.init" method? Do you mean SomeType.__init__() ? > This are my questions: > > 1.I need something like a for loop to analyse this argumen

Re: binary file compare...

2009-04-15 Thread Nigel Rantor
Martin wrote: On Wed, Apr 15, 2009 at 11:03 AM, Steven D'Aprano wrote: The checksum does look at every byte in each file. Checksumming isn't a way to avoid looking at each byte of the two files, it is a way of mapping all the bytes to a single number. My understanding of the original question

Re: binary file compare...

2009-04-15 Thread Nigel Rantor
Grant Edwards wrote: We all rail against premature optimization, but using a checksum instead of a direct comparison is premature unoptimization. ;) And more than that, will provide false positives for some inputs. So, basically it's a worse-than-useless approach for determining if two files

Re: Modifying the value of a float-like object

2009-04-15 Thread Suraj Barkale
spectro.jussieu.fr> writes: > > Hello, > > Is there a way to easily build an object that behaves exactly like a > float, but whose value can be changed? The goal is to maintain a list > [x, y,…] of these float-like objects, and to modify their value on the > fly (with something like x.value =

Re: Play sound at wanted frequency

2009-04-15 Thread Scott David Daniels
Diez B. Roggisch wrote: Matteo schrieb: I need to playback a sound on a linux machine of a pre-determined frequency like, say, 440 Hz. How can I do that with python? I found the ossaudiodev package, but it says that the ossaudiodev.write() method accepts data as a raw string. It doesn't explain

Re: Using Python after a few years of Ruby

2009-04-15 Thread Aaron Watters
On Apr 15, 3:49 am, Tim Hoffman wrote: > There are plenty of python web frameworks, some have quite different > approaches, > what suits you will depend very much on your own bias, interest. I've had a lot of luck with WHIFF ( http://whiff.sourceforge.net ) Of course I wrote it and just released

Re: binary file compare...

2009-04-15 Thread SpreadTooThin
On Apr 15, 8:04 am, Grant Edwards wrote: > On 2009-04-15, Martin wrote: > > > > > Hi, > > > On Mon, Apr 13, 2009 at 10:03 PM, Grant Edwards wrote: > >> On 2009-04-13, SpreadTooThin wrote: > > >>> I want to compare two binary files and see if they are the same. > >>> I see the filecmp.cmp functi

Re: How to query object of GUI?

2009-04-15 Thread Scott David Daniels
John McMonagle wrote: Muddy Coder wrote: I need to query the ID of GUI, in Tkinter, but don't know how to do it. This is my code: ... Pass the name of the label as an argument to the callback. Below is a short working example: ... lab = 'test' menubar.add_command(label=lab, comman

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-15 Thread P.J. Eby
At 09:10 AM 4/15/2009 -0700, Aahz wrote: For the benefit of us bystanders, could you summarize your vote at this point? Given the PEP's intended goals, if you do not oppose the PEP, are there any changes you think should be made? I'm +1 on Martin's original version of the PEP, subject to the p

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-15 Thread P.J. Eby
At 06:15 PM 4/15/2009 +0200, M.-A. Lemburg wrote: The much more common use case is that of wanting to have a base package installation which optional add-ons that live in the same logical package namespace. Please see the large number of Zope and PEAK distributions on PyPI as minimal examples

Re: segmentation fault while using ctypes

2009-04-15 Thread sanket
On Apr 14, 9:00 pm, [email protected] wrote: > On Apr 15, 12:39 am, sanket wrote: > > > > > Hello All, > > > I am dealing with this weird bug. > > I have a function in C and I have written python bindings for it using > > ctypes. > > > I can call this function for couple of times and then suddenl

  1   2   >