Re: Finding Line numbers of HTML file

2007-12-13 Thread Stefan Behnel
Ramdas wrote: > I am doing some HTML scrapping for a side project. > > I need a method using sgmllib or HTMLParser to parse an HTML file and > get line nos of all the tags Try lxml.html, it provides line numbers for each element. http://codespeak.net/lxml/dev/ Stefan -- http://mail.python.org/

Re: urlparse.urlparse bug - misparses long URL

2007-12-13 Thread John Nagle
John Nagle wrote: > Here's a hostile URL that "urlparse.urlparse" seems to have mis-parsed. ... Simpler example: import urlparse s = 'http://www.example.com.mx?https://www.example.com' print urlparse.urlparse(s) produces ('http', 'www.example.com.mx?https:', '//www.example.com', '', '', '') whic

Re: urlparse.urlparse bug - misparses long URL

2007-12-13 Thread Matt Nordhoff
John Nagle wrote: > Here's a hostile URL that "urlparse.urlparse" seems to have mis-parsed. > > http://[EMAIL > PROTECTED]&xUDysvTbzZZOaymjQ2oYIx2AvMdJ1WQfjP02wIBBQBb1EVZAqmmGunxrcyGx1AcfegWUUYtaZfRW434O5Qn6InSMUZXgF5e3KzJbCntBGOj7pv31zab&action=login-run&passkey=e84239c9da59dbeb61d4d45db2cc5

Data Manipulation?

2007-12-13 Thread Merrigan
Hi There, I Posted a while ago about a challenge I had in splitting an E-Mail adress up to use it. Anyways, the same script but different issue. Some Background: The script is going to be used to manage a Virtual User Based E-Mail system. Now the part I'm struggling with is to delete the E-Mail a

Re: Floating point subtraction rounding error (NOT display error)

2007-12-13 Thread Paddy
On Dec 14, 3:22 am, Keflavich <[EMAIL PROTECTED]> wrote: > On Dec 13, 5:52 pm, Steven D'Aprano <[EMAIL PROTECTED] > > cybersource.com.au> wrote: > > On Thu, 13 Dec 2007 14:30:18 -0800, Keflavich wrote: > > > Hey, I have a bit of code that died on a domain error when doing an > > > arcsin, and appar

urlparse.urlparse bug - misparses long URL

2007-12-13 Thread John Nagle
Here's a hostile URL that "urlparse.urlparse" seems to have mis-parsed. http://[EMAIL PROTECTED]&xUDysvTbzZZOaymjQ2oYIx2AvMdJ1WQfjP02wIBBQBb1EVZAqmmGunxrcyGx1AcfegWUUYtaZfRW434O5Qn6InSMUZXgF5e3KzJbCntBGOj7pv31zab&action=login-run&passkey=e84239c9da59dbeb61d4d45db2cc5840&info_hash=%c9q%be%fe%c

Better way to searching.

2007-12-13 Thread farsheed
my code is here: _ def Globing(self, dir, extension, nop, inputDepth): 'It creates a basic glob function that needed in other classes' self.exop = '*.' self.opr = '*/'

Re: Is Python really a scripting language?

2007-12-13 Thread greg
Bruno Desthuilliers wrote: > http://acmqueue.com/modules.php?name=Content&pa=showpage&pid=273 An interesting quote from that: > If you combine Simula and Lisp—Lisp didn’t have data structures, it had > instances of objects—you would have a dynamic type system that would > give you the range of

Re: Windows XP unicode and escape sequences

2007-12-13 Thread John Roth
On Dec 12, 2:51 pm, <[EMAIL PROTECTED]> wrote: > I mainly work on OS X, but thought I'd experiment with some Python code on > XP. The > problem is I can't seem to get these things to work at all. > > First of all, I'd like to use Greek letters in the command prompt window, so > I was going to >

Re: Elementtree tag

2007-12-13 Thread Sean DiZazzo
On Dec 13, 8:46 pm, Waldemar Osuch <[EMAIL PROTECTED]> wrote: > On Dec 13, 7:52 pm, Sean DiZazzo <[EMAIL PROTECTED]> wrote:> I have a another > question... > > > using elementtree, is there a proper way to get at the data > > '123456789' in this tag? > > > '' > > > I tried making it an element, bu

