Re: problem using import from PyRun_String

2008-04-11 Thread Patrick Stinson
Great, that was the answer I was looking for, thank you. I'll respond with how well it works. On Thu, Apr 10, 2008 at 12:16 AM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Wed, 09 Apr 2008 13:31:22 -0300, Patrick Stinson > <[EMAIL PROTECTED]> escribió: > > > Well, I eventually want to add a

CDATA and lxml

2008-04-11 Thread Silfheed
Heyas So first off I know that CDATA is generally hated and just shouldn't be done, but I'm simply required to parse it and spit it back out. Parsing is pretty easy with lxml, but it's the spitting back out that's giving me issues. The fact that lxml strips all the CDATA stuff off isnt really a b

Re: How to use my dynamic link libraries in python??

2008-04-11 Thread Diez B. Roggisch
郭勇军 schrieb: > Hello: > My OS is Linux, I compile my dynamic link libraries , and > want to call the function of my dynamic library through python! > How can I realize the function? Please give me some advices! Thanks If the module has a plain C-interface, consider using ctype

Re: Integer dicision

2008-04-11 Thread Paul Hankin
On Apr 11, 6:06 am, casevh <[EMAIL PROTECTED]> wrote: > On Apr 10, 9:28 pm, bdsatish <[EMAIL PROTECTED]> wrote: > > > How does (a/b) work when both 'a' and 'b' are pure integers ? > > Python defines the quotient and remainder from integer division so > that a = qb + r and 0<=r < abs(b). C/C++ lets

Re: How is GUI programming in Python?

2008-04-11 Thread Phil Thompson
On Friday 11 April 2008, David Cook wrote: > On 2008-04-10, Paul Rubin wrote: > > Well, it's a trade-off, the person wanted a cross platform gui and the > > #1 hurdle for something like PyQt4 is getting it to work on each of > > the platforms you desire to run on. > > Installing Pyqt on windows in

Re: How is GUI programming in Python?

2008-04-11 Thread Paul Rubin
Phil Thompson <[EMAIL PROTECTED]> writes: > > Installing Pyqt on windows involves a couple "click to install" EXEs. On > > Linux, one uses yum or apt. Only on Mac is it marginally a bit harder. > > Actually, on Windows it's only one .exe as the PyQt GPL binary installer > includes Qt and all it

Suitable libraries for implementing a "push"-type matching engine?

