Re: Puzzled by "is"

2007-08-09 Thread Erik Max Francis
Grzegorz Słodkowicz wrote: > That's just theorisation but I'd rather expect the interpreter simply > not to create a second tuple while there already is an identical one. > This could save some memory if the tuple was large (Although by the same > token comparison of large tuples can be expensi

Re: Querying Graphics Card Name

2007-08-09 Thread Bjoern Schliessmann
Benjamin Goldenberg wrote: > I would like to find out the name of the graphics card of the > machine my program is running on. I have looked into the pyopengl > module, and using them to query the card, but it seems like there > ought to be a simpler way to find this out without setting up a > glco

Screenscraping, in python, a web page that requires javascript?

2007-08-09 Thread Dan Stromberg - Datallegro
Is there a method, with python, of screenscraping a web page, if that web page uses javascript? I know about BeautifulSoup, but AFAIK at this time, BeautifulSoup is for HTML that doesn't have embedded javascript. Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Stackless Integration

2007-08-09 Thread Aahz
In article <[EMAIL PROTECTED]>, Neil Cerutti <[EMAIL PROTECTED]> wrote: >On 2007-08-09, Justin T. <[EMAIL PROTECTED]> wrote: >>JP Calderone: >>> >>> It's not Pythonic. >> >> Ha! I wish there was a way to indicate sarcasm on the net. You >> almost got people all riled up! > >Sorry. There's NO WAY t

Re: Screenscraping, in python, a web page that requires javascript?

2007-08-09 Thread John J. Lee
Dan Stromberg - Datallegro <[EMAIL PROTECTED]> writes: > Is there a method, with python, of screenscraping a web page, if that web > page uses javascript? Not pure CPython, no. > I know about BeautifulSoup, but AFAIK at this time, BeautifulSoup is for > HTML that doesn't have embedded javascrip

Re: Querying Graphics Card Name

2007-08-09 Thread Benjamin Goldenberg
On Aug 9, 3:26 pm, Bjoern Schliessmann wrote: > Benjamin Goldenberg wrote: > > I would like to find out the name of the graphics card of the > > machine my program is running on. I have looked into the pyopengl > > module, and using them to query the card, but it seems like there > > ought to be a

Re: Querying Graphics Card Name

2007-08-09 Thread Richard Jones
Benjamin Goldenberg wrote: > I would like to find out the name of the graphics card of the machine > my program is running on. I have looked into the pyopengl module, and > using them to query the card, but it seems like there ought to be a > simpler way to find this out without setting up a glcont

Re: Puzzled by "is"

2007-08-09 Thread Steve Holden
Grzegorz Słodkowicz wrote: >> Why? Because. >> >> Seriously, it's just an optimization by the implementers. There is no >> need for more than one empty tuple, since tuples can never be modified >> once created. >> >> But they decided not to create (1, ) in advance. They probably knew that >> har

Re: Puzzled by "is"

2007-08-09 Thread Hrvoje Niksic
Grzegorz Słodkowicz <[EMAIL PROTECTED]> writes: >> Seriously, it's just an optimization by the implementers. There is >> no need for more than one empty tuple, since tuples can never be >> modified once created. >> >> But they decided not to create (1, ) in advance. They probably knew >> that hard

programmatically define a new variable on the fly

2007-08-09 Thread Lee Sander
Hi, I would like to define a new variable which is not predefined by me. For example, I want to create an array called "X%s" where "%s" is to be determined based on the data I am processing. So, for example, if I the file I'm reading has g 99 on the first line, I want to create a new variable cal

Re: Querying Graphics Card Name

2007-08-09 Thread Benjamin Goldenberg
On Aug 9, 4:06 pm, Richard Jones <[EMAIL PROTECTED]> wrote: > Benjamin Goldenberg wrote: > > I would like to find out the name of the graphics card of the machine > > my program is running on. I have looked into the pyopengl module, and > > using them to query the card, but it seems like there ough

Re: programmatically define a new variable on the fly

2007-08-09 Thread Dustan
On Aug 9, 5:11 pm, Lee Sander <[EMAIL PROTECTED]> wrote: > Hi, > > I would like to define a new variable which is not predefined by me. > For example, > I want to create an array called "X%s" where "%s" is to be determined > based on the data I am processing. So, for example, if I the file > I'm re

Re: programmatically define a new variable on the fly

2007-08-09 Thread Dustan
On Aug 9, 5:30 pm, Dustan <[EMAIL PROTECTED]> wrote: > given the > variables data (the dictionary), name (in your example, 'g') and > *size* (in your example, 99), you can add it data as shown: erm... make that: given the variables data (the dictionary), name (in your example, 'g') and size (in

Re: programmatically define a new variable on the fly

2007-08-09 Thread Ian Clark
Lee Sander wrote: > Hi, > > I would like to define a new variable which is not predefined by me. > For example, > I want to create an array called "X%s" where "%s" is to be determined > based on the data I am processing. So, for example, if I the file > I'm reading has > g 99 > on the first line,

Re: Threaded Design Question

2007-08-09 Thread Jun-geun Park
[EMAIL PROTECTED] wrote: > Hi all! I'm implementing one of my first multithreaded apps, and have > gotten to a point where I think I'm going off track from a standard > idiom. Wondering if anyone can point me in the right direction. > > The script will run as a daemon and watch a given directory

Re: beginner whitespace question

2007-08-09 Thread Dan Bishop
On Aug 9, 6:47 pm, eggie5 <[EMAIL PROTECTED]> wrote: > I keep getting an error for line 7, what's wrong with this? > > from django.db import models > > class Poll(models.Model): > question = models.CharField(max_length=200) > pub_date = models.DateTimeField('date published') > > def

beginner whitespace question

2007-08-09 Thread eggie5
I keep getting an error for line 7, what's wrong with this? from django.db import models class Poll(models.Model): question = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') def __unicode__(self): return self.question de

Re: programmatically define a new variable on the fly

2007-08-09 Thread Roberto Bonvallet
On Aug 9, 6:11 pm, Lee Sander <[EMAIL PROTECTED]> wrote: > I would like to define a new variable which is not predefined by me. > For example, > I want to create an array called "X%s" where "%s" is to be determined > based on the data I am processing. Use a dictionary. -- http://mail.python.org/

Smoother Lines in Turtle Graphics

2007-08-09 Thread tomy
Hi All I am a newbie to turtle graphics in python, so sorry if you find this question too easy. How can I get smoother lines in turtle graphics? I am using python on windows. Thanks in advance -- http://mail.python.org/mailman/listinfo/python-list

Re: beginner whitespace question

2007-08-09 Thread eggie5
On Aug 9, 4:52 pm, Dan Bishop <[EMAIL PROTECTED]> wrote: > On Aug 9, 6:47 pm, eggie5 <[EMAIL PROTECTED]> wrote: > > > I keep getting an error for line 7, what's wrong with this? > > > from django.db import models > > > class Poll(models.Model): > > question = models.CharField(max_length=200) >

Re: Gotcha I never ran into before

2007-08-09 Thread James Stroud
Brian Cole wrote: > I've been programming in Python for about 6 years now. One of the > features I adore the most is the very useful error messages and stack > traces that make it easy to debug. However, today I ran into a > difficult to trace bug because the stack trace was reporting the > problem

Re: Threaded Design Question

2007-08-09 Thread MRAB
On Aug 9, 7:25 pm, [EMAIL PROTECTED] wrote: > Hi all! I'm implementing one of my first multithreaded apps, and have > gotten to a point where I think I'm going off track from a standard > idiom. Wondering if anyone can point me in the right direction. > > The script will run as a daemon and watch

Re: Misleading wikipedia article on Python 3?

2007-08-09 Thread Ricardo Aráoz
Evan Klitzke wrote: > On 8/8/07, greg <[EMAIL PROTECTED]> wrote: >> Istvan Albert wrote: >>> A solution would be writing the code with a logging function to begin >>> with, alas many times that is out of one's hand. >> If the code has been written with calls to a builtin >> print function, the situ

Deleting objects on the fly

2007-08-09 Thread Godzilla
Hello, I wish to know whether I should delete objects created on the fly via the "del obj" statement. I noticed the RAM usage increased whenever the application is being run for a long time. I am creating lots of objects (messages) on the fly for communication between threads. Rather than having

High performance binary data

2007-08-09 Thread Steve
I want to ready binary data from a udp socket effeciently as possible in python. I know of the struct package but do people have any tips when dealing with binary data in python? Is there a library or api that is faster when dealing with binary data. I am looking for a any one with experience or

Importing to

2007-08-09 Thread James Stroud
Many thanks to the numerous helpful comments by Paul Rubin, Carsten Haese and others in the thread "How to pass a reference to the current module". After digesting these comments, I came up with this way to circumvent the problem of attempting to reference modules that import other modules i

Re: Puzzled by "is"

2007-08-09 Thread Ben Finney
Grzegorz Słodkowicz <[EMAIL PROTECTED]> writes: > That's just theorisation but I'd rather expect the interpreter > simply not to create a second tuple while there already is an > identical one. Others have already said that it's an implementation optimisation, which seems to partly answer your qu

wxPython - drawing without paint event

2007-08-09 Thread Matt Bitten
I've got a wxPython program that needs to do some drawing on a DC on a regular basis, whether or not a paint event happens. I know how to make a ClientDC to do the drawing in, and I know what drawing calls to make. But how do I make it all happen? After I call MainLoop, none of my code gets called

Re: Threaded Design Question

2007-08-09 Thread half . italian
On Aug 9, 12:09 pm, "Justin T." <[EMAIL PROTECTED]> wrote: > On Aug 9, 11:25 am, [EMAIL PROTECTED] wrote: > > > Here's how I have it designed so far. The main thread starts a > > Watch(threading.Thread) class that loops and searches a directory for > > files. It has been passed a Queue.Queue() ob

Re: beginner whitespace question

2007-08-09 Thread James Stroud
James Stroud wrote: > def __unicode__(self): > return self.choice Laughing to hard at the tab & spaces thing to notice the lack of indentation here. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- ht

Re: beginner whitespace question

2007-08-09 Thread James Stroud
eggie5 wrote: > But this still isn't valid: > > from django.db import models > > class Poll(models.Model): > question = models.CharField(max_length=200) > pub_date = models.DateTimeField('date published') > > def __unicode__(self): > return self.question > > > >

Re: beginner whitespace question

2007-08-09 Thread Dan Bishop
On Aug 9, 7:02 pm, eggie5 <[EMAIL PROTECTED]> wrote: > On Aug 9, 4:52 pm, Dan Bishop <[EMAIL PROTECTED]> wrote: > > > On Aug 9, 6:47 pm, eggie5 <[EMAIL PROTECTED]> wrote: > > > > I keep getting an error for line 7, what's wrong with this? > > > > from django.db import models > > > > class Poll(mode

Re: beginner whitespace question

2007-08-09 Thread eggie5
But this still isn't valid: from django.db import models class Poll(models.Model): question = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') def __unicode__(self): return self.question class Choice(models.Model): poll