Re: Elementtree tag

2007-12-13 Thread Waldemar Osuch
On Dec 13, 7:52 pm, Sean DiZazzo <[EMAIL PROTECTED]> wrote: > I have a another question... > > using elementtree, is there a proper way to get at the data > '123456789' in this tag? > > '' > > I tried making it an element, but the only attribute that returns > anything is the "tag" attribute. Does

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

2007-12-13 Thread Delaney, Timothy (Tim)
Aahz wrote: >> Unless it's a new style class with __slots__ > > [] > > Naw, I'll skip the rant this time. ;-) Wuss! I was looking forward to it :) Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

Re: re.sub() problem (regular expression)

2007-12-13 Thread Rick Dooling
On Dec 13, 9:00 pm, Davy <[EMAIL PROTECTED]> wrote: > > What's "\1" and the whole re.sub() mean? > Read about backreferences here: http://www.regular-expressions.info/brackets.html Also see the entry on parentheses here: http://docs.python.org/lib/re-syntax.html rick -- http://mail.python.or

Re: determining bytes read from a file.

2007-12-13 Thread vineeth
On Dec 13, 7:50 pm, Chris <[EMAIL PROTECTED]> wrote: > 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

Re: Floating point subtraction rounding error (NOT display error)

2007-12-13 Thread Keflavich
On Dec 13, 5:52 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Thu, 13 Dec 2007 14:30:18 -0800, Keflavich wrote: > > Hey, I have a bit of code that died on a domain error when doing an > > arcsin, and apparently it's because floating point subtraction is having > > problems.

Re: Finding overlapping times...

2007-12-13 Thread Terry Jones
Hi Breal > I have a list that looks like the following > [(10, 100010), (15, 17), (19, 100015)] > > I would like to be able to determine which of these overlap each > other. So, in this case, tuple 1 overlaps with tuples 2 and 3. Tuple > 2 overlaps with 1. Tuple 3 overlaps with

re.sub() problem (regular expression)

2007-12-13 Thread Davy
Hi all, I have read a re.sub() that confused me. s = 'P & Q' s = re.sub(r'([a-zA-Z0-9_.]+)', r'Expr("\1")', s) What's "\1" and the whole re.sub() mean? Best regards, Davy -- http://mail.python.org/mailman/listinfo/python-list

Elementtree tag

2007-12-13 Thread Sean DiZazzo
I have a another question... using elementtree, is there a proper way to get at the data '123456789' in this tag? '' I tried making it an element, but the only attribute that returns anything is the "tag" attribute. Does that section of a tag have any proper name that I'm missing? Or is it jus

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

2007-12-13 Thread Aahz
In article <[EMAIL PROTECTED]>, Christian Heimes <[EMAIL PROTECTED]> wrote: >Steven D'Aprano wrote: >> >> I'm not quite sure I understand that criticism. How is that different >> from things which are not properties? >> >> foo.baz = 2 # oops, I meant bar >> >> will succeed regardless of whether

Re: RegExp Help

2007-12-13 Thread Sean DiZazzo
On Dec 13, 5:49 pm, Sean DiZazzo <[EMAIL PROTECTED]> wrote: > Hi group, > > I'm wrapping up a command line util that returns xml in Python. The > util is flaky, and gives me back poorly formed xml with different > problems in different cases. Anyway I'm making progress. I'm not > very good at re

RegExp Help

2007-12-13 Thread Sean DiZazzo
Hi group, I'm wrapping up a command line util that returns xml in Python. The util is flaky, and gives me back poorly formed xml with different problems in different cases. Anyway I'm making progress. I'm not very good at regular expressions though and was wondering if someone could help with i

Re: Python implementation of "include"

2007-12-13 Thread Gabriel Genellina
En Thu, 13 Dec 2007 19:53:49 -0300, <[EMAIL PROTECTED]> escribió: > As I understand it, import myFile and include "myFile.py" are not quite > the same. > > -- > for import to work myFile.py must be in the same directory as the code > that calls it accessible through PYTHONPATH, whereas include >

Re: Finding overlapping times...