2008-04-11 Thread Andrew Warkentin
I am trying to write a matching engine for a matching language for a filtering proxy compatible with that of The Proxomitron. The matching language is basically an extended superset of shell-style globs, with functionality comparable to regexps (see http://www.proxomitron.info/45/help/Matching%

Re: How to make a "command line basd" interactive program?

2008-04-11 Thread Cristina Yenyxe González García
2008/4/11, Evan <[EMAIL PROTECTED]>: > > > Hope this hasn't been posted hundreds of times. I'm new for this. > > Before using python for this kind of script, I was using TCL to write > down a "command line based" interactive program. it likes a "tclsh", > or "python" command, after that, you can w

[no subject]

2008-04-11 Thread ha bo
hi i use this programme in my application django: import structMASK_CCITT = 0x1021 # CRC-CCITT mask (ISO 3309, used in X25, HDLC)MASK_CRC16 = 0xA001 # CRC16 mask (used in ARC files)def updcrc(crc, data, mask=MASK_CRC16): data_length = len(data) unpackFormat = '%db' % data_lengt

Randall Munroe loves Python

2008-04-11 Thread Paul McGuire
Another xkcd plug for Python: http://xkcd.com/409/ -- http://mail.python.org/mailman/listinfo/python-list

Re: [lxml-dev] CDATA and lxml

2008-04-11 Thread Stefan Behnel
Stefan Behnel wrote: > It's not as trivial as it sounds. Removing the CDATA sections in the parser is > just for fun. ... *not* just for fun ... obviously ... Stefan -- http://mail.python.org/mailman/listinfo/python-list

Rounding a number to nearest even

2008-04-11 Thread bdsatish
The built-in function round( ) will always "round up", that is 1.5 is rounded to 2.0 and 2.5 is rounded to 3.0. If I want to round to the nearest even, that is my_round(1.5) = 2# As expected my_round(2.5) = 2# Not 3, which is an odd num I'm interested in rounding numbers of the f

Re: Stripping scripts from HTML with regular expressions

2008-04-11 Thread Stefan Behnel
Michel Bouwmans wrote: > I don't think HTMLParser was doing anything wrong here. I needed to parse a > HTML document, but it contained script-blocks with document.write's in > them. I only care for the content outside these blocks but HTMLParser will > choke on such a block when it isn't encapsulat

Re: CDATA and lxml

2008-04-11 Thread Stefan Behnel
Silfheed wrote: > So first off I know that CDATA is generally hated and just shouldn't > be done, but I'm simply required to parse it and spit it back out. > Parsing is pretty easy with lxml, but it's the spitting back out > that's giving me issues. The fact that lxml strips all the CDATA > stuff

Re: @x.setter property implementation

2008-04-11 Thread Floris Bruynooghe
On Apr 11, 10:16 am, Floris Bruynooghe <[EMAIL PROTECTED]> wrote: > On Apr 10, 5:09 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > > > > > On Apr 10, 3:37 pm, Floris Bruynooghe <[EMAIL PROTECTED]> > > wrote: > > > > On Apr 7, 2:19 pm, "Andrii V. Mishkovskyi" <[EMAIL PROTECTED]> wrote: > > > > >

Re: How to make a "command line basd" interactive program?

2008-04-11 Thread Jarek Zgoda
Evan napisał(a): > Hope this hasn't been posted hundreds of times. I'm new for this. > > Before using python for this kind of script, I was using TCL to write > down a "command line based" interactive program. it likes a "tclsh", > or "python" command, after that, you can work under a prompt, fo

Re: Rounding a number to nearest even

2008-04-11 Thread colas . francis
On 11 avr, 12:14, bdsatish <[EMAIL PROTECTED]> wrote: > The built-in function round( ) will always "round up", that is 1.5 is > rounded to 2.0 and 2.5 is rounded to 3.0. > > If I want to round to the nearest even, that is > > my_round(1.5) = 2# As expected > my_round(2.5) = 2# Not 3

How to make a "command line basd" interactive program?

2008-04-11 Thread Evan
Hope this hasn't been posted hundreds of times. I'm new for this. Before using python for this kind of script, I was using TCL to write down a "command line based" interactive program. it likes a "tclsh", or "python" command, after that, you can work under a prompt, for example, " - >> ", and t

Re: @x.setter property implementation

2008-04-11 Thread Floris Bruynooghe
On Apr 10, 5:09 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > On Apr 10, 3:37 pm, Floris Bruynooghe <[EMAIL PROTECTED]> > wrote: > > > > > On Apr 7, 2:19 pm, "Andrii V. Mishkovskyi" <[EMAIL PROTECTED]> wrote: > > > > 2008/4/7, Floris Bruynooghe <[EMAIL PROTECTED]>: > > > > > Have been grepping

Re: tkinter, overwrite Label-text?

2008-04-11 Thread skanemupp
On 10 Apr, 18:03, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Thu, 10 Apr 2008 07:37:08 -0700, skanemupp wrote: > > i know how to do this already. the problem is i want the text to stay > > in the windowa nd not start overwriting "Answer:". > > Then don't use `place()` but let Tkinter

Re: @x.setter property implementation

2008-04-11 Thread Arnaud Delobelle
On Apr 11, 11:19 am, Floris Bruynooghe <[EMAIL PROTECTED]> wrote: [...] > > Unfortunatly both this one and the one I posted before work when I try > > them out on the commandline but both fail when I try to use them in a > > module.  And I just can't figure out why. > > This in more detail: Imaging

Re: Rounding a number to nearest even

2008-04-11 Thread cokofreedom
couldn't you just do. #untested new_round(n): answer = round(n) # is answer now odd if answer % 2: return answer - 1 else: return answer -- http://mail.python.org/mailman/listinfo/python-list

Re: Rounding a number to nearest even

2008-04-11 Thread cokofreedom
On Apr 11, 1:19 pm, [EMAIL PROTECTED] wrote: > couldn't you just do. > > #untested > new_round(n): > answer = round(n) > # is answer now odd > if answer % 2: > return answer - 1 > else: > return answer Whoops, this also affects odd numbers... Will try and find a GOOD solution late

Re: Randall Munroe loves Python

2008-04-11 Thread Adrian Cherry
Paul McGuire <[EMAIL PROTECTED]> wrote in news:869c25d9-e4d3- [EMAIL PROTECTED]: > Another xkcd plug for Python: http://xkcd.com/409/ > So Python is on a collision course with Calvin and Hobbes! Adrian -- http://mail.python.org/mailman/listinfo/python-list

Re: Rounding a number to nearest even

2008-04-11 Thread bdsatish
On Apr 11, 3:27 pm, [EMAIL PROTECTED] wrote: > On 11 avr, 12:14, bdsatish <[EMAIL PROTECTED]> wrote: > > > The built-in function round( ) will always "round up", that is 1.5 is > > rounded to 2.0 and 2.5 is rounded to 3.0. > > > If I want to round to the nearest even, that is > > > my_round(1.5) =

Can we send and receive data to and from Port Using Python ?

2008-04-11 Thread sambasivareddy
Hi, I am new to this group. I have some question, it is listed below. In my application I should send some data to hardware and it will give response that response should log in one file. To do it first should send data to port next receive response from port (hardware) so... Queries: 1) Can we

