Re: Simple regular expression

2008-06-27 Thread John Machin
On Jun 28, 2:26 am, python_enthu <[EMAIL PROTECTED]> wrote: > On Jun 27, 11:05 am, "John Salerno" <[EMAIL PROTECTED]> wrote: > > > > > "python_enthu" <[EMAIL PROTECTED]> wrote in message > > >news:[EMAIL PROTECTED] > > > >I am trying this.. what is wrong in this.. > > > > IDLE 1.2.2 > > import

Re: [Employment] New TurboGears Job in Eugene, OR

2008-06-27 Thread Paul McNett
Silas Snider wrote: Full-time academic year position Salary range: $2819 - $4404 per month ( $16.26 - $25.41 per hour) The following knowledge, skills and experience are necessary for this position: Expert Python and SQL programming skills, and proficiency with Javascript, CSS, XHTML and web

Re: [Employment] New TurboGears Job in Eugene, OR

2008-06-27 Thread Dan Upton
On Fri, Jun 27, 2008 at 4:04 PM, Paul McNett <[EMAIL PROTECTED]> wrote: > Silas Snider wrote: >> >> Full-time academic year position >> Salary range: $2819 - $4404 per month ( $16.26 - $25.41 per hour) > >> The following knowledge, skills and experience are necessary for this >> position: >> >> Exp

Re: using urllib2

2008-06-27 Thread Jeff McNeil
I stumbled across this a while back: http://www.voidspace.org.uk/python/articles/urllib2.shtml. It covers quite a bit. The urllib2 module is pretty straightforward once you've used it a few times. Some of the class naming and whatnot takes a bit of getting used to (I found that to be the most con

Enquiry about PyUSB

2008-06-27 Thread Abhishek Wadhava
Hi.. I'm trying to make a Software USB based on AVR309 application note available at www.atmel.com/dyn/resources/prod_documents/doc2556.pdf So what basically i'm doing is programming a ATTINY-44 to do functions of a USB-driver and when connected to USB port, should be automatically detected by the

Re: How to get a multicast to wait for all nodes?

2008-06-27 Thread Ryuke
On Jun 27, 8:09 am, "Colin J. Williams" <[EMAIL PROTECTED]> wrote: > Ryuke wrote: > > I have a code that receives gps information from nodes and gives off > > its own coordinates via radios connected by Ethernet.  but the code > > continues to run after receiving only 1 set of coordinates, how do i

surprising behaviour of os.environ.clear

2008-06-27 Thread Joe P. Cool
If I call os.environ.clear in a python program child processes still see the deleted entries. But when I iterate over the keys like so names = os.environ.keys for k in names: del os.environ[k] then the entries are also deleted for the child processes. Where is the difference? Is this a bug?

Re: How do web templates separate content and logic?

2008-06-27 Thread [EMAIL PROTECTED]
On 27 juin, 18:09, "John Salerno" <[EMAIL PROTECTED]> wrote: > I've been doing some research on web templates, and even though I read that > they help enforce the MVC pattern, I don't really understand how they are > keeping content and logic separated. For which definitions of "content" and "logi

"method involving two objects" is that possible in Python?

2008-06-27 Thread Kurda Yon
Hi, I just started to learn Python. I understood how one can create a class and define a method related with that class. According to my understanding every call of a methods is related with a specific object. For example, we have a method "length", than we call this method as the following "x.len

Re: "method involving two objects" is that possible in Python?

2008-06-27 Thread Jason Scheirer
On Jun 27, 2:41 pm, Kurda Yon <[EMAIL PROTECTED]> wrote: > Hi, > > I just started to learn Python. I understood how one can create a > class and define a method related with that class. According to my > understanding every call of a methods is related with a specific > object. For example, we have

IPython doesn't always comes up NoColor

2008-06-27 Thread writeson
Hi all, I've been looking at IPython for awhile, but I'm always disappointed that it comes up in NoColor mode no matter what I try. It is configured in the ipythonrc file to be 'color Linux'. I've run it from a Putty terminal window, Konsole and xterm, still no luck. The Putty window shows color f

Re: "method involving two objects" is that possible in Python?

2008-06-27 Thread [EMAIL PROTECTED]
On 27 juin, 23:41, Kurda Yon <[EMAIL PROTECTED]> wrote: > Hi, > > I just started to learn Python. I understood how one can create a > class and define a method related with that class. According to my > understanding every call of a methods is related with a specific > object. For example, we have