2007-12-13 Thread John Machin
On Dec 14, 12:05 pm, Dave Hansen <[EMAIL PROTECTED]> wrote: > On Dec 13, 5:45 pm, Breal <[EMAIL PROTECTED]> wrote: > > > I have a list that looks like the following > > [(10, 100010), (15, 17), (19, 100015)] > > > I would like to be able to determine which of these overlap each > >

Re: Python implementation of "include"

2007-12-13 Thread Dustan
> [EMAIL PROTECTED] wrote: > > 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.

Re: Finding overlapping times...

2007-12-13 Thread Dave Hansen
On Dec 13, 5:45 pm, Breal <[EMAIL PROTECTED]> wrote: > I have a list that looks like the following > [(10, 100010), (15, 17), (19, 100015)] > > I would like to be able to determine which of these overlap each > other. So, in this case, tuple 1 overlaps with tuples 2 and 3. Tuple >

Re: Is Python really a scripting language?

2007-12-13 Thread Steven D'Aprano
On Thu, 13 Dec 2007 10:32:23 -0800, sturlamolden wrote: > 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

Re: Finding overlapping times...

2007-12-13 Thread John Machin
On Dec 14, 10:45 am, Breal <[EMAIL PROTECTED]> wrote: > I have a list that looks like the following > [(10, 100010), (15, 17), (19, 100015)] > > I would like to be able to determine which of these overlap each > other. So, in this case, tuple 1 overlaps with tuples 2 and 3. Your d

Re: Finding overlapping times...

2007-12-13 Thread Jonathan Gardner
On Dec 13, 3:45 pm, Breal <[EMAIL PROTECTED]> wrote: > I have a list that looks like the following > [(10, 100010), (15, 17), (19, 100015)] > > I would like to be able to determine which of these overlap each > other. So, in this case, tuple 1 overlaps with tuples 2 and 3. Tuple >

Re: Floating point subtraction rounding error (NOT display error)

2007-12-13 Thread Steven D'Aprano
On Thu, 13 Dec 2007 14:30:18 -0800, Keflavich wrote: > Hey, I have a bit of code that died on a domain error when doing an > arcsin, and apparently it's because floating point subtraction is having > problems. I'm not convinced that your diagnosis is correct. Unless you're using some weird, unco

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

2007-12-13 Thread Christian Heimes
Steven D'Aprano wrote: > I'm not quite sure I understand that criticism. How is that different > from things which are not properties? > > foo.baz = 2 # oops, I meant bar > > will succeed regardless of whether foo.bar is an attribute or a property. Unless it's a new style class with __slots__

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

2007-12-13 Thread Steven D'Aprano
On Thu, 13 Dec 2007 13:35:24 -0800, sturlamolden wrote: > On 13 Des, 19:16, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > >> I don't feel that it's especially inconsistent, and I like decorators. >> Having to write foo everywhere isn't that nice, but it's only mildly >> worse than C# to me - I find

Re: Finding overlapping times...

2007-12-13 Thread Shane Geiger
You should give a more real data set (maybe 20 various pairs so that all scenarios can be seen) and the output you want. Breal wrote: > I have a list that looks like the following > [(10, 100010), (15, 17), (19, 100015)] > > I would like to be able to determine which of these ove

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

2007-12-13 Thread Christian Heimes
Duncan Booth wrote: > Unfortunately as currently implemented, getter setter and deleter just > update the existing property, so the getter defined in B changes how the > property works in A as well. I think the intention may have been that they > should create a new property each time, but this

Re: xpath and current python xml libraries

2007-12-13 Thread TreeStages
On Dec 10, 8:03 pm, [EMAIL PROTECTED] wrote: > PyXML seems to be long gone. Is lxml the way to go if i want to have > xpath supported? In our XML Tree Editor XEntrant we use 4Suite XML package, you can try the XPath functionality in this tool: http://www.treestages.com/ -- http://mail.python.org/

Finding overlapping times...

2007-12-13 Thread Breal
I have a list that looks like the following [(10, 100010), (15, 17), (19, 100015)] I would like to be able to determine which of these overlap each other. So, in this case, tuple 1 overlaps with tuples 2 and 3. Tuple 2 overlaps with 1. Tuple 3 overlaps with tuple 1. In my scena