Re: Graphs in Python

2008-04-11 Thread Philipp Pagel
Sanhita Mallick <[EMAIL PROTECTED]> wrote: > I have looked at that, and other similar ones all of > which are based on Graphviz. Networkx is not based on graphviz. > My problem is that I myself am creating some large graphs [...] > So I would like to use a graphical/visual method than typing out

Re: Rounding a number to nearest even

2008-04-11 Thread bdsatish
On Apr 11, 4:37 pm, Scott David Daniels <[EMAIL PROTECTED]> wrote: > bdsatish wrote: > > The built-in function round( ) will always "round up", that is 1.5 is > def rounded(v): > rounded = round(v) > if divmod(v, 1)[1] == .5 and divmod(rounded, 2)[1] == 1: > if v > 0: >

Re: Rounding a number to nearest even

2008-04-11 Thread bdsatish
On Apr 11, 4:19 pm, [EMAIL PROTECTED] wrote: > couldn't you just do. > > #untested > new_round(n): > answer = round(n) > # is answer now odd > if answer % 2: > return answer - 1 > else: > return answer It fails for negative numbers: For -2.5 it gives -4.0 as answer whereas I expect

Re: Rounding a number to nearest even

2008-04-11 Thread bdsatish
On Apr 11, 4:24 pm, [EMAIL PROTECTED] wrote: > On Apr 11, 1:19 pm, [EMAIL PROTECTED] wrote: > > > couldn't you just do. > > > #untested > > new_round(n): > > answer = round(n) > > # is answer now odd > > if answer % 2: > > return answer - 1 > > else: > > return answer > > Whoops, th

Re: Rounding a number to nearest even

2008-04-11 Thread Scott David Daniels
bdsatish wrote: > The built-in function round( ) will always "round up", that is 1.5 is > rounded to 2.0 and 2.5 is rounded to 3.0. > > If I want to round to the nearest even, that is > > my_round(1.5) = 2# As expected > my_round(2.5) = 2# Not 3, which is an odd num > > I'm inter

RE: Randall Munroe loves Python

2008-04-11 Thread Trent Nelson
> Another xkcd plug for Python: http://xkcd.com/409/ Damn it. There goes another 40 minutes of my life magically whisked away by that more-addictive-than-crack 'RANDOM' button. -- http://mail.python.org/mailman/listinfo/python-list

Re: Rounding a number to nearest even

2008-04-11 Thread Gerard Flanagan
On Apr 11, 12:14 pm, bdsatish <[EMAIL PROTECTED]> wrote: > The built-in function round( ) will always "round up", that is 1.5 is > rounded to 2.0 and 2.5 is rounded to 3.0. > > If I want to round to the nearest even, that is > > my_round(1.5) = 2# As expected > my_round(2.5) = 2# No

Re: @x.setter property implementation

2008-04-11 Thread Floris Bruynooghe
Oh, that was a good hint! See inline On Apr 11, 12:02 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > On Apr 11, 11:19 am, Floris Bruynooghe <[EMAIL PROTECTED]> > wrote: > [...] > > > > Unfortunatly both this one and the one I posted before work when I try > > > them out on the commandline but

Re: Rounding a number to nearest even

2008-04-11 Thread Gerard Flanagan
On Apr 11, 2:05 pm, Gerard Flanagan <[EMAIL PROTECTED]> wrote: > On Apr 11, 12:14 pm, bdsatish <[EMAIL PROTECTED]> wrote: > > > The built-in function round( ) will always "round up", that is 1.5 is > > rounded to 2.0 and 2.5 is rounded to 3.0. > > > If I want to round to the nearest even, that is >

Re: from __future__ import print

2008-04-11 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Am I the only one that thinks this would be useful? :) > > I'd really like to be able to use python 3.0's print statement in > 2.x. FWIW, the whole point is that in 3.0, print stop being a statement to become a function... -- http://mail.python.org/mailman/listi

Re: Rounding a number to nearest even

