Re: wikipedia with python

2009-06-24 Thread ZeLegolas
On Mon, 22 Jun 2009 19:23:59 +0200, Andre Engels wrote: > On Mon, Jun 22, 2009 at 6:58 PM, zelegolas wrote: >> Let me know if it's the right place to ask. >> >> I'm looking for wiki writen with python where I can import all >> wikipedia site. >> If you have any links please let me know. > > I do

Re: Reading a large csv file

2009-06-24 Thread Chris Withers
Terry Reedy wrote: Mag Gam wrote: Yes, the system has 64Gig of physical memory. drool ;-). Well, except that, dependent on what OS he's using, the size of one process may well still be limited to 2GB... Chris -- Simplistix - Content Management, Zope & Python Consulting - http:

Re: re.NONE

2009-06-24 Thread John Machin
On Jun 23, 8:35 am, 1x7y2z9 <1x7y...@gmail.com> wrote: > I am currently using python v2.5.2. > > Not sure if this is defined in a later version, but it would be nice > to define re.NONE = 0 in the re module.  This would be useful in cases > such as: > flags = re.DOTALL if dotall else re.NONE > > Al

Re: wikipedia with python

2009-06-24 Thread Tim Harig
On 2009-06-22, ZeLegolas wrote: > On Mon, 22 Jun 2009 19:23:59 +0200, Andre Engels > wrote: >> On Mon, Jun 22, 2009 at 6:58 PM, zelegolas wrote: >>> I'm looking for wiki writen with python where I can import all >>> wikipedia site. >> PHP. >> What do you want to use the material for? > Well sorry

Re: wikipedia with python

2009-06-24 Thread Andre Engels
On Wed, Jun 24, 2009 at 9:17 AM, Tim Harig wrote: > [ ] D. You already have mediawiki running on a webserver; but, you would >        like to get data from another mediawiki server that you don't have >        direct database access to; so, you would like to write a script in >        Python to sc

Re: walking a directory with very many files

2009-06-24 Thread Lie Ryan
Lawrence D'Oliveiro wrote: > In message , Steven > D'Aprano wrote: > >> On Tue, 23 Jun 2009 10:29:21 -0400, Mel wrote: >> >>> Steven D'Aprano wrote: >>> Lawrence D'Oliveiro wrote: >> Ok, now pipe ls to less, take three days to browse through all the >> filenames to locate the fi

Re: wikipedia with python

2009-06-24 Thread Lie Ryan
ZeLegolas wrote: > On Mon, 22 Jun 2009 19:23:59 +0200, Andre Engels > wrote: >> On Mon, Jun 22, 2009 at 6:58 PM, zelegolas wrote: >>> Let me know if it's the right place to ask. >>> >>> I'm looking for wiki writen with python where I can import all >>> wikipedia site. >>> If you have any links ple

Re: re.NONE

2009-06-24 Thread John Machin
On Jun 24, 5:18 pm, John Machin wrote: > On Jun 23, 8:35 am, 1x7y2z9 <1x7y...@gmail.com> wrote: > > > I am currently using python v2.5.2. > > > Not sure if this is defined in a later version, but it would be nice > > to define re.NONE = 0 in the re module.  This would be useful in cases > > such a

Re: Best way to enumerate classes in a module

2009-06-24 Thread Carl Banks
On Jun 23, 10:02 pm, Дамјан Георгиевски wrote: > I need to programmaticaly enumerate all the classes in a given module. > Currently I'm using dir(module) but the Notice on the documentation page > [1]  says "dir() is supplied primarily as a convenience for use at an > interactive prompt" so that k

Re: GNUstep and Python

2009-06-24 Thread Lele Gaifax
Eric Brunel writes: > Diez B. Roggisch wrote: >> Paul Watson schrieb: >> There is the pyobjc-binding for OSX, maybe that's suitable for GNUStep. > > Apparently, it's not: There was some compatibility in earlier versions, but > it's been officially removed in version 2.0. See > http://pyobjc.sourc

RE: Converting Python code to C/C++

2009-06-24 Thread Couper, Tim T
Your prof. may find this thread of interest http://mail.python.org/pipermail/python-list/2000-June/039779.html My experience is that developers who know C and C++ can be productive in less than 1 week in python, and find it liberating, and educational, to do so. And at the same time they will hav

Re: Meta question: disappearing posts (was Re: calculating aself.value, self.randomnum = normalvariate(x, y))

2009-06-24 Thread Hendrik van Rooyen
"Aahz" wrote: > While that's also a bug in Mailman (I have a long-standing to-do item to > fix that), there are also plenty of posts that simply aren't showing up > in c.l.py. As I said, I'm pretty sure (based on what was happening with > c.l.py.announce) that it's some kind of weird problem wit