Re: Newbie design problem

2007-12-13 Thread John Machin
On Dec 14, 6:32 am, [EMAIL PROTECTED] wrote: > 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 > >

Re: Floating point subtraction rounding error (NOT display error)

2007-12-13 Thread Keflavich
Solved: used round(number,12) in this case for all of the operands of my arcsines. Not pretty, but at least VIM made it easy... Thanks for the help, Adam On Dec 13, 4:01 pm, Keflavich <[EMAIL PROTECTED]> wrote: > The decimal package isn't what I'm looking for - I don't want to have > to retype

Re: Eclipse/PyQt/Eric4 question

2007-12-13 Thread Fabio Zadrozny
> > Hmmm...but this means that i am forced to do this for ALL .ui files on > the project, either changed or not and this can slow things down... > (pyuic.bat can run for one or for ALL .ui files) > The goal is to find a way to automatically do this only for the > changed ones, like eric does... Wh

Re: Floating point subtraction rounding error (NOT display error)

2007-12-13 Thread Keflavich
The decimal package isn't what I'm looking for - I don't want to have to retype every variable in my code, and I have arcsines showing up on about a dozen lines right now. It also seems like a rather complicated way to deal with the problem; maybe I just need to implement my own rounding code, but

Re: Help Please - Need to make SOAPpy server multithreaded or handle problem some other way

2007-12-13 Thread sberry
On Dec 13, 12:38 pm, sberry <[EMAIL PROTECTED]> wrote: > I have a SOAP server running using SOAPpy. The problem I am having is > that it only handles a single request at a time. It needs to be able > to accept as many simultaneous requests as come in. > > What is the best way to achieve this? I

Re: python vs perl performance test

2007-12-13 Thread igor . tatarinov
On Dec 13, 1:23 pm, Jakub Stolarski <[EMAIL PROTECTED]> wrote: > If all you need is the result here's simpler and more efficient code: > > from random import randrange > sum = 100 * randrange(128) > print "Sum is ", sum > > And the same in perl: > > my $sum = 100 * int(rand(128)); > print "Sum is $

Re: Floating point subtraction rounding error (NOT display error)