2008-04-11 Thread bdsatish
HI Gerard, I think you've taken it to the best possible implementation. Thanks ! On Apr 11, 5:14 pm, Gerard Flanagan <[EMAIL PROTECTED]> wrote: > In fact you can avoid the call to the builtin round: > > > def myround(x): > n = int(x) > if ab

Re: Rounding a number to nearest even

2008-04-11 Thread colas . francis
On 11 avr, 14:14, Gerard Flanagan <[EMAIL PROTECTED]> wrote: > On Apr 11, 2:05 pm, Gerard Flanagan <[EMAIL PROTECTED]> wrote: > > > On Apr 11, 12:14 pm, bdsatish <[EMAIL PROTECTED]> wrote: > > > > The built-in function round( ) will always "round up", that is 1.5 is > > > rounded to 2.0 and 2.5 is

Re: Rounding a number to nearest even

2008-04-11 Thread bdsatish
On Apr 11, 5:33 pm, bdsatish <[EMAIL PROTECTED]> wrote: > HI Gerard, > > I think you've taken it to the best possible implementation. Thanks ! > On Apr 11, 5:14 pm, Gerard Flanagan <[EMAIL PROTECTED]> wrote: > > > In fact you can avoid the call to the builtin round: > > > --

Re: Can we send and receive data to and from Port Using Python ?