Emacs PDB Windows

2007-08-09 Thread [EMAIL PROTECTED]
I'm trying to get PDB working on Emacs 2.1.3, Python 2.3, Windows XP. Whenever I try to run a Python file from the Emacs buffer using the PDB command I get the following error "spawning child process: invalid process" I've tried the exact same command from the command prompt and the debugger works

Re: wxPython before MainLoop

2007-08-09 Thread [david]
I'm disappointed that I didn't get a wxPython solution. If the only way to get wxPython to correctly handle this simple task is to code around it, I don't think wxPython is really ready for Windows. Is there a better place to ask? Regarding the suggestions: Bjoern, you're wrong. The GUI needs t

Re: Threaded Design Question

2007-08-09 Thread Justin T.
On Aug 9, 5:39 pm, MRAB <[EMAIL PROTECTED]> wrote: > On Aug 9, 7:25 pm, [EMAIL PROTECTED] wrote: > > > Hi all! I'm implementing one of my first multithreaded apps, and have > > gotten to a point where I think I'm going off track from a standard > > idiom. Wondering if anyone can point me in the r

Re: Threaded Design Question

2007-08-09 Thread Justin T.
> approach. That sounds the easiest, although I'm still interested in > any idioms or other proven approaches for this sort of thing. > > ~Sean Idioms certainly have their place, but in the end you want clear, correct code. In the case of multi-threaded programming, synchronization adds complexi