Re: Measuring Fractal Dimension ?

2009-06-24 Thread pdpi
On Jun 23, 6:49 pm, Lie Ryan wrote: > Mark Dickinson wrote: > > On Jun 23, 3:52 am, Steven D'Aprano > > wrote: > >> On Mon, 22 Jun 2009 13:43:19 -0500, David C. Ullrich wrote: > >>> In my universe the standard definition of "log" is different froim what > >>> log means in a calculus class > >> No

Dictionary self lookup

2009-06-24 Thread Norberto Lopes
Hi all. Assuming that python dictionaries already provide a bit of "shoot yourself in the foot", I think what I have in mind would not be so bad. What do you think of dictionaries having a self lookup in their declaration? Be able to do this: a = {"foo" : "foo1", "bar" : a["foo"]} # or with anot

Re: Open source python projects

2009-06-24 Thread saurabh
Thanks a lot everyone for your prompt replies. I am really glad to see so many options for me. I am sure joining any of the above projects will enrich my understanding of python and programming.I will just have to find out , to which project I will be most useful.I will definitely join one

Re: Dictionary self lookup

2009-06-24 Thread Diez B. Roggisch
Norberto Lopes wrote: > Hi all. > Assuming that python dictionaries already provide a bit of "shoot > yourself in the foot", I think what I have in mind would not be so > bad. What kind of foot-shooting do you have in mind? > > What do you think of dictionaries having a self lookup in their > de

Re: Python 3.0.1 and mingw

2009-06-24 Thread smartmobili
On 24 juin, 05:06, Kay Schluehr wrote: > On 24 Jun., 00:59, smartmobili wrote: > > > > > > > > > I wanted to know if you have some patch to compile python 3.x on mingw > > platform because I found some > > but doesn't work very well : > > >     make > > > gcc   -o python.exe \ > > Modules/python.

Re: Dictionary self lookup