2008-04-11 Thread Steve Holden
sambasivareddy wrote: > Hi, > I am new to this group. I have some question, it is listed below. > In my application I should send some data to hardware and it will give > response that response should log in one file. To do it first should > send data to port next receive response from port (hard

Re: Adding classes to modules at runtime from outside that module

2008-04-11 Thread frambooz
On Apr 10, 8:05 pm, Andrew Warkentin <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > >  In Python, is it possible to add classes to a module at run-time? > > >  Say I have a module foo and a module bar. Foo has class A and B, and > >bar has class C. I want to add class C to foo so I can acc

Re: Rounding a number to nearest even

2008-04-11 Thread Ivan Illarionov
On Apr 11, 2:14 pm, bdsatish <[EMAIL PROTECTED]> wrote: > The built-in function round( ) will always "round up", that is 1.5 is > rounded to 2.0 and 2.5 is rounded to 3.0. > > If I want to round to the nearest even, that is > > my_round(1.5) = 2# As expected > my_round(2.5) = 2# Not

Re: (unknown)

2008-04-11 Thread Steve Holden
ha bo wrote: > hi i use this programme in my application django: > import struct > MASK_CCITT = 0x1021 # CRC-CCITT mask (ISO 3309, used in X25, HDLC) > MASK_CRC16 = 0xA001 # CRC16 mask (used in ARC files) > > def updcrc(crc, data, mask=MASK_CRC16): > > data_length = len(data) >

Re: String Literal to Blob

2008-04-11 Thread Victor Subervi
Nope. Do not see it. My ugly stupid way works. I guess I will just proceed with that and write my howto accordingly. Victor On Thu, Apr 10, 2008 at 9:01 PM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Thu, 10 Apr 2008 14:04:43 -0300, Victor Subervi > <[EMAIL PROTECTED]> escribió: > > > Well

Re: Convert PyIDispatch object to struct IDispatch*

2008-04-11 Thread Huayang Xia
On Apr 11, 12:15 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 10 Apr 2008 18:45:04 -0300, Huayang Xia <[EMAIL PROTECTED]> > escribió: > > > I am trying to use ctypes to call dll functions. One of the functions > > requires argument "struct IDispatch* ". I do have a PyIDispatch objec

Python plus

2008-04-11 Thread M�ta-MCI (MVP)
After IronPython, Python + iron : http://www.golfermania.com/SnakeEyes/PYTHON-PLUS-IRON.jpg ;o) Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Rounding a number to nearest even

2008-04-11 Thread hdante
On Apr 11, 9:45 am, bdsatish <[EMAIL PROTECTED]> wrote: > On Apr 11, 5:33 pm, bdsatish <[EMAIL PROTECTED]> wrote: > > > > > HI Gerard, > > > I think you've taken it to the best possible implementation. Thanks ! > > On Apr 11, 5:14 pm, Gerard Flanagan <[EMAIL PROTECTED]> wrote: > > > > In fact you c

Re: String Literal to Blob

2008-04-11 Thread Steve Holden
Victor Subervi wrote: > Nope. Do not see it. My ugly stupid way works. I guess I will just > proceed with that and write my howto accordingly. > Victor > OK, but be prepared for some pretty scathing feedback. You will make it clear you do not understand the web. I'd suggest a little more reading

Re: Convert PyIDispatch object to struct IDispatch*

2008-04-11 Thread Tim Golden
Huayang Xia wrote: > On Apr 11, 12:15 am, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: >> En Thu, 10 Apr 2008 18:45:04 -0300, Huayang Xia <[EMAIL PROTECTED]> >> escribió: >> >>> I am trying to use ctypes to call dll functions. One of the functions >>> requires argument "struct IDispatch* ". I d

Re: Graphs in Python

2008-04-11 Thread greg_kr
You should use Python with R. Google for Rpy, this is the best Graphing you can do with Python On Apr 11, 7:40 am, Philipp Pagel <[EMAIL PROTECTED]> wrote: > Sanhita Mallick <[EMAIL PROTECTED]> wrote: > > I have looked at that, and other similar ones all of > > which are based on Graphviz. > > Net

RE: unpack

2008-04-11 Thread ha bo
thank you i did find solution i did have just change: unpackedData = struct.unpack(unpackFormat, data) to unpackedData = struct.unpack(unpackFormat, data.decode('string_escape')) From: [EMAIL PROTECTED] Subject: Python-list Digest, Vol 55, Issue 179 To: [email protected] Date

Re: Rounding a number to nearest even

2008-04-11 Thread Ivan Illarionov
On Apr 11, 5:49 pm, hdante <[EMAIL PROTECTED]> wrote: > On Apr 11, 9:45 am, bdsatish <[EMAIL PROTECTED]> wrote: > > > > > On Apr 11, 5:33 pm, bdsatish <[EMAIL PROTECTED]> wrote: > > > > HI Gerard, > > > > I think you've taken it to the best possible implementation. Thanks ! > > > On Apr 11, 5:14 pm

Re: text adventure game problem

2008-04-11 Thread corvettecraz92
On Apr 11, 1:40 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Thu, 10 Apr 2008 05:06:42 -0700 (PDT), [EMAIL PROTECTED] > declaimed the following in comp.lang.python: > > > okay, that explains it... > > could you provide a working example of a two-room game using your > > method please so I

Re: Convert PyIDispatch object to struct IDispatch*

2008-04-11 Thread Huayang Xia
On Apr 11, 9:47 am, Tim Golden <[EMAIL PROTECTED]> wrote: > Huayang Xia wrote: > > On Apr 11, 12:15 am, "Gabriel Genellina" <[EMAIL PROTECTED]> > > wrote: > >> En Thu, 10 Apr 2008 18:45:04 -0300, Huayang Xia <[EMAIL PROTECTED]> > >> escribió: > > >>> I am trying to use ctypes to call dll functions.

Re: text adventure game problem

2008-04-11 Thread corvettecraz92
On Apr 11, 10:16 am, [EMAIL PROTECTED] wrote: > On Apr 11, 1:40 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > > > On Thu, 10 Apr 2008 05:06:42 -0700 (PDT), [EMAIL PROTECTED] > > declaimed the following in comp.lang.python: > > > > okay, that explains it... > > > could you provide a working exa

Re: Graphs in Python

2008-04-11 Thread Philipp Pagel
greg_kr <[EMAIL PROTECTED]> wrote: > You should use Python with R. Google for Rpy, this is the best > Graphing you can do with Python The OP was refering to graph as in 'graph-theory', not plotting data. Of course, R has some packages for dealing with graphs in the former sense but I don't think t

Re: Rounding a number to nearest even

2008-04-11 Thread hdante
On Apr 11, 11:13 am, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > > Shorter version: > def round3k(x): > return x % 1 != 0.5 and round(x) or round(x / 2.) * 2. Strangely, a "faster" version is: def fast_round(x): if x % 1 != 0.5: return round(x) return 2.0*round(x/2.0) > > nums =

Re: How is GUI programming in Python?

2008-04-11 Thread Michel Bouwmans
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gabriel Genellina wrote: > Another annoying thing with the Qt license is that you have to choose it > at the very start of the project. You cannot develop something using the > open source license and later decide to switch to the commercial licence >

Re: How is GUI programming in Python?

2008-04-11 Thread Michel Bouwmans
Steve Holden wrote: > Michel Bouwmans wrote: >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> Mike Driscoll wrote: >> >>> On Apr 10, 12:05 pm, Michel Bouwmans <[EMAIL PROTECTED]> wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Paul Rubin wrote: > C

Re: Rounding a number to nearest even

2008-04-11 Thread Graham Breed
On Apr 11, 6:14 pm, bdsatish <[EMAIL PROTECTED]> wrote: > The built-in function round( ) will always "round up", that is 1.5 is > rounded to 2.0 and 2.5 is rounded to 3.0. > > If I want to round to the nearest even, that is > > my_round(1.5) = 2# As expected > my_round(2.5) = 2# Not

Re: tkinter, overwrite Label-text?

2008-04-11 Thread Bryan Oakley
[EMAIL PROTECTED] wrote: > ok but i have trouble using grid. if i try to use a Label witht he > text answer in the following code it doenst work very well. > Can you describe "have trouble"? What sort of trouble -- syntax errors, the text never shows up, etc? Following is my attempt to use a la

Re: Rounding a number to nearest even

2008-04-11 Thread Mikael Olofsson
[EMAIL PROTECTED] commented about rounding towards even numbers from mid-way between integers as opposed to for instance always rounding up in those cases: > Strange request though, why do you need it that way, because 2.5 is > CLOSER to 3 than to 2... That's exactly how I was taught to do roundi

Re: Graphs in Python

2008-04-11 Thread Henry Chang
Try Google Chart with python wrapper: http://pygooglechart.slowchop.com/ http://code.google.com/apis/chart/ On Thu, Apr 10, 2008 at 10:05 AM, Sanhita Mallick <[EMAIL PROTECTED]> wrote: > Hi. > > I am a newbie to Python. I am trying to implement a > Python code for graph manipulation. My graphs

Re: text adventure game problem

2008-04-11 Thread Neil Cerutti
On Thu, Apr 10, 2008 at 8:25 PM, Carl Banks <[EMAIL PROTECTED]> wrote: > On Apr 10, 2:20 pm, Tommy Nordgren <[EMAIL PROTECTED]> wrote: > > > On 9 apr 2008, at 03.01, [EMAIL PROTECTED] wrote: > > > > > okay, I'm having this one problem with a text adventure game. It's > > > kind of hard to explai

Sr. Lead Architect - (NYC)

2008-04-11 Thread Timothy B
I am in need for a Sr. Lead Architect for an outstanding company located in NYC. The company has been outsourcing their technology to California and are bringing the office to NYC. The company is looking for an individual who can build and manage the technolgy team in NYC. Individual must be a Py

Multiple independent Python interpreters in a C/C++ program?

2008-04-11 Thread skip
This question was posed to me today. Given a C/C++ program we can clearly embed a Python interpreter in it. Is it possible to fire up multiple interpreters in multiple threads? For example: C++ main thread 1 Py_Initialize() thread 2 Py_Initialize() D

simple program

2008-04-11 Thread shawn s
Hi, Here is a simple prog that I can run from the Python shell and it runs fine but when I double click the 'filename.py' , it does not execute the ping statement, and seems like it is stuck at the following output: Fri Apr 11 12:16:09 2008 Testing 192.168.0.1 The prog is as follows: impo

Cannot start RPy - need win32api

2008-04-11 Thread tkpmep
I'm running Python 2.5.2 on Windows XP and need to interface with R, so I downloaded the R 2.6.2 statistical package and installed it, and did the same for RPy 1.02 (i made sure I got the version for Python 2.5 and R 2.62.). When I go to the Python command line and type >>> from rpy import * I get

Re: Multiple independent Python interpreters in a C/C++ program?

2008-04-11 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > This question was posed to me today. Given a C/C++ program we can clearly > embed a Python interpreter in it. Is it possible to fire up multiple > interpreters in multiple threads? For example: > > C++ main > thread 1 > Py_Initialize() >

pyOpenSSL 0.7

2008-04-11 Thread Jean-Paul Calderone
pyOpenSSL is a wrapper around a subset of the OpenSSL API, including support for X509 certificates, public and private keys, and and SSL connections. pyOpenSSL 0.7 fixes a number of memory leaks and memory corruption issues. It also exposes several new OpenSSL APIs to Python: * SSL_get_shutdow

Re: Cannot start RPy - need win32api

2008-04-11 Thread Mike Driscoll
On Apr 11, 11:47 am, [EMAIL PROTECTED] wrote: > I'm running Python 2.5.2 on Windows XP and need to interface with R, > so I downloaded the R 2.6.2 statistical package and installed it, and > did the same for RPy 1.02 (i made sure I got the version for Python > 2.5 and R 2.62.). When I go to the Pyt

Re: Multiple independent Python interpreters in a C/C++ program?

2008-04-11 Thread Matimus
On Apr 11, 9:24 am, [EMAIL PROTECTED] wrote: > This question was posed to me today. Given a C/C++ program we can clearly > embed a Python interpreter in it. Is it possible to fire up multiple > interpreters in multiple threads? For example: > > C++ main > thread 1 > Py_In

Re: Multiple independent Python interpreters in a C/C++ program?

2008-04-11 Thread Matthieu Brucher
2008/4/11, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > This question was posed to me today. Given a C/C++ program we can clearly > embed a Python interpreter in it. Is it possible to fire up multiple > interpreters in multiple threads? For example: > > C++ main > thread 1 >

Re: [lxml-dev] CDATA and lxml

2008-04-11 Thread Stefan Behnel
Hi again, Stefan Behnel wrote: > Silfheed wrote: >> So first off I know that CDATA is generally hated and just shouldn't >> be done, but I'm simply required to parse it and spit it back out. >> Parsing is pretty easy with lxml, but it's the spitting back out >> that's giving me issues. The fact t

Re: String Literal to Blob

2008-04-11 Thread Victor Subervi
I have worked on this many hours a day for two weeks. If there is an easier way to do it, just take a minute or two and point it out. Have you heard of the Law of Diminishing Returns? I have passed it long ago. I no longer want to waste time trying to guess at what you are trying to tell me. Victor

Windows - window status (Running vs Not Responding)

2008-04-11 Thread rdahlstrom
Does anyone know how to determine the window status (Running or Not Responding)? I've tried various methods with no success... This would be on a variety of Windows systems, but all at least XP, and mostly server 2003. Everyone will have Python 2.5.1 on them, and the script would be running loca

Re: Graphs in Python

2008-04-11 Thread Robert Kern
Henry Chang wrote: > Try Google Chart with python wrapper: > > http://pygooglechart.slowchop.com/ > > http://code.google.com/apis/chart/ Wrong kind of graph. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad atte

Re: Rounding a number to nearest even

2008-04-11 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Strange request though, why do you need it that way, because 2.5 is > CLOSER to 3 than to 2... Uhhh, no it isn't. (3 - 2.5) == (2.5 - 2) -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad

Re: Cannot start RPy - need win32api

2008-04-11 Thread tkpmep
Thanks a mill - works like a charm! -- http://mail.python.org/mailman/listinfo/python-list

Re: Rounding a number to nearest even

2008-04-11 Thread Mark Dickinson
On Apr 11, 10:29 am, hdante <[EMAIL PROTECTED]> wrote: > Strangely, a "faster" version is: > > def fast_round(x): > if x % 1 != 0.5: return round(x) > return 2.0*round(x/2.0) You should be a little bit careful with the test x%1 == 0.5 if x might be negative: >>> x = -0.5 + 2**-54 >>> x

Re: How is GUI programming in Python?

2008-04-11 Thread Rune Strand
On Apr 10, 3:54 am, Chris Stewart <[EMAIL PROTECTED]> wrote: ... > > Next, what would you say is the best framework I should look into? > I'm curious to hear opinions on that. GUI-programming in Python is a neanderthal experience. What one may love with console scripts is turned upside-down. Proj

About __init__ and default arguments

2008-04-11 Thread Kevin Takacs
Hi, I'd like to assign the value of an attribute in __init__ as the default value of an argument in a method. See below: class aphorisms(): def __init__(self, keyword): self.default = keyword def franklin(self, keyword = self.default): return "A %s in time saves nine."

Re: Multiple independent Python interpreters in a C/C++ program?

2008-04-11 Thread Skip Montanaro
> Hi,You will only have one the different static Python variables, > so this is not possible. Thanks, that's pretty much what I expected... Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: Graphs in Python

2008-04-11 Thread George Sakkis
On Apr 10, 1:05 pm, Sanhita Mallick <[EMAIL PROTECTED]> wrote: > Hi. > > I am a newbie to Python. I am trying to implement a > Python code for graph manipulation. My graphs are > about 200-500 nodes big. Excepting for the short basic > graph implementation info on Python.org, where can I > find mor

Re: Rounding a number to nearest even

2008-04-11 Thread Lie
On Apr 11, 10:19 pm, Mikael Olofsson <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] commented about rounding towards even numbers > from mid-way between integers as opposed to for instance always rounding > up in those cases: > > > Strange request though, why do you need it that way, because 2.5 is