Re: mmm-mode, python-mode and doctest-mode?

2007-08-09 Thread Edward Loper
Edward Loper wrote: >> Anyone testing on xemacs? I tried it, and C-c C-c sent xemacs into an >> infinite loop (apparantly). I may have tracked down the cause of this problem. Please download the most recent version, and try again. And when you do, let me know whether that fixed it. :) -Edwar

Does PyModule_GetDict return information about class method variables?

2007-08-09 Thread MD
Hi, I have a variable which is defined inside a class method. When I call PyModule_GetDict on the module containing this class, the dictionary doesn't contain any information about this variable. Is this expected behavior? If so, what options do I have to access this variable from my Python C e

Re: wxPython before MainLoop

2007-08-09 Thread Stephen Hansen
On 8/9/07, [david] <[EMAIL PROTECTED]> wrote: > > I'm disappointed that I didn't get a wxPython solution. > > If the only way to get wxPython to correctly handle > this simple task is to code around it, I don't think > wxPython is really ready for Windows. A thread *is* basically the right answer

Re: beginner whitespace question

2007-08-09 Thread eggie5
On Aug 9, 6:31 pm, James Stroud <[EMAIL PROTECTED]> wrote: > James Stroud wrote: > > def __unicode__(self): That's so goofy. > > return self.choice > > Laughing to hard at the tab & spaces thing to notice the lack of > indentation here. > > James > > -- > James Stroud > UCLA-DOE Inst

