Re: Monitoring the output of an external program

2007-12-13 Thread Vladimir Rusinov
On 12/13/07, Caleb Marcus <[EMAIL PROTECTED]> wrote: > > I'm writing something that has to invoke an external program, and every > time the external program prints something, update a UI. How would I go > about doing this? > Use sys.popen or pexpect module. With pexpect you can even use single th

Re: Difference between del and remove?

2007-12-13 Thread Tim Roberts
Yansky <[EMAIL PROTECTED]> wrote: > >Got a quick n00b question. What's the difference between del and >remove? It would have been easier to answer if you had given a little context. "del" is a Python statement that removes a name from a namespace, an item from a dictionary, or an item from a list

Re: Dynamic or not?

2007-12-13 Thread Tim Roberts
[EMAIL PROTECTED] wrote: > >I'm trying to write a program that will find the distance between two >groups of points in space, which have cartesian co-ordinates X,Y and >Z. > >I need to find the distances between each point in one group and every >point in the other group. So if group 1 has 6 points

Re: Dynamic or not?

2007-12-13 Thread John Machin
On Dec 13, 3:33 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Wed, 12 Dec 2007 19:18:20 -0800, rishiyoor wrote: > > I'm trying to write a program that will find the distance between two > > groups of points in space, which have cartesian co-ordinates X,Y and Z. > > points1

Re: Newbie NameError problem

2007-12-13 Thread cokofreedom
On Dec 12, 7:03 pm, Paul Rudin <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] writes: > > On Dec 12, 5:51 pm, Paul Rudin <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] writes: > >> > I don't understand what I don't understand in the following: > > >> I haven't tried to understand what your code

Re: Dynamic or not?

2007-12-13 Thread Steven D'Aprano
On Thu, 13 Dec 2007 00:39:55 -0800, John Machin wrote: > X, Y, umm, aren't we short a dimension? I'm not going to do *everything* for the OP. He can extend it to three dimensions. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

looping list?

2007-12-13 Thread datulaida ali
hi.. i'm trying to insert value into list according to the key (ASCII) that i generate.. example : win = 95, so must insert into list[95] and = 70, so must insert into list[70] this is my coding.. __ list = [] try: conn = MySQLdb

what the heck does this mean?