Re: About __init__ and default arguments

2008-04-11 Thread Steve Holden
Kevin Takacs wrote: > Hi, > > I'd like to assign the value of an attribute in __init__ as the default > value of an argument in a method. See below: > > class aphorisms(): > def __init__(self, keyword): > self.default = keyword > > def franklin(self, keyword = self.default): >

Re: How is GUI programming in Python?

2008-04-11 Thread Steve Holden
Rune Strand wrote: > On Apr 10, 3:54 am, Chris Stewart <[EMAIL PROTECTED]> wrote: > ... >> Next, what would you say is the best framework I should look into? >> I'm curious to hear opinions on that. > > GUI-programming in Python is a neanderthal experience. What one may > love with console scripts

Re: About __init__ and default arguments

2008-04-11 Thread Arnaud Delobelle
On Apr 11, 7:20 pm, Kevin Takacs <[EMAIL PROTECTED]> wrote: > Hi, > > I'd like to assign the value of an attribute in __init__ as the default > value of an argument in a method.  See below: > > class aphorisms(): >     def __init__(self, keyword): >         self.default = keyword > >     def frankl

Profiling programs/scripts?

2008-04-11 Thread skanemupp
how do i profile a program? i found out that there are some profilers included in the standard library but couldnt really figure out how to access/use them -- http://mail.python.org/mailman/listinfo/python-list