2009-06-24 Thread Diez B. Roggisch
Norberto Lopes wrote: > Hi all. > Assuming that python dictionaries already provide a bit of "shoot > yourself in the foot", I think what I have in mind would not be so > bad. > > What do you think of dictionaries having a self lookup in their > declaration? > > Be able to do this: > > a = {"fo

Re: Dictionary self lookup

2009-06-24 Thread Chris Rebert
On Wed, Jun 24, 2009 at 2:39 AM, Norberto Lopes wrote: > Hi all. > Assuming that python dictionaries already provide a bit of "shoot > yourself in the foot", I think what I have in mind would not be so > bad. > > What do you think of dictionaries having a self lookup in their > declaration? > > Be

Re: Dictionary self lookup

2009-06-24 Thread Norberto Lopes
On Jun 24, 11:59 am, "Diez B. Roggisch" wrote: > Norberto Lopes wrote: > > Hi all. > > Assuming that python dictionaries already provide a bit of "shoot > > yourself in the foot", I think what I have in mind would not be so > > bad. > > What kind of foot-shooting do you have in mind? > a = { "foo

Re: Dictionary self lookup

2009-06-24 Thread Norberto Lopes
On Jun 24, 12:05 pm, Chris Rebert wrote: > On Wed, Jun 24, 2009 at 2:39 AM, Norberto Lopes wrote: > > Hi all. > > Assuming that python dictionaries already provide a bit of "shoot > > yourself in the foot", I think what I have in mind would not be so > > bad. > > > What do you think of dictionarie

fileinput.input, readlines and ...

2009-06-24 Thread Przemyslaw Bak
Hello, I many files with log data. The structure of the file is quite inconvenience and similar to the following example: Data1 ValueA Data2 ValueB Data3 ValueC ... To get the values I need to find Data* and then get to the next line. I tried to use fileinput.input : ... for line in fileinpu

Windows: open() -> "[Errno 38] Filename too long"

2009-06-24 Thread robert
When doing open/os.stat/...(dirpath+filename) and total path > 250 chars then OSError: "[Errno 38] Filename too long" is there a way to access the file without changing to that directory (its in a thread and a fast iteration of many file too) ? -- http://mail.python.org/mailman/listinfo/python

Re: Windows: open() -> "[Errno 38] Filename too long"

2009-06-24 Thread Tim Golden
robert wrote: When doing open/os.stat/...(dirpath+filename) and total path > 250 chars then OSError: "[Errno 38] Filename too long" is there a way to access the file without changing to that directory (its in a thread and a fast iteration of many file too) ? Change filename r"c:\temp\lon

Re: Measuring Fractal Dimension ?

2009-06-24 Thread Mark Dickinson
On Jun 24, 10:12 am, pdpi wrote: > Regarding inf ** 0, why does IEEE745 define it as 1, when there is a > perfectly fine NaN value? Have a look at: http://www.eecs.berkeley.edu/~wkahan/ieee754status/ieee754.ps (see particularly page 9). Mark -- http://mail.python.org/mailman/listinfo/python-l

Re: Dictionary self lookup

2009-06-24 Thread Diez B. Roggisch
Norberto Lopes wrote: > On Jun 24, 11:59 am, "Diez B. Roggisch" wrote: >> Norberto Lopes wrote: >> > Hi all. >> > Assuming that python dictionaries already provide a bit of "shoot >> > yourself in the foot", I think what I have in mind would not be so >> > bad. >> >> What kind of foot-shooting do

Re: Dictionary self lookup

2009-06-24 Thread Norberto Lopes
On Jun 24, 1:21 pm, "Diez B. Roggisch" wrote: > Norberto Lopes wrote: > > On Jun 24, 11:59 am, "Diez B. Roggisch" wrote: > >> Norberto Lopes wrote: > >> > Hi all. > >> > Assuming that python dictionaries already provide a bit of "shoot > >> > yourself in the foot", I think what I have in mind wou

Re: fileinput.input, readlines and ...

2009-06-24 Thread Peter Otten
Przemyslaw Bak wrote: > Hello, > > I many files with log data. The structure of the file is quite > inconvenience and similar to the following example: > Data1 > ValueA > Data2 > ValueB > Data3 > ValueC > ... > To get the values I need to find Data* and then get to the next line. > I tried

Re: Reading a large csv file

2009-06-24 Thread Mag Gam
Sorry for the delayed response. I was trying to figure this problem out. The OS is Linux, BTW Here is some code I have: import numpy as np from numpy import * import gzip import h5py import re import sys, string, time, getopt import os src=sys.argv[1] fs = gzip.open(src) x=src.split("/") filena

Re: Python 3.0.1 and mingw

2009-06-24 Thread lkcl
On Jun 23, 10:59 pm, smartmobili wrote: > I wanted to know if you have some patch to compile python 3.x on mingw > platform because I found some > but doesn't work very well : you should compile a 2.N version. despite efforts and proof that the efforts passed all but about 8-12 regression test

Re: Newbie queue question

2009-06-24 Thread Чеширский Кот
1. say me dbf files count? 2. why dbf ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Measuring Fractal Dimension ?

2009-06-24 Thread Steven D'Aprano
On Mon, 22 Jun 2009 13:43:19 -0500, David C. Ullrich wrote: > In my universe the standard definition of "log" is different froim what > log means in a calculus class Now I'm curious what the difference is. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Measuring Fractal Dimension ?

2009-06-24 Thread Mark Dickinson
On Jun 24, 10:12 am, pdpi wrote: > Regarding inf ** 0, why does IEEE745 define it as 1, when there is a > perfectly fine NaN value? Other links: the IEEE 754 revision working group mailing list archives are public; there was extensive discussion about special values of pow and similar functions

Decode a barcode ?

2009-06-24 Thread Stephane Wirtel
Hi all, I would like to know if there is a way to decode a barcode with a library ? Thank you so much, Stephane -- Stephane Wirtel - "As OpenERP is OpenSource, please feel free to contribute." Developper - Technical Lecturer OpenERP OpenERP - Tiny SPRL Chaussee de Namur, 40 B-1367 Gerompont Tel

Re: dynamically associate radio buttons with droplists

2009-06-24 Thread Shoryuken
On Jun 21, 8:43 pm, a...@pythoncraft.com (Aahz) wrote: > In article > ,LeoBrugud  > wrote: > > > > >Not being very familiar with python, nor with cgi/http,  I intend to > >have 3 of buttons in a webpage, each of them is associate with a file > >(so I have 3 files, too) > > >What I would like to h

Re: Decode a barcode ?

2009-06-24 Thread Chris Withers
Stephane Wirtel wrote: I would like to know if there is a way to decode a barcode with a library ? What do you mean by decode? Do you mean starting with a .gif or something containing a barcode? Most barcode readers just act as keyboards, so you don't often need to do this ;-) If you mean s

Re: Decode a barcode ?

2009-06-24 Thread Marco Bizzarri
If you're looking for a library in python to find barcodes inside an image, and then decoding it, I'm afraid you're out of luck; as far as I can tell, there is no such a library available. In case you're looking for the theory on how to do that, I think this group is not the best suited to post s

Guppy-PE/Heapy 0.1.9 released

2009-06-24 Thread Sverker Nilsson
I am happy to announce Guppy-PE 0.1.9 Guppy-PE is a library and programming environment for Python, currently providing in particular the Heapy subsystem, which supports object and heap memory sizing, profiling and debugging. It also includes a prototypical specification language, the Guppy Specif

IMPORTANT: I NEED TO HELP WITH ONE OF THE CORE DEVELOPERS

2009-06-24 Thread Pegasus
I need help with an implementation of your interpreter under PSPE/PSP. I need to know something about the C functions that are recalled by the interpreter when it executes a .pyc file. Our version of ndPython is very slow in execution respect to Carlos's StackLess Python (another product for PSP)

Re: IDLE / Python 2.5 under Jaunty

2009-06-24 Thread Michiel Overtoom
Duncan Smith wrote: > IDLE now refuses to respond to left click events (for code editing, menus etc. respond as expected). If I right click, then left click I can move the cursor, but that's not ideal. > So, has anybody else had the left click issue with IDLE (and solved it)? Irritating p

Re: Meta question: disappearing posts (was Re: calculating a self.value, self.randomnum = normalvariate(x, y))

2009-06-24 Thread Ross Ridge
Ross Ridge wrote: >I'm not sure what MIME would have to do with it, but Piet van Oostrum's >problem is almost certainly as result of the python.org mail to news >gateway mangling the References header. The missing postings he's looking >for don't actually exist. Just go up the thread one more p

Re: Measuring Fractal Dimension ?

2009-06-24 Thread Hendrik van Rooyen
"Steven D'Aprano" wrote: >On Mon, 22 Jun 2009 13:43:19 -0500, David C. Ullrich wrote: > >> In my universe the standard definition of "log" is different froim what >> log means in a calculus class > >Now I'm curious what the difference is. > Maybe he is a lumberjack, and quite all right... - He

Re: C-extension 2 times slower than exe

2009-06-24 Thread Rolf Wester
Hello, thank you all very much for your replies. I tried to simplify things and make the two versions as comparable as possible. I put the C++ part of the program into a shared object libff.so. For the exe the main function is linked against this shared object. For the python stuff I made an inte

Re: Converting Python code to C/C++

2009-06-24 Thread Grant Edwards
On 2009-06-24, Couper, Tim T wrote: > Your prof. may find this thread of interest > > http://mail.python.org/pipermail/python-list/2000-June/039779.html > > My experience is that developers who know C and C++ can be productive in > less than 1 week in python, and find it liberating, and education

Reading then sending new parts of a log file

2009-06-24 Thread Chuck Connors
Hey guys. I'm trying to work up a little program that will send any new lines written to a file (log file from my home automation software) to me via instant message. I've gotten the instant message sending part figured out using xmpppy. I've done a few things with Python in the past but I am in

Re: Measuring Fractal Dimension ?

2009-06-24 Thread pdpi
On Jun 24, 2:58 pm, "Hendrik van Rooyen" wrote: > "Steven D'Aprano" wrote: > >On Mon, 22 Jun 2009 13:43:19 -0500, David C. Ullrich wrote: > > >> In my universe the standard definition of "log" is different froim what > >> log means in a calculus class > > >Now I'm curious what the difference is.

Re: dynamically associate radio buttons with droplists

2009-06-24 Thread Aahz
In article <16b382ee-a3ae-46ee-88fd-d87fc40d2...@g20g2000vba.googlegroups.com>, Shoryuken wrote: >On Jun 21, 8:43=A0pm, a...@pythoncraft.com (Aahz) wrote: >> In article .com>,LeoBrugud=A0 wrote: >>> >>>Not being very familiar with python, nor with cgi/http, =A0I intend to >>>have 3 of buttons in

Re: Python 3.0.1 and mingw

2009-06-24 Thread Gabriel Genellina
En Wed, 24 Jun 2009 08:55:07 -0300, lkcl escribió: On Jun 23, 10:59 pm, smartmobili wrote: I wanted to know if you have some patch to compile python 3.x on mingw platform because I found some but doesn't work very well : you should compile a 2.N version. [...] http://bugs.python.org/i

isinstance(obj, type(obj)) == True?

2009-06-24 Thread Art
I have the following problem: ipdb> p type(self) ipdb> isinstance(self, component.BiasComponent) False I thought that isinstance(obj, type(obj)) == True. The specific problem is when I try to call the super of a class and it only occurs after 'reload'ing the file in the interpreter. What am I

Animate Surface / Clear Scene (vpython)

2009-06-24 Thread Philip Gröger
Hi there! I just found a nice vpython example program on how to create surfaces (its one of the standard examples if you download vpython ... called "faces_heightfield" - just search for that). Is there a way to animate this surface? All my attempts resulted in creating just another surface withou

A superclass using a child classes' methods

2009-06-24 Thread Kurt Schwehr
I'm trying to build an OO system for encoding and decoding datapackets. I'd like the parent class to have an encode function that uses each of the child classes' packing methods. It appears that this works for attributes of children accessed by the parent, but not for methods. Is that right? Fo

Re: A superclass using a child classes' methods

2009-06-24 Thread Michael Torrie
Kurt Schwehr wrote: > I'm trying to build an OO system for encoding and decoding > datapackets. I'd like the parent class to have an encode function > that uses each of the child classes' packing methods. It appears that > this works for attributes of children accessed by the parent, but not > fo

Re: IMPORTANT: I NEED TO HELP WITH ONE OF THE CORE DEVELOPERS

2009-06-24 Thread Brian Quinlan
You could start by reading this: http://catb.org/~esr/faqs/smart-questions.html Cheers, Brian Pegasus wrote: I need help with an implementation of your interpreter under PSPE/PSP. I need to know something about the C functions that are recalled by the interpreter when it executes a .pyc file.

Re: IDLE / Python 2.5 under Jaunty

2009-06-24 Thread duncan smith
Michiel Overtoom wrote: > > Duncan Smith wrote: > >> IDLE now refuses to >> respond to left click events (for code editing, menus etc. respond as >> expected). If I right click, then left click I can move the cursor, but >> that's not ideal. >> >> So, has anybody else had the left click issue w

Re: Converting Python code to C/C++

2009-06-24 Thread bobicanprogram
On Jun 23, 11:49 am, Kurt Smith wrote: > On Mon, Jun 22, 2009 at 9:49 PM, Andras > > > > Pikler wrote: > > Hi! > > > Short: I need to turn a Python program that I (mostly) wrote into C code, > > and I am at a loss. > > > Long: I’m doing research/programming for a professor, and we are working > >

Re: Converting Python code to C/C++

2009-06-24 Thread Scott David Daniels
Couper, Tim T wrote: ... My experience is that developers who know C and C++ can be productive in less than 1 week in python, and find it liberating, and educational, to do so. And at the same time they will have added a second language to their toolbox. As Kurt points out, learning C/C++ takes c

Why is it that str.replace doesn't work sometimes?

2009-06-24 Thread humn
I'm writing a script to convert Latex commands to bbcode by using the str.replace function and I'm confused as to why this works: if '\chapter' in line: line = line.replace('\chapter{', '[b][u]') line = line.replace('}', '[/b][/u]') but this doesn't: if '\title' in line:

Get name of class without instance

2009-06-24 Thread Bryan
Given a class: class Foo(object): pass How can I get the name "Foo" without having an instance of the class? str(Foo) gives me more than just the name Foo. "__main__.Account" Foo.__class__.__name__ gives me "type" I don't want to do: Foo().__class__.__name__ if possible. I would rather a

Re: Dictionary self lookup

2009-06-24 Thread Scott David Daniels
Norberto Lopes wrote: On Jun 24, 1:21 pm, "Diez B. Roggisch" wrote: Norberto Lopes wrote: ... config = {"home" : "/home/test"} config["user1"] = config["home"] + "/user1" config["user2"] = config["home"] + "/user2" config["python-dev"] = config["user1"] + "/py-dev" I'd write this as: home

Re: Reading a large csv file

2009-06-24 Thread skip
Mag> s=0 Mag> #Takes the longest here Mag> for y in fs: Mag> continue Mag> a=y.split(',') Mag> s=s+1 Mag> dset.resize(s,axis=0) Mag> fs.close() Mag> f.close() Mag> This works but just takes a VERY long time. Mag> Any way to optimize this?

Re: A superclass using a child classes' methods

2009-06-24 Thread Jean-Michel Pichavant
Kurt Schwehr wrote: I'm trying to build an OO system for encoding and decoding datapackets. I'd like the parent class to have an encode function that uses each of the child classes' packing methods. It appears that this works for attributes of children accessed by the parent, but not for method

Re: Get name of class without instance

2009-06-24 Thread Jean-Michel Pichavant
Bryan wrote: Given a class: class Foo(object): pass How can I get the name "Foo" without having an instance of the class? str(Foo) gives me more than just the name Foo. "__main__.Account" Foo.__class__.__name__ gives me "type" I don't want to do: Foo().__class__.__name__ if possible. I

Unable to get Tkinter menubar to appear under OS X

2009-06-24 Thread Eric Winter
Hi all. I've googled this issue several times and come up dry. Here's the situation: I have a X-windows build of Tkinter for Python built on an OS X machine (10.4 or 10.5, same issue). This is not the Aqua version of Tk, but Tk built from source using X-Window support. I also use a from- source bu

Re: Get name of class without instance

2009-06-24 Thread Tim Golden
Bryan wrote: Given a class: class Foo(object): pass How can I get the name "Foo" without having an instance of the class? str(Foo) gives me more than just the name Foo. "__main__.Account" Foo.__class__.__name__ gives me "type" I don't want to do: Foo().__class__.__name__ if possible. I

Re: Why is it that str.replace doesn't work sometimes?

2009-06-24 Thread unayok
On Jun 24, 12:11 pm, humn wrote: > but this doesn't: > > if '\title' in line: >         line = line.replace('\title{', '[size=150][b]') >         line = line.replace('}', '[/b][/size]') \t is an escaped character. so, '\title' will look for 'itle' Two ways to fix this: 1. use r'\title' 2. use

Re: Get name of class without instance

2009-06-24 Thread Bryan
On Jun 24, 9:25 am, Tim Golden wrote: > Bryan wrote: > > Given a class: > > > class Foo(object): > >     pass > > > How can I get the name "Foo" without having an instance of the class? > > > str(Foo) gives me more than just the name Foo.   "__main__.Account" > > Foo.__class__.__name__ gives me "t

Re: fileinput.input, readlines and ...

2009-06-24 Thread Scott David Daniels
Peter Otten wrote: ... If you need more than a few name value pairs it pays to put the data in a dictionary first: # assuming that values always consist of a single line with open(filename) as instream: lines = (line.strip() for line in lines) lookup = dict(zip(lines, lines)) print lo

Re: Get name of class without instance

2009-06-24 Thread J. Cliff Dyer
On Wed, 2009-06-24 at 09:17 -0700, Bryan wrote: > Given a class: > > class Foo(object): > pass > > How can I get the name "Foo" without having an instance of the class? > > str(Foo) gives me more than just the name Foo. "__main__.Account" > Foo.__class__.__name__ gives me "type" > > I don

Re: A superclass using a child classes' methods

2009-06-24 Thread Kurt Schwehr
Jean-Michel, Thanks for the excellent response setting me straight. Now to figure out what dumb thing I did to make my code not work... -kurt On Jun 24, 12:23 pm, Jean-Michel Pichavant wrote: > Kurt Schwehr wrote: > > I'm trying to build an OO system for encoding and decoding > > datapackets.

Re: Why is it that str.replace doesn't work sometimes?

2009-06-24 Thread Ken Dyck
On Jun 24, 12:11 pm, humn wrote: > I'm confused as to why this works: > > if '\chapter' in line: >         line = line.replace('\chapter{', '[b][u]') >         line = line.replace('}', '[/b][/u]') > > but this doesn't: > > if '\title' in line: >         line = line.replace('\title{', '[size=150][b

Re: Why is it that str.replace doesn't work sometimes?

2009-06-24 Thread humn
On Jun 24, 12:28 pm, unayok wrote: > On Jun 24, 12:11 pm, humn wrote: > > > but this doesn't: > > > if '\title' in line: > >         line = line.replace('\title{', '[size=150][b]') > >         line = line.replace('}', '[/b][/size]') > > \t is an escaped character. so, '\title' will look for > 'i

Re: Get name of class without instance

2009-06-24 Thread David Stanek
Try Foo.__name__ if Foo is a class object. On 6/24/09, Bryan wrote: > Given a class: > > class Foo(object): > pass > > How can I get the name "Foo" without having an instance of the class? > > str(Foo) gives me more than just the name Foo. "__main__.Account" > Foo.__class__.__name__ gives m

Re: Reading then sending new parts of a log file

2009-06-24 Thread Scott David Daniels
Chuck Connors wrote: Hey guys. I'm trying to work up a little program that will send any new lines written to a file (log file from my home automation software) to me via instant message. I've gotten the instant message sending part figured out using xmpppy. I've done a few things with Python

Re: Why is it that str.replace doesn't work sometimes?

2009-06-24 Thread MRAB
humn wrote: On Jun 24, 12:28 pm, unayok wrote: On Jun 24, 12:11 pm, humn wrote: but this doesn't: if '\title' in line: line = line.replace('\title{', '[size=150][b]') line = line.replace('}', '[/b][/size]') \t is an escaped character. so, '\title' will look for 'itle' Two

Re: Best way to enumerate classes in a module

2009-06-24 Thread Terry Reedy
Дамјан Георгиевски wrote: I need to programmaticaly enumerate all the classes in a given module. Currently I'm using dir(module) but the Notice on the documentation page [1] says "dir() is supplied primarily as a convenience for use at an interactive prompt" so that kind of scares me. That n

Re: Measuring Fractal Dimension ?

2009-06-24 Thread pdpi
On Jun 24, 1:32 pm, Mark Dickinson wrote: > On Jun 24, 10:12 am, pdpi wrote: > > > Regarding inf ** 0, why does IEEE745 define it as 1, when there is a > > perfectly fine NaN value? > > Other links:  the IEEE 754 revision working group mailing list > archives are public;  there was extensive disc

Re: isinstance(obj, type(obj)) == True?

2009-06-24 Thread Chris Rebert
On Wed, Jun 24, 2009 at 7:57 AM, Art wrote: > I have the following problem: > > ipdb> p type(self) > > > ipdb> isinstance(self, component.BiasComponent) > False > > I thought that isinstance(obj, type(obj)) == True. > > The specific problem is when I try to call the super of a class and it > only

Re: reply to OT diversion (was: What is the best method to match a pattern in set of lines

2009-06-24 Thread Ross Ridge
a...@pythoncraft.com (Aahz) writes: > Guess what? Prior to DejaNews, discussions on Usenet *were* ephemeral, > and it all worked. Not really, Usenet was archived before DejaNews arrived on the scene. I can find plenty of my posts from before then. Regardless, Usenet works better now that searcha

Re: Converting Python code to C/C++

2009-06-24 Thread Terry Reedy
Short: I need to turn a Python program that I (mostly) wrote into C code, and I am at a loss. Now, my professor would like to have this exact code in C/C++, as she believes C is more compatible with MATLAB, and wants the code to be available in multiple languages in case a programmer works f

Re: IMPORTANT: I NEED TO HELP WITH ONE OF THE CORE DEVELOPERS

2009-06-24 Thread Chris Rebert
On Wed, Jun 24, 2009 at 6:22 AM, Pegasus wrote: > I need help with an implementation of your > interpreter under PSPE/PSP. > > I need to know something about the C > functions that are recalled by the interpreter > when it executes a .pyc file. > > Our version of ndPython is very slow in > executio

Re: fileinput.input, readlines and ...

2009-06-24 Thread Peter Otten
Scott David Daniels wrote: > Peter Otten wrote: >> with open(filename) as instream: >> lines = (line.strip() for line in lines) >> lookup = dict(zip(lines, lines)) > Little bit of a fluff-up here. Sorry, it should have been with open(filename) as instream: lines = (line.strip()

urllib2.urlopen issue

2009-06-24 Thread David
hello, I have a url that is "http://query.directrdr.com/ptrack? pid=225&v_url=http:// www.plentyoffish.com&keyword=flowers&feed=1&ip=12.2.2.2&said=$said". If I open it on a browser, I can get its contents without any problem. However, if I use following code, import urllib2 url = 'http://query

Re: Dictionary self lookup

2009-06-24 Thread Norberto Lopes
On Jun 24, 6:26 pm, Scott David Daniels wrote: > Norberto Lopes wrote: > > On Jun 24, 1:21 pm, "Diez B. Roggisch" wrote: > >> Norberto Lopes wrote: ... > >>> config = {"home" : "/home/test"} > >>> config["user1"] = config["home"] + "/user1" > >>> config["user2"] = config["home"] + "/user2" > >>>

talk of concurrency by Anders Hejlsberg and Guy Steele

2009-06-24 Thread Xah Lee
of recent talks about concurrency, this video interview would be of interest: http://channel9.msdn.com/posts/Charles/Anders-Hejlsberg-and-Guy-Steele-Concurrency-and-Language-Design/ Anders Hejlsberg and Guy Steele: Concurrency and Language Design Posted By: Charles | Oct 6th, 2008 @ 6:27 AM | 75,

Re: urllib2.urlopen issue

2009-06-24 Thread Aahz
In article <854313cf-6323-4ca9-b883-65ca8f414...@v23g2000pro.googlegroups.com>, David wrote: > >import urllib2 >url = 'http://query.directrdr.com/ptrack?pid=225&v_url=http:// >www.plentyoffish.com&keyword=flowers&feed=1&ip=12.2.2.2&said=$said' >xml = urllib2.urlopen(url).read() > >then I get an e

Re: urllib2.urlopen issue

2009-06-24 Thread Chris Rebert
On Wed, Jun 24, 2009 at 10:50 AM, David wrote: > hello, > > I have a url that is "http://query.directrdr.com/ptrack? > pid=225&v_url=http:// > www.plentyoffish.com&keyword=flowers&feed=1&ip=12.2.2.2&said=$said". > If I open it on a browser, I can get its contents without any > problem. > However, i

Re: isinstance(obj, type(obj)) == True?

2009-06-24 Thread Terry Reedy
Art wrote: I have the following problem: ipdb> p type(self) ipdb> isinstance(self, component.BiasComponent) False I thought that isinstance(obj, type(obj)) == True. Yes, but that is not what you entered ;-). The name 'component.BiasComponent' is not bound to type(self), but to another objec

Re: Converting Python code to C/C++

2009-06-24 Thread Grant Edwards
On 2009-06-24, Terry Reedy wrote: > Your professor should wait until your Python version is complete and in > final form and until a C version is needed. Then hire someone competent > in both languages to do the translation. Professor... hire... Good one! :) -- Grant Edwards

Matplotlib - an odd problem

2009-06-24 Thread koranthala
Hi, I am using Matplotlib with Django to display charts on the web page. I am facing an odd problem in that, everytime I do a refresh on the web page, the image darkens - and the text becomes little unreadable. 5/6 refreshes later, the text becomes completely unreadable. Since I am using Django tes

Re: Get name of class without instance

2009-06-24 Thread Terry Reedy
Bryan wrote: How come dir(Foo) does not show __name__? That is how I was investigating the possibilities. Interesting question. Seems like an oversight. dir(some_module) and dir(some_function) include '__name__'. I suggest you search the tracker for existing issues on this subject and add a

Re: Reading then sending new parts of a log file

2009-06-24 Thread Chuck Connors
On Jun 24, 11:57 am, Scott David Daniels wrote: > What OS and version, what Python and version. Win XP, Python 2.6.2 -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib2.urlopen issue

2009-06-24 Thread David
On Jun 24, 11:27 am, Chris Rebert wrote: > On Wed, Jun 24, 2009 at 10:50 AM, David wrote: > > hello, > > > I have a url that is "http://query.directrdr.com/ptrack? > > pid=225&v_url=http:// > >www.plentyoffish.com&keyword=flowers&feed=1&ip=12.2.2.2&said=$said". > > If I open it on a browser, I can

Re: Reading then sending new parts of a log file

2009-06-24 Thread unayok
On Jun 24, 10:23 am, Chuck Connors wrote: > Hey guys.  I'm trying to work up a little program that will send any > new lines written to a file (log file from my home automation > software) to me via instant message.  I've gotten the instant message > sending part figured out using xmpppy. > > I've

It's ...

2009-06-24 Thread Angus Rodgers
... my first Python program! So please be gentle (no fifty ton weights on the head!), but tell me if it's properly "Pythonic", or if it's a dead parrot (and if the latter, how to revive it). I'm working from Beazley's /Python: Essential Reference/ (2nd ed. 2001), so my first newbie question is h

Re: Reading a large csv file

2009-06-24 Thread Lie Ryan
Mag Gam wrote: > Sorry for the delayed response. I was trying to figure this problem > out. The OS is Linux, BTW Maybe I'm just being pedantic, but saying your OS is Linux means little as there are hundreds of variants (distros) of Linux. (Not to mention that Linux is a kernel, not a full blown OS

Re: fileinput.input, readlines and ...

2009-06-24 Thread Private Private
On Jun 24, 1:32 pm, Peter Otten <__pete...@web.de> wrote: > Przemyslaw Bak wrote: > > Hello, > > > I many files with log data. The structure of the file is quite > > inconvenience and similar to the following example: > > Data1 > >   ValueA > > Data2 > >   ValueB > > Data3 > >   ValueC > > ... > >

Re: fileinput.input, readlines and ...

2009-06-24 Thread Scott David Daniels
Peter Otten wrote: Scott David Daniels wrote: Peter Otten wrote: with open(filename) as instream: lines = (line.strip() for line in lines) lookup = dict(zip(lines, lines)) Little bit of a fluff-up here. Sorry, it should have been with open(filename) as instream: lines = (lin

Re: It's ...

2009-06-24 Thread Angus Rodgers
On Wed, 24 Jun 2009 20:53:49 +0100, I wrote: >[...] my first newbie question is how best to find out >what's changed from version 2.1 to version 2.5. >[...] is there a quick online way to find this out? One way seems to be:

Re: How to find info about python 3.x extension module availability?

2009-06-24 Thread Aahz
In article <2838671f-d582-4af1-b850-ccc18ff9d...@a36g2000yqc.googlegroups.com>, Francesco Bochicchio wrote: > >is there any site that reports the current porting (to Python 3.x) >status of the main non-standard extension modules (such as pygtk, >pywin32, wxpython, ...) ? Feel free to create a wi

Re: It's ...

2009-06-24 Thread J. Cliff Dyer
On Wed, 2009-06-24 at 20:53 +0100, Angus Rodgers wrote: > ... my first Python program! So please be gentle (no fifty ton > weights on the head!), but tell me if it's properly "Pythonic", > or if it's a dead parrot (and if the latter, how to revive it). > Yay. Welcome to Python. > I'm working

  1   2   >