Do I need "self" and "other"?

2008-06-27 Thread Kurda Yon
Hi, I found one example which defines the addition of two vectors as a method of a class. It looks like that: class Vector: def __add__(self, other): data = [] for j in range(len(self.data)): data.append(self.data[j] + other.data[j]) return Vector(data) In this example one us

C++ or Python

2008-06-27 Thread Kurda Yon
I would like to know what are advantages of Python in comparison with C ++? In which cases and why Python can be a better tool than C++? Thank you! -- http://mail.python.org/mailman/listinfo/python-list

frame grabber hardware

2008-06-27 Thread rubbishemail
Hello, can anybody recommend a simple USB or PCI framegrabber with video input that runs under xp and has a python driver available? I just want to get the image into a file, no special requirements. Thank you Daniel -- http://mail.python.org/mailman/listinfo/python-list

CAPI and thread safety

2008-06-27 Thread Lane Brooks
I am writing an extension module that needs to release the global interpreter lock during some blocking I/O calls, but I need a mutex in the C code to make some of the shared data in the extension module are kept thread safe. Can anyone recommend a portable way to do this? I could use a pthre

Re: Do I need "self" and "other"?

2008-06-27 Thread Hans Nowak
Kurda Yon wrote: Hi, I found one example which defines the addition of two vectors as a method of a class. It looks like that: class Vector: def __add__(self, other): data = [] for j in range(len(self.data)): data.append(self.data[j] + other.data[j]) return Vector(data) In

Re: Do I need "self" and "other"?