Re: String Literal to Blob

2008-04-11 Thread Steve Holden
Victor Subervi wrote: > I have worked on this many hours a day for two weeks. If there is an > easier way to do it, just take a minute or two and point it out. Have > you heard of the Law of Diminishing Returns? I have passed it long ago. > I no longer want to waste time trying to guess at what

Re: About __init__ and default arguments

2008-04-11 Thread Nathan Duran
On Apr 11, 2008, at 11:35 AM, [EMAIL PROTECTED] wrote: > I'd like to assign the value of an attribute in __init__ as the > default > value of an argument in a method. See below: Are you sure? You will not get fresh values with each call in Python as you would in other languages. Why not jus

Re: Windows - window status (Running vs Not Responding)

2008-04-11 Thread rdahlstrom
On Apr 11, 1:45 pm, rdahlstrom <[EMAIL PROTECTED]> wrote: > Does anyone know how to determine the window status (Running or Not > Responding)? I've tried various methods with no success... > > This would be on a variety of Windows systems, but all at least XP, > and mostly server 2003. Everyone w

Question on threads

2008-04-11 Thread Jonathan Shao
Hi all, I'm a beginner to Python, so please bear with me. Is there a way of guarenteeing that all created threads in a program are finished before the main program exits? I know that using join() can guarentee this, but from the test scripts I've run, it seems like join() also forces each individ