2007-12-13 Thread katie smith
Traceback (most recent call last): File "C:\Python25\empire\Empire Strategy.pyw", line 322 Maty = Searched(number) TypeError: 'list' object is not callable My list is NewMap1 =[0,0,0,0,0,0,2,0,2,2,3,2,0,0,0,0] so Maty Searched(number is supposed to give me 0 when Search = "NewMap"

Re: what the heck does this mean?

2007-12-13 Thread Gary Herron
katie smith wrote: > Traceback (most recent call last): > File "C:\Python25\empire\Empire Strategy.pyw", line 322 > Maty = Searched(number) > TypeError: 'list' object is not callable > > My list is NewMap1 =[0,0,0,0,0,0,2,0,2,2,3,2,0,0,0,0] > > so Maty Searched(number is supposed to give

Re: Is Python really a scripting language?

2007-12-13 Thread Bruno Desthuilliers
Doug Morse a écrit : top-post corrected But here's my problem, most of my coworkers, when they see my apps and learn that they are written in Python ask questions like, "Why would you write that in a scripting language?" Whenever I hear a comment like that I can feel mys

Re: Is Python really a scripting language?

2007-12-13 Thread Bruno Desthuilliers
Terry Reedy a écrit : > "Ron Provost" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > But here's my problem, most of my coworkers, when they see my apps and > learn that they are written in Python ask questions like, "Why would you > write that in a scripting language?" Then as

MySQLdb extracting to a list

2007-12-13 Thread dave . dex
Hi all, I've been searching the docs like mad and I'm a little new to python so apologies if this is a basic question. I would like to extract the results of the following query into a list - SELECT columnname FROM tablename. I use the following code. # Create a connection object and create a cu

Re: Is Python really a scripting language?

2007-12-13 Thread Marco Mariani
Bruno Desthuilliers wrote: > As far as I'm concerned, anyone (I mean, anyone pretending to be a > programmer) being ignorant enough to ask such a question ranks high in > my bozo list. Don't waste time with bozos. Alan Kay said it well enough without using words like "pretending", "ignorant"

Re: what the heck does this mean?

2007-12-13 Thread Bruno Desthuilliers
(Answering to Katie Smith) > katie smith wrote: >> Traceback (most recent call last): >> File "C:\Python25\empire\Empire Strategy.pyw", line 322 >> Maty = Searched(number) >> TypeError: 'list' object is not callable And which is line 322 ? >> My list is NewMap1 =[0,0,0,0,0,0,2,0,2,2,3,2,0,0

Re: Is Python really a scripting language?

2007-12-13 Thread Bruno Desthuilliers
Marco Mariani a écrit : > Bruno Desthuilliers wrote: > >> As far as I'm concerned, anyone (I mean, anyone pretending to be a >> programmer) being ignorant enough to ask such a question ranks high in >> my bozo list. Don't waste time with bozos. > > > Alan Kay said it well enough without using

Re: MySQLdb extracting to a list

2007-12-13 Thread John Machin
On Dec 13, 9:03 pm, [EMAIL PROTECTED] wrote: > Hi all, > > I've been searching the docs like mad and I'm a little new to python > so apologies if this is a basic question. > > I would like to extract the results of the following query into a list > - SELECT columnname FROM tablename. I use the foll

Re: what the heck does this mean?

2007-12-13 Thread Remco Gerlich
On Dec 13, 2007 4:57 AM, katie smith <[EMAIL PROTECTED]> wrote: > Traceback (most recent call last): > File "C:\Python25\empire\Empire Strategy.pyw", line 322 > Maty = Searched(number) > TypeError: 'list' object is not callable > This is the error message. The first line basically says "Thi

Very beautiful girls and many useful resources and more, please check it out

2007-12-13 Thread [EMAIL PROTECTED]
Very beautiful girls and many useful resources and more,please check it out http://groups.google.com/group/all-good-things/web/beautiful-girls-and-ladies -- http://mail.python.org/mailman/listinfo/python-list

Re: MySQLdb extracting to a list

2007-12-13 Thread dave . dex
On Dec 13, 10:40 am, John Machin <[EMAIL PROTECTED]> wrote: > On Dec 13, 9:03 pm, [EMAIL PROTECTED] wrote: > > > > > Hi all, > > > I've been searching the docs like mad and I'm a little new to python > > so apologies if this is a basic question. > > > I would like to extract the results of the foll

Re: Is a "real" C-Python possible?

2007-12-13 Thread Bruno Desthuilliers
sturlamolden a écrit : > On 12 Des, 17:00, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > >> Python has not become what it is, and achieved the success it has, >> because a bunch of people really wanted to use Lisp but didn't think >> other people could handle it. >> >> The goal of these sorts of dis

kniterbasdb and datetime

2007-12-13 Thread Laszlo Nagy
Hi All, I connected to a FireBird 1.5 database this way: import kinterbasdb kinterbasdb.init(type_conv=200) # See http://kinterbasdb.sourceforge.net/dist_docs/usage.html#faq_fep_is_mxdatetime_required Then I try to update the database: sql = "UPDATE TABLE1 SET DATEFIELD=? where ID = ?" para

releasing the reference returned by PyLong_FromLong, PyString_FromString & friends

2007-12-13 Thread grbgooglefan
I am having a object tuple created at application startup. This tuple I pass on to a python function in call to: PyObject_CallObject(pcatInfo->pPyEvalFunction,pTuple); For setting the values in this tuple, I am using PyLong_FromLong, PyString_FromString & friends functions. PyTuple_SetItem(pTu

Re: "do" as a keyword

2007-12-13 Thread Tommy Grav
On Wed, 12 Dec 2007 09:46:09 -0600, Chris Mellon wrote: > I agree that it's fundamental, but I'd like to mention that I've > written > many thousands of lines of Python code, from throwaway code for > demonstration to enterprisey servers and all sorts of things in > between > and I've *never*

Re: "do" as a keyword

2007-12-13 Thread BJörn Lindqvist
On Dec 11, 2007 4:06 PM, Neil Cerutti <[EMAIL PROTECTED]> wrote: > > However, did you have an specific need for a do-while construct? > Perhaps we could show you the alternatives. I have wanted do-while loops in exactly one kind of algorithms, when you generate something and you have to keep tryin

Re: determining bytes read from a file.

2007-12-13 Thread Diez B. Roggisch
vineeth wrote: > Hello all, >I have come across a weird problem, I need to determine the amount > of bytes read from a file, but couldn't figure it out , >My program does this : > __ >file = open("somefile") >data = file.read() >print "bytes read ", len(data) > --- > > But t

Re: Difference between del and remove?

2007-12-13 Thread Yansky
Thanks for the clarification guys. :) On Dec 13, 7:05 pm, Tim Roberts <[EMAIL PROTECTED]> wrote: > Yansky <[EMAIL PROTECTED]> wrote: > > >Got a quick n00b question. What's the difference between del and > >remove? > > It would have been easier to answer if you had given a little context. > > "del"

determining bytes read from a file.

2007-12-13 Thread vineeth
Hello all, I have come across a weird problem, I need to determine the amount of bytes read from a file, but couldn't figure it out , My program does this : __ file = open("somefile") data = file.read() print "bytes read ", len(data) --- But the bytes read is not being printed cor

Re: determining bytes read from a file.

2007-12-13 Thread John Machin
On Dec 13, 11:04 pm, vineeth <[EMAIL PROTECTED]> wrote: > Hello all, >I have come across a weird problem, I need to determine the amount > of bytes read from a file, but couldn't figure it out , >My program does this : > __ >file = open("somefile") >data = file.read() >print "by

Re: determining bytes read from a file.

2007-12-13 Thread vineeth
On Dec 13, 5:13 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > vineeth wrote: > > Hello all, > >I have come across a weird problem, I need to determine the amount > > of bytes read from a file, but couldn't figure it out , > >My program does this : > > __ > >file = open("somefile")

problem in reading indices

2007-12-13 Thread Xavier Barthelemy
Hi all I'm becoming mad, because I can't see what's wrong: I am constructing a GUI, to plot some data. so let's have a look of what's wrong: in my code I have a variable named choice[i].current which is the current selection of the i-th Listbox object. it is a tuple, with one element. so when

Re: determining bytes read from a file.

2007-12-13 Thread Matt Nordhoff
vineeth wrote: > parser.add_option("-b", "--bytes", dest="bytes") This is an aside, but if you pass 'type="int"' to add_option, optparse will automatically convert it to an int, and (I think), give a more useful error message on failure. -- -- http://mail.python.org/mailman/listinfo/python-list

Re: determining bytes read from a file.

2007-12-13 Thread vineeth
On Dec 13, 5:27 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Thu, 13 Dec 2007 04:04:59 -0800, vineeth wrote: > >I have come across a weird problem, I need to determine the amount > > of bytes read from a file, but couldn't figure it out , > >My program does this : > > __ > >

XML partial validation.

2007-12-13 Thread Jos� Rui Faustino de Sousa
Hi! I am writing a text to XML parser that as to be easily extensible (via new text format plug-ins) and modifiable if the XML format used changes. Since the text order does not match the XML document order I have to use a package that allows DOM-like handling of XML (elementtree for instance)

Re: Improvements to the Python core

2007-12-13 Thread Paul Boddie
On Dec 13, 3:56 am, Christian Heimes <[EMAIL PROTECTED]> wrote: > Paul Boddie wrote: > > Then you haven't been reading the right IRC channel recently. ;-) > > What's the right channel? I'm on #python and #python-dev But where are people who might know Psyco likely to hang out? ;-) Anyway, it remai

Re: kniterbasdb and datetime

2007-12-13 Thread DarkBlue
On Dec 13, 7:45 pm, Laszlo Nagy <[EMAIL PROTECTED]> wrote: > Hi All, > > I connected to a FireBird 1.5 database this way: > > import kinterbasdb > kinterbasdb.init(type_conv=200) # > Seehttp://kinterbasdb.sourceforge.net/dist_docs/usage.html#faq_fep_is_mx... > > Then I try to update the database

Re: determining bytes read from a file.

2007-12-13 Thread Marc 'BlackJack' Rintsch
On Thu, 13 Dec 2007 04:04:59 -0800, vineeth wrote: >I have come across a weird problem, I need to determine the amount > of bytes read from a file, but couldn't figure it out , >My program does this : > __ >file = open("somefile") >data = file.read() >print "bytes read ", len(d

Re: determining bytes read from a file.

2007-12-13 Thread John Machin
On Dec 13, 11:04 pm, vineeth <[EMAIL PROTECTED]> wrote: > Hello all, >I have come across a weird problem, I need to determine the amount > of bytes read from a file, but couldn't figure it out , >My program does this : > __ >file = open("somefile") >data = file.read() >print "by

Re: E-Mail Parsing

2007-12-13 Thread Merrigan
On Dec 13, 9:29 am, Matt Nordhoff <[EMAIL PROTECTED]> wrote: > Merrigan wrote: > > I am writing a script to administer my E-Mail Server. The One thing > > I'm currently struggling with is kind of Parsing the E-Mail adress > > that I supply to the script. > > > I need to get the username (The part B

Re: E-Mail Parsing

2007-12-13 Thread Matt Nordhoff
Merrigan wrote: > Hi Matt, > > Thank you very much for the help. It was exactly what I was looking > for, and made my script much safer and easier to use. > > Blessings! > > -- Merrigan You're welcome. :-) -- -- http://mail.python.org/mailman/listinfo/python-list

Re: efficient data loading with Python, is that possible possible?

2007-12-13 Thread bearophileHUGS
igor: > The fundamental difference is that in C++, I create a single object (a > line buffer) that's reused for each input line and column values are > extracted straight from that buffer without creating new string > objects. In python, new objects must be created and destroyed by the > million wh

Re: kniterbasdb and datetime

2007-12-13 Thread Laszlo Nagy
DarkBlue írta: > On Dec 13, 7:45 pm, Laszlo Nagy <[EMAIL PROTECTED]> wrote: > >> Hi All, >> >> I connected to a FireBird 1.5 database this way: >> >> import kinterbasdb >> kinterbasdb.init(type_conv=200) # >> Seehttp://kinterbasdb.sourceforge.net/dist_docs/usage.html#faq_fep_is_mx... >> >> Th

Re: problem in reading indices

2007-12-13 Thread Bjoern Schliessmann
Xavier Barthelemy wrote: > so when I call another array with these indices > ArrayWithData[i,int(choice[i].current[0])] You don't "call" "arrays" "with indices". You are indexing the list ArrayWithData using the index "i,int(blah)" which is invalid. Indices must be integers, not comma seperated v

Re: problem in reading indices

2007-12-13 Thread Bruno Desthuilliers
Xavier Barthelemy a écrit : > Hi all > > I'm becoming mad, because I can't see what's wrong: > > I am constructing a GUI, to plot some data. > so let's have a look of what's wrong: > > > > in my code I have a variable named choice[i].current which is the > current selection of the i-th Listbox

Re: doctest quiet again before exit how

2007-12-13 Thread pelavarre
By the way, I copied this 2006-10 clp issue into Bugs.python.org. -- Pat LaVarre """ http://bugs.python.org/issue1611 TITLE: doctest.testmod gets noisy if called more than once per SystemExit SUMMARY: Calling doctest.testmod more than once before SystemExit spews stderr messages such as "*** Do

Re: sqlite weirdness

2007-12-13 Thread kyosohma
On Dec 13, 12:12 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Wed, 12 Dec 2007 16:02:35 -0800 (PST), [EMAIL PROTECTED] declaimed > the following in comp.lang.python: > > > > > Thanks Duncan and John! That makes sense. But why does the official > > Python docs show an example that seems to

Re: sqlite weirdness

2007-12-13 Thread kyosohma
On Dec 13, 1:54 am, Tim Roberts <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > >I'll have to refactor my code somewhat to force it to use the '-MM- > >DD' format. > > Another possible solution is to use a real database. I am using a "real" database: MS SQL Server 2000. Unfortunat

Re: to Doctest as SystemExit is to Python

2007-12-13 Thread pelavarre
> Sent: 2006-11-09; To: comp.lang.python > > Can doctest ... be persuaded to exit after a catastroph[e]...? > ... > sys.exit() doesn't do what I mean: > it raises SystemExit ... [and doesn't exit] > ... > doctest.REPORT_ONLY_FIRST_FAILURE doesn't do what I mean > [it filters stdout but doesn't exit

Re: determining bytes read from a file.

2007-12-13 Thread Chris
A couple potential optimizations: > > # create the member variable name. > mem_var_name = options.inputfilename > mem_var_name = mem_var_name.replace(' ','_') > mem_var_name = mem_var_name.replace('.','_') > mem_var_name = options.inputfilename.replace(' ','_').replace('.','_') No need to assign

Re: Dynamic or not?

2007-12-13 Thread rishiyoor
On Dec 12, 11:33 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Wed, 12 Dec 2007 19:18:20 -0800, rishiyoor wrote: > > I'm trying to write a program that will find the distance between two > > groups of points in space, which have cartesian co-ordinates X,Y and Z. > > > I nee

Re: Finding Line numbers of HTML file

2007-12-13 Thread Ramdas
Hi Paul, I am cross posting the same to grab your attention at pyparsing forums too. 1000 apologies on the same count! I am a complete newbie to parsing and totally new to pyparsing. I have adapted your code to store the line numbers as below. Surprisingly, the line numbers printed, when I scrap

Re: Finding Line numbers of HTML file

2007-12-13 Thread Ramdas
Hi Paul, I am cross posting the same to grab your attention at pyparsing forums too. 1000 apologies on the same count! I am a complete newbie to parsing and totally new to pyparsing. I have adapted your code to store the line numbers as below. Surprisingly, the line numbers printed, when I s

Re: efficient data loading with Python, is that possible possible?

2007-12-13 Thread Neil Cerutti
On 2007-12-13, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Dec 12, 4:03 pm, John Machin <[EMAIL PROTECTED]> wrote: >> Inside your function >> [you are doing all this inside a function, not at global level in a >> script, aren't you?], do this: >> from time import mktime, strptime # do thi

Re: Is anyone happy with csv module?

2007-12-13 Thread Neil Cerutti
On 2007-12-12, John Machin <[EMAIL PROTECTED]> wrote: > On Dec 13, 12:58 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: >> On 2007-12-12, John Machin <[EMAIL PROTECTED]> wrote: >> >> >> It's clear that I am thinking to completely different usages >> >> for CSV than what most people in this thread. I u

Re: kniterbasdb and datetime

2007-12-13 Thread Laszlo Nagy
>> Kinterbasdb probably expects the format looking like >> >> month/day/year >> >> rather than >> >> year-month-day >> All right, I tried the month/day/year version: print sql print params cur.execute(sql,params) Results in: Inserting new TTT codes...insert into ttt( ID, T

Re: Is Python really a scripting language?

2007-12-13 Thread Bruno Desthuilliers
Neil Cerutti a écrit : > On 2007-12-13, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> I have repeatedly argued in the past that we do ourselves a >> disservice by describing Python as an interpreted language. >> >> Python is compiled. It has a compiler. It even has a built-in >> function "compile".

Re: Dynamic or not?

2007-12-13 Thread Marc 'BlackJack' Rintsch
On Thu, 13 Dec 2007 06:51:23 -0800, rishiyoor wrote: > When you say python automatically allocates memory, what would you do > if you don't know the size of the list of, say for example, the > nearest pairs between the two groups. I would probably iterate over > all the pairs and create a new list

Re: How to get milliseconds when substructing datetime objects?

2007-12-13 Thread Dmitri O.Kondratiev
*Gabriel thanks for detailed info! Actually I have already went the same (only more limited :) way as you suggested and did some poking with dir() at datetime and timedelta objects. This time I have bumped into the following problems that I can't find ready solutions yet: Subtracting of datetime

Re: Is Python really a scripting language?

2007-12-13 Thread Neil Cerutti
On 2007-12-13, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > I have repeatedly argued in the past that we do ourselves a > disservice by describing Python as an interpreted language. > > Python is compiled. It has a compiler. It even has a built-in > function "compile". It's just not compiled to *ma

Re: Pascal code checker!

2007-12-13 Thread Neil Cerutti
On 2007-12-13, Dotan Cohen <[EMAIL PROTECTED]> wrote: > On 13/12/2007, Tim Chase <[EMAIL PROTECTED]> wrote: >> >> Oof! Fond as I am of promoting pyparsing, writing a Pascal >> >> compiler (or even just syntax checker) is not a job I would >> >> tackle lightly, much less suggest to a new Python

Re: Pascal code checker!

2007-12-13 Thread Zentrader
The OP was not talking about a Python program to check the Pascal program as I read it > to make application in python > that would send code (text) to pascal compiler...and it would return > result and then application would show that result. So he/she/it would want subprocess to compile the Pas

Re: Question from a python newbie

2007-12-13 Thread Duncan Booth
Russell <[EMAIL PROTECTED]> wrote: > I've searched the Language > Reference and was not able to find any info regarding the structure of > this code fragment: > > int(text) if text.isdigit() else text http://docs.python.org/whatsnew/pep-308.html -- http://mail.python.org/mailman/listinfo/pytho

Re: Finding Line numbers of HTML file

2007-12-13 Thread Paul McGuire
On Dec 13, 9:01 am, Ramdas <[EMAIL PROTECTED]> wrote: > Hi Paul, > > I am cross posting the same to grab your attention at pyparsing forums > too. 1000 apologies on the same count! > > I am a complete newbie to parsing and totally new to pyparsing. > > I have adapted your code to store the line num

Re: Question from a python newbie

2007-12-13 Thread Remco Gerlich
On Dec 13, 2007 4:39 PM, Russell <[EMAIL PROTECTED]> wrote: > I've been learning Python slowly for a few months, coming from a C/C+ > +, C#, Java, PHP background. I ran across a code fragment I'm having > trouble wrapping my brain around. I've searched the Language > Reference and was not able t

Re: Is Python really a scripting language?

2007-12-13 Thread Paul Rudin
Neil Cerutti <[EMAIL PROTECTED]> writes: > On 2007-12-13, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> I have repeatedly argued in the past that we do ourselves a >> disservice by describing Python as an interpreted language. >> >> Python is compiled. It has a compiler. It even has a built-in >>

Re: Dynamic or not?

2007-12-13 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > On Dec 12, 11:33 pm, Steven D'Aprano <[EMAIL PROTECTED] > cybersource.com.au> wrote: (snip) > > When you say python automatically allocates memory, what would you do > if you don't know the size of the list thelist = [] thelist.append('Ever') thelist.append('bothered

Re: Tuples !?!?

2007-12-13 Thread Jason
On Dec 11, 3:08 pm, [EMAIL PROTECTED] wrote: > On 11 Dez, 22:02, [EMAIL PROTECTED] wrote: > > > Ok. This is small code. > > > The problem is '2' != 2 there is a way of converting 'some number' in > > number ? > > > Thanks. > > > # -*- coding: cp1252 -*- > > import random > > import csv > > import s

Re: Is Python really a scripting language?

2007-12-13 Thread Neil Cerutti
On 2007-12-13, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Neil Cerutti a écrit : >> On 2007-12-13, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >>> I have repeatedly argued in the past that we do ourselves a >>> disservice by describing Python as an interpreted language. >>> >>> Python is compi

Question from a python newbie

2007-12-13 Thread Russell
I've been learning Python slowly for a few months, coming from a C/C+ +, C#, Java, PHP background. I ran across a code fragment I'm having trouble wrapping my brain around. I've searched the Language Reference and was not able to find any info regarding the structure of this code fragment: int(t

Re: kniterbasdb and datetime

2007-12-13 Thread Uwe Grauer
Laszlo Nagy wrote: > > Hi All, > > I connected to a FireBird 1.5 database this way: > > import kinterbasdb > kinterbasdb.init(type_conv=200) # See > http://kinterbasdb.sourceforge.net/dist_docs/usage.html#faq_fep_is_mxdatetime_required > > > Then I try to update the database: > > sql = "UPDA

Re: Question from a python newbie

2007-12-13 Thread Russell
I suspected it was a ternary type of operator, but was unable to confirm it. And I didn't realize it was new to 2.5. Perfectly clear now. :) Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Question from a python newbie

2007-12-13 Thread J. Clifford Dyer
On Thu, Dec 13, 2007 at 04:57:04PM +0100, Remco Gerlich wrote regarding Re: Question from a python newbie: > >On Dec 13, 2007 4:39 PM, Russell <[EMAIL PROTECTED]> wrote: > > I've been learning Python slowly for a few months, coming from a > C/C+ > +, C#, Java, PHP background.

how to include a tiny debug feature in my project ?

2007-12-13 Thread Stef Mientki
hello, I've large program based, with a GUI based on wxPython, where the user can add small parts, which I call Bricks. A new Brick is created by inheriting from the standard-Brick. The user should only override 1 or 2 functions from the standard-Brick. The main properties used in those 2 function

Clearing a DOS terminal in a script

2007-12-13 Thread Stephen_B
This doesn't seem to work in a dos terminal at the start of a script: from os import popen print popen('clear').read() Any idea why not? Thanks. Stephen -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic or not?

2007-12-13 Thread rishiyoor
On Dec 13, 10:24 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Thu, 13 Dec 2007 06:51:23 -0800, rishiyoor wrote: > > When you say python automatically allocates memory, what would you do > > if you don't know the size of the list of, say for example, the > > nearest pairs between the

Re: how to include a tiny debug feature in my project ?

2007-12-13 Thread Diez B. Roggisch
Stef Mientki wrote: > hello, > > I've large program based, with a GUI based on wxPython, > where the user can add small parts, which I call Bricks. > A new Brick is created by inheriting from the standard-Brick. > The user should only override 1 or 2 functions from the standard-Brick. > The main

Re: How to get milliseconds when substructing datetime objects?

2007-12-13 Thread Dmitri O.Kondratiev
While looking for ready to use library I have roughly skteched the functions that I need: import datetime from datetime import * def timedelta2Micros(dt): """ Convert timedelta object to micriseconds""" days = dt.days sec = dt.seconds micros = dt.microseconds daysSec = 24 * 60

Re: Monitoring the output of an external program

2007-12-13 Thread Calvin Spealman
I always recommend the subprocess module for any needs like this. Read up on it and it should provide everything you need. On Dec 13, 2007, at 2:41 AM, Caleb Marcus wrote: > I'm writing something that has to invoke an external program, and > every time the external program prints something, u

Re: what the heck does this mean?

2007-12-13 Thread Calvin Spealman
On Dec 12, 2007, at 10:57 PM, katie smith wrote: Traceback (most recent call last): File "C:\Python25\empire\Empire Strategy.pyw", line 322 Maty = Searched(number) Look, you're calling Searched right here with Searched(number) TypeError: 'list' object is not callable ... Maty

Re: Clearing a DOS terminal in a script

2007-12-13 Thread Chris Mellon
On Dec 13, 2007 10:48 AM, Stephen_B <[EMAIL PROTECTED]> wrote: > This doesn't seem to work in a dos terminal at the start of a script: > > from os import popen > print popen('clear').read() > > Any idea why not? Thanks. It opens "clear" with it's own virtual terminal and clears that instead. Ther

Re: Clearing a DOS terminal in a script

2007-12-13 Thread Stephen_B
On Dec 13, 11:21 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > It opens "clear" with it's own virtual terminal and clears that > instead. Even when I launch the script from a cmd shell with "python myscript.py"? > There's an ANSI control code you can use to reset the screen, try printing > tha

looking for gui for python code

2007-12-13 Thread [EMAIL PROTECTED]
hi i have written some python scripts which take command line arguments and do some job. i would like to make it into a .exe using py2exe and distribute it with innosetup.. befor that i would like to add some GUI support..i mean select some values using a folder explorer etc..which would be a good

Re: looking for gui for python code

2007-12-13 Thread James Matthews
Using any GUI package you should be able to build your application into EXE format! On Dec 13, 2007 6:46 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > hi > i have written some python scripts which take command line arguments > and do some job. i would like to make it into a .exe using py2exe

Re: Is a "real" C-Python possible?

2007-12-13 Thread Patrick Mullen
> > > > Kay Schluehr wrote: > > > > Python 2.6 and 3.0 have a more Pythonic way for the problem: > > > > class A(object): > > > > @property > > > > def foo(self): > > > > return self._foo > > > > @foo.setter > > > > def foo(self, value) > > > > self._foo = value > >

Re: Best way to protect my new commercial software.

2007-12-13 Thread farsheed
Thank you all. I explain what I did to do it. Very simple but what I want: I find the host id of system (using ipconfig) and create a hash code based on it.(some math, md5 and functions). the code for licensing is about 15 lines and is very fast. I needed 20 licenses and I wrote a keygen for mysel

python vs perl performance test

2007-12-13 Thread igor . tatarinov
First, let me admit that the test is pretty dumb (someone else suggested it :) but since I am new to Python, I am using it to learn how to write efficient code. my $sum = 0; foreach (1..10) { my $str = chr(rand(128)) x 1024; foreach (1..100) { my $substr = substr($str, rand(900

Re: Is a "real" C-Python possible?

2007-12-13 Thread Chris Mellon
On Dec 13, 2007 12:04 PM, Patrick Mullen <[EMAIL PROTECTED]> wrote: > > > > > Kay Schluehr wrote: > > > > > Python 2.6 and 3.0 have a more Pythonic way for the problem: > > > > > class A(object): > > > > > @property > > > > > def foo(self): > > > > > return self._foo > > > > > @

Re: Is Python really a scripting language?

2007-12-13 Thread sturlamolden
On 13 Des, 02:19, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > I have repeatedly argued in the past that we do ourselves a disservice by > describing Python as an interpreted language. Python is compiled. It has > a compiler. It even has a built-in function "compile". Python is

Re: How to get milliseconds when substructing datetime objects?

2007-12-13 Thread Gabriel Genellina
En Thu, 13 Dec 2007 14:07:10 -0300, Dmitri O.Kondratiev <[EMAIL PROTECTED]> escribi�: > While looking for ready to use library I have roughly skteched the > functions > that I need: They look fine to me. Just one thing: > days = micros / oneDayMicros # whole number of days It's safer to

Re: TCP reset caused by socket.py

2007-12-13 Thread Gabriel Genellina
En Wed, 12 Dec 2007 20:12:43 -0300, Object01 <[EMAIL PROTECTED]> escribi�: > I don't know much about the timing of Python's garbage collection. Is > it pretty aggressive? As soon as the reference count reaches zero (at least for current CPython version). Objects that are part of a reference cy

Christmas Shopping Made Easy

2007-12-13 Thread rzt8lias
This site helped me during the holidays.Check out http://www.christmasplayland.com which offers some great resources and tons of deals.I definitely saved time shopping for deals online at this site. -- http://mail.python.org/mailman/listinfo/python-list

Re: python vs perl performance test

2007-12-13 Thread Chris Mellon
On Dec 13, 2007 12:11 PM, <[EMAIL PROTECTED]> wrote: > First, let me admit that the test is pretty dumb (someone else > suggested it :) but since I am new to Python, I am using it to learn > how to write efficient code. > > my $sum = 0; > foreach (1..10) { > my $str = chr(rand(128)) x 1024

Re: Clearing a DOS terminal in a script

2007-12-13 Thread John Machin
On Dec 14, 3:48 am, Stephen_B <[EMAIL PROTECTED]> wrote: > This doesn't seem to work in a dos terminal at the start of a script: > > from os import popen > print popen('clear').read() > > Any idea why not? Thanks. Maybe you are using a different "dos terminal". What is "clear"? C:\junk>clear 'cle

Re: Dynamic or not?

2007-12-13 Thread John Machin
On Dec 14, 2:29 am, Bruno Desthuilliers While you're at it, add list comprehensions, > iterators/generators and itertools to the list (pun intented). > 'Intented' is a novel word; is it the opposite of 'decamped'? -- http://mail.python.org/mailman/listinfo/python-list

Newbie design problem

2007-12-13 Thread MartinRinehart
Thanks to a lot of help, I've got the outer framework for my tokenizer down to this: for line_number, line in enumerate(text): output = '' for char_number, char in enumerate(line): output += char print 'At ' + str(line_number) + ', '+ str(char_number) + ':

Re: python vs perl performance test

2007-12-13 Thread Arnaud Delobelle
On Dec 13, 6:11 pm, [EMAIL PROTECTED] wrote: > from random import randrange > from itertools import imap, repeat > from operator import getitem, add, getslice > > result = 0 > zeros = [0]*100 > for i in xrange (10): > s = [chr(randrange(128))] * 1024 > starts = repeat(randrange(900), 1

Eclipse/PyQt/Eric4 question

2007-12-13 Thread king kikapu
Hi, this is actually goes to whoever is using Eclipse and Eric4, the IDE that comes bundled with PyQt. I was using Eclipse until i saw Eric4 and i started experiment with it, very nice work. Eric4 has a feature that actually reminds us the work of some expensive IDEs, like Visual Studio, Delphi an

Python implementation of "include"

2007-12-13 Thread lloyd
Hello, I've been using the Python-based Karrigell web application framework. It has the very handy word "include" that inserts a code file into into the stream of execution. E.g. if myFile.py contains the code: print "This is a message from myFile.py" and my script is: print "Something" include

Re: Eclipse/PyQt/Eric4 question

2007-12-13 Thread Fabio Zadrozny
> In Eclipse, i have the luxury of double-click a .ui file and thus Qt > Designer opens and then design my forms there, but i cannot fing an > automatic way to accomplish the thing that eric4 does: e.x. > automatically compile changed .ui files when i hit F9. And it really a > loss of time to go to

Re: releasing the reference returned by PyLong_FromLong, PyString_FromString & friends

2007-12-13 Thread Gabriel Genellina
En Thu, 13 Dec 2007 08:50:09 -0300, grbgooglefan <[EMAIL PROTECTED]> escribi�: > I am having a object tuple created at application startup. This tuple > I pass on to a python function in call to: > PyObject_CallObject(pcatInfo->pPyEvalFunction,pTuple); > > For setting the values in this tuple, I

Re: Best way to protect my new commercial software.

2007-12-13 Thread Ben Finney
farsheed <[EMAIL PROTECTED]> writes: > the code for licensing is about 15 lines and is very fast. I needed > 20 licenses and I wrote a keygen for myself. Given that you still haven't explained what threat in particular you're securing against, I wonder whether "very fast" is the only criterion. I

  1   2   >