accessing static attributes

2007-08-09 Thread james_027
hi, for example an request object ... is request.user the same as request.__class__.user? THanks james -- http://mail.python.org/mailman/listinfo/python-list

Re: accessing static attributes

2007-08-09 Thread Carsten Haese
On Fri, 10 Aug 2007 02:51:44 -, james_027 wrote > hi, > > for example an request object ... is request.user the same as > request.__class__.user? Not in general: >>> class Request(object): ...user = "somebody" ... >>> request = Request() >>> request.user == request.__class__.user True >>

Re: Puzzled by "is"

2007-08-09 Thread Erik Max Francis
Ben Finney wrote: > It's important to also realise that the language is *deliberately* > non-committal on whether any given value will have this behaviour; > that is, it's entirely left to the language implementation which > optimisation trade-offs to make, and the language user (that's you and >

Re: beginner whitespace question

2007-08-09 Thread Dan Bishop
On Aug 9, 8:28 pm, James Stroud <[EMAIL PROTECTED]> wrote: > eggie5 wrote: > > But this still isn't valid: > > > from django.db import models > > > class Poll(models.Model): > >question = models.CharField(max_length=200) > >pub_date = models.DateTimeField('date published') > > > def __u

Re: Threaded Design Question

2007-08-09 Thread Mark T
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all! I'm implementing one of my first multithreaded apps, and have > gotten to a point where I think I'm going off track from a standard > idiom. Wondering if anyone can point me in the right direction. > > The script will run as

Re: Puzzled by "is"

2007-08-09 Thread Paul Rudin
John K Masters <[EMAIL PROTECTED]> writes: > > OK fiddling around with this and reading the docs I tried:- > a = 'qq' #10 q's > b = 'qq' #10 q's > a is b > true > c = 'q' * 10 > c > 'qq' #10 q's > d = 'q' * 10 > d > 'qq' #10 q's > c is d > false > > So from what I'v

Re: wxPython before MainLoop

2007-08-09 Thread Heikki Toivonen
[david] wrote: > I'd like to refresh the display before I start the main loop. We have this kind of situation in Chandler, where we display and update the splash screen before we enter MainLoop. 1. Create app object http://lxr.osafoundation.org/source/chandler/Chandler.py#080 2. During app ob

Re: High performance binary data

2007-08-09 Thread Marc 'BlackJack' Rintsch
On Fri, 10 Aug 2007 00:26:54 +, Steve wrote: > I want to ready binary data from a udp socket effeciently as possible > in python. I know of the struct package but do people have any tips > when dealing with binary data in python? Is there a library or api > that is faster when dealing with b

Re: Does PyModule_GetDict return information about class method variables?

2007-08-09 Thread Marc 'BlackJack' Rintsch
On Thu, 09 Aug 2007 19:34:37 -0700, MD wrote: >I have a variable which is defined inside a class method. When I > call PyModule_GetDict on the module containing this class, the > dictionary doesn't contain any information about this variable. Is > this expected behavior? If so, what options do

Re: Deleting objects on the fly

2007-08-09 Thread Michele Simionato
On Aug 10, 2:25 am, Godzilla <[EMAIL PROTECTED]> wrote: > Hello, > > I wish to know whether I should delete objects created on the fly via > the "del obj" statement. I noticed the RAM usage increased whenever > the application is being run for a long time. I am creating lots of > objects (messages)

Re: beginner whitespace question

2007-08-09 Thread James Stroud
Dan Bishop wrote: >> Tabs are for tables, hence the name. "Use spaces for space and use tabs >> for tables" can be a little mnemonic to help you remember the rules. We >> can make a little song together if you can think of some things that >> rhyme with "don't" and "use" and "tabs". > > "won't" >

<    1   2