Re: Profiling programs/scripts?

2008-04-11 Thread George Sakkis
On Apr 11, 2:49 pm, [EMAIL PROTECTED] wrote: > how do i profile a program? i found out that there are some profilers > included in the standard library but couldnt really figure out how to > access/use them Did you actually read the docs ? There is an example in the stdlib documentation: http://d

Re: Profiling programs/scripts?

2008-04-11 Thread Mike Driscoll
On Apr 11, 1:49 pm, [EMAIL PROTECTED] wrote: > how do i profile a program? i found out that there are some profilers > included in the standard library but couldnt really figure out how to > access/use them Are you talking about using PyChecker or nose or what? In other words, do you want to check

Re: Profiling programs/scripts?

2008-04-11 Thread Aaron Watters
On Apr 11, 2:49 pm, [EMAIL PROTECTED] wrote: > how do i profile a program? i found out that there are some profilers > included in the standard library but couldnt really figure out how to > access/use them I put this at the bottom of my main module: === cut if __name__=="__main__": try:

frozen/builtin modules and new interpreter instances

2008-04-11 Thread Patrick Stinson
So when creating a new interpreter (thread state) are you expected to re-set PyImport_FrozenModules and call yImport_ExtendInittab() again? the former seems to get corrupted between Py_Initialize() and Py_NewInterpreter(). I know that modules are not shared between interpreter instances, and it wou

Re: Question on threads

2008-04-11 Thread Steve Holden
Jonathan Shao wrote: > Hi all, > > I'm a beginner to Python, so please bear with me. > > Is there a way of guarenteeing that all created threads in a program are > finished before the main program exits? I know that using join() can > guarentee this, but from the test scripts I've run, it see

Re: Rounding a number to nearest even

2008-04-11 Thread Mark Dickinson
On Apr 11, 2:33 pm, Lie <[EMAIL PROTECTED]> wrote: > In this table, we consider that a number is rounded down when the > number is equal to truncated value (the number without fractional > part), while round up is equal to truncated value + 1 or truncated > value -1 if value is negative (Actually t

Re: How is GUI programming in Python?

2008-04-11 Thread Rune Strand
On Apr 11, 8:35 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > wxDesigner. Yeah, but it's like Heron of Alexandria's Aeolipile compared to the steam engine of James Watt. IMHO, GUI with Python is pain, pain and utter pain. Even boring and meaningless pain. -- http://mail.python.org/mailman/listin

  1   2   >