2008-06-27 Thread Kurda Yon
On Jun 27, 6:32 pm, Hans Nowak <[EMAIL PROTECTED]> wrote: > Kurda Yon wrote: > > Hi, > > > I found one example which defines the addition of two vectors as a > > method of a class. It looks like that: > > > class Vector: > > def __add__(self, other): > > data = [] > > for j in range(len(s

Embedded Python Import problem

2008-06-27 Thread sleek
I am having trouble with the following code: PyObject *module = PyImport_ImportModule(modulename); if (module == NULL) { PyObject* et, *ev, *etr; PyErr_Fetch(&et, &ev, &etr); PyObject* traceback = PyImport_ImportModule("traceback"); PyObject* tb = PyObject_CallMethodObjArgs(traceb

Re: Do I need "self" and "other"?

2008-06-27 Thread Terry Reedy
Kurda Yon wrote: OK, I see. In the given example "self" is just a name which can be replace by whichever (valid) name. Is that always like that? I mean, does "slef" have a special meaning in some cases or it is always "just a name like any other"? Yes. A method is a function bound to a cla

Re: using urllib2

2008-06-27 Thread Alexnb
I have read that multiple times. It is hard to understand but it did help a little. But I found a bit of a work-around for now which is not what I ultimately want. However, even when I can get to the page I want lets say, "Http://dictionary.reference.com/browse/cheese", I look on firebug, and exte

Re: using urllib2

2008-06-27 Thread Alexnb
I have read that multiple times. It is hard to understand but it did help a little. But I found a bit of a work-around for now which is not what I ultimately want. However, even when I can get to the page I want lets say, "Http://dictionary.reference.com/browse/cheese", I look on firebug, and exte

More on Urllib, and Urllib2

2008-06-27 Thread Alex Bryan
Okay, so I am having issues figuring anything out about this and have read the "missing manual" about it so please don't send me that link again. To put it simply I want to be able to input a word and get the definition from dictionary.com. Now I found a work-around for searching for the wo

Re: Do I need "self" and "other"?

2008-06-27 Thread Robert Kern
Terry Reedy wrote: Kurda Yon wrote: OK, I see. In the given example "self" is just a name which can be replace by whichever (valid) name. Is that always like that? I mean, does "slef" have a special meaning in some cases or it is always "just a name like any other"? Yes. A method is a funct

Re: warning for unused packages/modules/objects

2008-06-27 Thread Robert Kern
Daniel Fetchinson wrote: How difficult would it be to implement a system in python that would warn if there are unnecessarily imported packages/modules/objects in the code? I mean that when developing some code one frequently imports stuff, deletes the import, changes stuff here and there, import

Re: Do I need "self" and "other"?

2008-06-27 Thread Luis Zarrabeitia
On Friday 27 June 2008 06:41:22 pm Kurda Yon wrote: > OK, I see. In the given example "self" is just a name which can be > replace by whichever (valid) name. Is that always like that? I mean, > does "slef" have a special meaning in some cases or it is always "just > a name like any other"? I am ask

Re: Do I need "self" and "other"?

2008-06-27 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Kurda Yon wrote: > Hi, > > I found one example which defines the addition of two vectors as a > method of a class. It looks like that: > > class Vector: > def __add__(self, other): > data = [] > for j in range(len(self.data)): > data.

Re: C++ or Python

2008-06-27 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Kurda Yon wrote: > I would like to know what are advantages of Python in comparison with C > ++? In which cases and why Python can be a better tool than C++? > > Thank you! I'm a relative novice, so I couldn't tell you about deeply hidden features or

lxml and links

2008-06-27 Thread Ampedesign
I'm trying to extract all the links on a page with lxml. Ideally, I would like it to return me a list of hrefs of each link on the page, in a list. How would I go about doing this? -- http://mail.python.org/mailman/listinfo/python-list

httplib HTTP: Logging request message

2008-06-27 Thread tom
With module httplid, I can do conn.request("POST", "/target", params, headers) Now, I want to log the request message that is sent by the request method. I don't don't see a method for that task. Any suggestion? For a response, I can log the response message by using the call method. Though, I

Help with Borg design Pattern

2008-06-27 Thread Casey McGinty
Hi, I'm trying to implement a simple Borg or Singleton pattern for a class that inherits from 'dict'. Can someone point out why this code does not work? class MyDict( dict ): __state = {} def __init__(self): self.__dict__ = self.__state a = MyDict() a['one'] = 1 a['two'] = 2 print a

Re: Help with Borg design Pattern

2008-06-27 Thread Casey McGinty
On Fri, Jun 27, 2008 at 3:21 PM, Casey McGinty <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to implement a simple Borg or Singleton pattern for a class that > inherits from 'dict'. Can someone point out why this code does not work? > > class MyDict( dict ): >__state = {} >def __init__(s

Re: CAPI and thread safety

2008-06-27 Thread Benjamin
On Jun 27, 4:33 pm, Lane Brooks <[EMAIL PROTECTED]> wrote: > I am writing an extension module that needs to release the global > interpreter lock during some blocking I/O calls, but I need a mutex in > the C code to make some of the shared data in the extension module are > kept thread safe.  Can a

Re: Embedded Python Import problem

2008-06-27 Thread Benjamin
On Jun 27, 5:47 pm, sleek <[EMAIL PROTECTED]> wrote: > I am having trouble with the following code: > > PyObject *module = PyImport_ImportModule(modulename); > if (module == NULL) { > >     PyObject* et, *ev, *etr; >     PyErr_Fetch(&et, &ev, &etr); >     PyObject* traceback = PyImport_ImportModule

Re: surprising behaviour of os.environ.clear

2008-06-27 Thread Benjamin
On Jun 27, 4:05 pm, "Joe P. Cool" <[EMAIL PROTECTED]> wrote: > If I call os.environ.clear in a python program child processes still > see the deleted entries. But when I iterate over the keys like so > > names =  os.environ.keys > for k in names: >     del  os.environ[k] > > then the entries are al

Re: ImportError: DLL load failed

2008-06-27 Thread Andrew MacIntyre
Tony May wrote: I'm having trouble importing when I run in Python. The hello world program passes the test during the bjam build but gives an error about loading the dll when I import from a python script. first the test from running bjam. ...patience... ...found 1915 targets... ...using 1 tem

Re: Do I need "self" and "other"?

2008-06-27 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Kurda Yon <[EMAIL PROTECTED]> wrote: > Hi, > > I found one example which defines the addition of two vectors as a > method of a class. It looks like that: > > class Vector: > def __add__(self, other): > data = [] > for j in range(len(self.data)): >

Pygame, how to show window without loop? no loop=popupand close...

2008-06-27 Thread defn noob
Im using PyGame to draw images of graphs and trees. Howver right now i am looping using: while 1: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() screen.fill(screencolor) pygame.draw.circle(screen, linecolor, (500, 20), 12, 0) draw((500, 20), 3)

Re: Do I need "self" and "other"?

2008-06-27 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Kurda Yon <[EMAIL PROTECTED]> wrote: > OK, I see. In the given example "self" is just a name which can be > replace by whichever (valid) name. Is that always like that? I mean, > does [self] have a special meaning in some cases or it is always "just > a name like

Re: using urllib2

2008-06-27 Thread Alexnb
Okay, so I copied your code(and just so you know I am on a mac right now and i am using pydev in eclipse), and I got these errors, any idea what is up? Traceback (most recent call last): File "/Users/Alex/Documents/workspace/beautifulSoup/src/firstExample.py", line 14, in print list(get_de

Re: struct.pack behavior

2008-06-27 Thread Steven Clark
> For efficiency reasons many CPUs require particular primitive data > types (integers/pointers of various sizes) to be placed in memory at > particular boundaries. For example, shorts ("H" above, usually two bytes > and probably always so in the struct module) are often required to be > on even ad

Re: Pygame, how to show window without loop? no loop=popupand close...

2008-06-27 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 defn noob wrote: > Im using PyGame to draw images of graphs and trees. Howver right now i > am looping using: > > while 1: > for event in pygame.event.get(): > if event.type == pygame.QUIT: sys.exit() > > screen.fill(screencolor) > >

Using just the Mako part of Pylons?

2008-06-27 Thread John Salerno
I just installed Pylons onto my hosting server so I could try out templating with Mako, but it seems a little more complicated than that. From the look of it all, the site seems to want a full Pylons application. Is it possible to just use regular HTML files with a bit of the Mako language embe

Re: Pygame, how to show window without loop? no loop=popupand close...

2008-06-27 Thread defn noob
right. im an idiot anyway. i can just draw the lines before entering the loop, problem solved... -- http://mail.python.org/mailman/listinfo/python-list

Re: Do I need "self" and "other"?

2008-06-27 Thread Maric Michaud
Le Saturday 28 June 2008 00:17:33 Kurda Yon, vous avez écrit : > class Vector: >   def __add__(self, other): >     data = [] >     for j in range(len(self.data)): >       data.append(self.data[j] + other.data[j]) >     return Vector(data) > > In this example one uses "self" and "other". Does one re

Re: Using just the Mako part of Pylons?

2008-06-27 Thread John Salerno
John Salerno wrote: I just installed Pylons onto my hosting server so I could try out templating with Mako, but it seems a little more complicated than that. From the look of it all, the site seems to want a full Pylons application. Is it possible to just use regular HTML files with a bit of

Re: Help with Borg design Pattern

2008-06-27 Thread Maric Michaud
Le Saturday 28 June 2008 03:47:43 Casey McGinty, vous avez écrit : > On Fri, Jun 27, 2008 at 3:21 PM, Casey McGinty <[EMAIL PROTECTED]> > > wrote: > > Hi, > > > > I'm trying to implement a simple Borg or Singleton pattern for a class > > that inherits from 'dict'. Can someone point out why this cod

Re: CAPI and thread safety

2008-06-27 Thread Lane Brooks
Thanks for the pointer. I'll check it out. That is what I was looking for. Lane Benjamin wrote: On Jun 27, 4:33 pm, Lane Brooks <[EMAIL PROTECTED]> wrote: I am writing an extension module that needs to release the global interpreter lock during some blocking I/O calls, but I need a mute

this is simple...

2008-06-27 Thread ToshiBoy
I am a newbie... and the first to admit it... but this has me stuffed: I have two lists A and B that are both defined as range(1,27) I want to find the entries that are valid for A = BxB so here is my code: A = range(1,27) B = range(1,27) for b in B: if b*b in A: print b

Re: Mako vs. Cheetah?

2008-06-27 Thread Tim Roberts
"John Salerno" <[EMAIL PROTECTED]> wrote: > >Is it correct to say that Mako allows you to embed Python code within HTML, >whereas Cheetah requires a certain amount of "tweaking" of Python code so >that it isn't really code you could just run independently in the >interpreter? > >I'm getting that

Re: this is simple...

2008-06-27 Thread Maric Michaud
Le Saturday 28 June 2008 06:30:25 ToshiBoy, vous avez écrit : > I am a newbie... and the first to admit it... but this has me stuffed: > > I have two lists A and B that are both defined as range(1,27) I want > to find the entries that are valid for A = BxB > > so here is my code: > > A = range(1,27

Re: this is simple...

2008-06-27 Thread Mel
ToshiBoy wrote: > I have two lists A and B that are both defined as range(1,27) I want > to find the entries that are valid for A = BxB [ ... ] > I get, as expected 1,4,9,16,25 printed out being the only members of B > where the condition is true, but when I print B I get: > > [1, 2, 3, 4, 5, 7, 9

Re: Mako vs. Cheetah?

2008-06-27 Thread Maric Michaud
Le Saturday 28 June 2008 06:30:50 Tim Roberts, vous avez écrit : >  Others really like the TAL scheme in Zope. > For my taste, TAL just requires too much non-essential syntax; it > interferes with the reading of the page. > > So, the folks who like TAL can go ahead and be productive with TAL, and

Re: lxml and links

2008-06-27 Thread Stefan Behnel
Ampedesign wrote: > I'm trying to extract all the links on a page with lxml. Ideally, I > would like it to return me a list of hrefs of each link on the page, > in a list. > > How would I go about doing this? Read the manual? http://codespeak.net/lxml/dev/lxmlhtml.html#working-with-links http://

Re: this is simple...

2008-06-27 Thread ToshiBoy
On Jun 28, 2:48 pm, Mel <[EMAIL PROTECTED]> wrote: > ToshiBoy wrote: > > I have two lists A and B that are both defined as range(1,27) I want > > to find the entries that are valid for A = BxB > [ ... ] > > I get, as expected 1,4,9,16,25 printed out being the only members of B > > where the conditi

Re: problem compiling extensions with mingw

2008-06-27 Thread eliben
On Jun 27, 3:10 pm, eliben <[EMAIL PROTECTED]> wrote: > Hello, > I'm trying to compile the minimal example > fromhttp://en.wikibooks.org/wiki/Python_Programming/Extending_with_Cwith > MinGW (latest version) and Python 2.5 (latest ActiveState binary > install). When running the setup file, the foll

Re: this is simple...

2008-06-27 Thread Daniel da Silva
ToshiBoy, You might want to take a look at the filter() function, it can also be used for the kind of the thing you're doing. http://docs.python.org/tut/node7.html#SECTION00713 >>> B = range(1,27) >>> def test(b): ... if b*b in B: ... return True ... else: ...

Re: Working with the Windows Registry

2008-06-27 Thread Tim Roberts
teh_sAbEr <[EMAIL PROTECTED]> wrote: >Hi everybody. I'm trying to write a script that'll change desktop >wallpaper every time its run. Heres what I've gotten so far: > >#random wallpaper changer! >import _winreg >from os import walk >from os.path import exists >from random import randint > >#first

Re: problem compiling extensions with mingw

2008-06-27 Thread John Machin
On Jun 28, 3:41 pm, eliben <[EMAIL PROTECTED]> wrote: > On Jun 27, 3:10 pm, eliben <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > I'm trying to compile the minimal example > > fromhttp://en.wikibooks.org/wiki/Python_Programming/Extending_with_Cwith > > MinGW (latest version) and Python 2.5 (lates

Re: surprising behaviour of os.environ.clear

2008-06-27 Thread Tim Roberts
Benjamin <[EMAIL PROTECTED]> wrote: > >On Jun 27, 4:05 pm, "Joe P. Cool" <[EMAIL PROTECTED]> wrote: >> If I call os.environ.clear in a python program child processes still >> see the deleted entries. But when I iterate over the keys like so >> >> names =  os.environ.keys >> for k in names: >>     d

Re: Pygame, how to show window without loop? no loop=popupand close...

2008-06-27 Thread Carl Banks
On Jun 27, 10:58 pm, defn noob <[EMAIL PROTECTED]> wrote: > right. im an idiot anyway. i can just draw the lines before entering > the loop, problem solved... Do not do that; it'll create a busy loop and use 100% of CPU. Use pygame.event.wait() instead. It waits for an event to occur, without us

Re: Problems with file IO in a thread, and shutil

2008-06-27 Thread Roopesh
> Maybe it's a Windows service, eg the indexing service or generating > thumbnails. Anyway, retrying after a delay would still be worth it. Yes, this thing works :-) Thanks a lot. Thanks Roopesh -- http://mail.python.org/mailman/listinfo/python-list

Re: surprising behaviour of os.environ.clear

2008-06-27 Thread s0suk3
On Jun 27, 4:05 pm, "Joe P. Cool" <[EMAIL PROTECTED]> wrote: > If I call os.environ.clear in a python program child processes still > see the deleted entries. But when I iterate over the keys like so > > names = os.environ.keys > for k in names: > del os.environ[k] > > then the entries are al

<    1   2