2007-12-13 Thread Keflavich
Thanks, I'll have a look at that. I'm not sure the decimal type is included in numpy, though, which is what I'm using. It doesn't show up in their documentation, at least. Adam On Dec 13, 3:39 pm, [EMAIL PROTECTED] (Aahz) wrote: > In article <[EMAIL PROTECTED]>, > > Keflavich <[EMAIL PROTECTED

Re: mailbox.Maildir question/problem

2007-12-13 Thread Ross Ridge
<[EMAIL PROTECTED]> wrote: >Is there *any* way I can get python to access maildirs >which are not named using this (IMHO stupid) convention? Well, the mailbox module doesn't support deleting mailboxes, so I'm not sure why you want to use it. Since you also seem to have a better idea of what your

Re: Python implementation of "include"

2007-12-13 Thread lloyd
Hi Tim, Thanks for the response. As I understand it, import myFile and include "myFile.py" are not quite the same. -- for import to work myFile.py must be in the same directory as the code that calls it accessible through PYTHONPATH, whereas include "../somedirectory/myFile.py" works in Karri

Re: Floating point subtraction rounding error (NOT display error)

2007-12-13 Thread Aahz
In article <[EMAIL PROTECTED]>, Keflavich <[EMAIL PROTECTED]> wrote: > >Hey, I have a bit of code that died on a domain error when doing an >arcsin, and apparently it's because floating point subtraction is >having problems. I know about the impossibility of storing floating >point numbers precis

Floating point subtraction rounding error (NOT display error)

2007-12-13 Thread Keflavich
Hey, I have a bit of code that died on a domain error when doing an arcsin, and apparently it's because floating point subtraction is having problems. I know about the impossibility of storing floating point numbers precisely, but I was under the impression that the standard used for that last dig

Re: looking for gui for python code

2007-12-13 Thread kyosohma
On Dec 13, 11:46 am, "[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 and > distribute it with innosetup.. befor that i would like to add some GUI > support.

Re: Equivalent of perl's Pod::Usage?

2007-12-13 Thread Paddy
On Dec 10, 11:48 am, Adam Funk <[EMAIL PROTECTED]> wrote: > On 2007-12-08, Dennis Lee Bieber wrote: > > > On Fri, 7 Dec 2007 20:12:21 +, Adam Funk <[EMAIL PROTECTED]> > > declaimed the following in comp.lang.python: > > >> I'm using to using Pod::Usage in my Perl programs (a snipped example > >

Re: looking for gui for python code

2007-12-13 Thread Zentrader
Whatever you use, it has to have a Python binding. Spectcl may or may not as you may be able to use it with the tkinter binding, but that is doubtful. Most GUI toolkits have an existing app to look for files in a directory, if that is what you are wanting to do. The following link is to the GUI

Re: Newbie design problem

2007-12-13 Thread Jonathan Gardner
On Dec 13, 11:32 am, [EMAIL PROTECTED] wrote: > Is there a pythonic design I'm overlooking? Well, if using something like PLY ( http://www.dabeaz.com/ply/ ) is considered more Pythonic than writing your own parser and lexer... Python doesn't have all of life's answers unfortunately. -- http://m

Re: Equivalent of perl's Pod::Usage?

2007-12-13 Thread Adam Funk
On 2007-12-10, Nick Craig-Wood wrote: > That said, python does a good job of turning doc strings and class > descriptions into man pages even without any special markup, if you > wrote docstrings everywhere. Try pydoc on any bit of python (without > the .py) and you'll see what I mean > > As for

Re: Changing argument value

2007-12-13 Thread Bruno Desthuilliers
flyfree a écrit : def fooA(y): > > y = [3,4] > return y > > def fooB(y): > > y[0] = 3 > y[1] = 4 > return y > > x = [1,2] fooA(x) > > [3, 4] > x > > [1, 2] > > fooB(x) > > [3, 4] > x > > [3, 4] > === > > From above

Changing argument value

2007-12-13 Thread flyfree
>>> def fooA(y): y = [3,4] return y >>> def fooB(y): y[0] = 3 y[1] = 4 return y >>> x = [1,2] >>> fooA(x) [3, 4] >>> x [1, 2] >>> fooB(x) [3, 4] >>> x [3, 4] === >From above, the original argument value of fooA is same as before [1,2] but the

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

2007-12-13 Thread sturlamolden
On 13 Des, 19:16, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > I don't feel that it's especially inconsistent, and I like decorators. > Having to write foo everywhere isn't that nice, but it's only mildly > worse than C# to me - I find the extra block levels really atrocious. Personally I find pro

Re: python vs perl performance test

2007-12-13 Thread Jakub Stolarski
On 13 Gru, 19:11, [EMAIL PROTECTED] wrote: > There's got to be a simpler and more efficient way to do this. > Can you help? > > Thanks, > igor If all you need is the result here's simpler and more efficient code: from random import randrange sum = 100 * randrange(128) print "Sum is ", sum And t

Re: Python implementation of "include"

2007-12-13 Thread Tim Couper
import myFile would achieve this TIm [EMAIL PROTECTED] wrote: > 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 "

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

2007-12-13 Thread Duncan Booth
Christian Heimes <[EMAIL PROTECTED]> 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 > > @foo.deletter >

Help Please - Need to make SOAPpy server multithreaded or handle problem some other way

2007-12-13 Thread sberry
I have a SOAP server running using SOAPpy. The problem I am having is that it only handles a single request at a time. It needs to be able to accept as many simultaneous requests as come in. What is the best way to achieve this? I really appreciate any help here. -- http://mail.python.org/mai

Re: Eclipse/PyQt/Eric4 question

2007-12-13 Thread king kikapu
> You can create a builder for calling an external program to do that on > builds (right-click project -> properties > Builders). > > Another option is configuring an external program run --> menu: run > > external tools > open external tools dialog (and you can bind a > shortcut to rerun the last

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

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: 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

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

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

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

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: 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

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: 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

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: 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

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: 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: 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 > > > > > @

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: 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

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: 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

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: 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

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: 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: 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: 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: 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

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

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

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: 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: 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 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.

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: 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: 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 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: 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

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: 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

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: 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

  1   2   >