Re: ORM's are evil. Was: Mechanize/ClientForm - How to select IgnoreControl button and submit form

2009-12-24 Thread Brian D
On Dec 24, 8:20 am, Brian D wrote: > Just kidding. That was a fascinating discussion. > > Now I'd like to see if anyone would rather procrastinate than finish > last-minute shopping. > > This problem remains untouched. Anyone want to give it a try? Please? > > I&#x

Re: Mechanize/ClientForm - How to select IgnoreControl button and submit form

2009-12-24 Thread Brian D
On Dec 23, 8:33 am, Brian D wrote: > All, > > I'm hoping to implement a project that will be historically > transformational by mapping inequalities in property assessments. > > I'm stuck at step one: Scrape data fromhttp://www.opboa.org. > > The site uses a bunc

Mechanize - Click a table row to navigate to detail page

2009-12-24 Thread Brian D
A search form returns a list of records embedded in a table. The user has to click on a table row to call a Javascript call that opens up the detail page. It's the detail page, of course, that really contains the useful information. How can I use Mechanize to click a row? Any ideas? -- http:/

Re: Mechanize - Click a table row to navigate to detail page

2009-12-26 Thread Brian D
On Dec 25, 4:36 am, "Diez B. Roggisch" wrote: > Brian D schrieb: > > > A search form returns a list of records embedded in a table. > > > The user has to click on a table row to call a Javascript call that > > opens up the detail page. > > > It'

How to test a URL request in a "while True" loop

2009-12-30 Thread Brian D
d to another line of code below the loop. There's probably faulty logic in this approach. I imagine I should wrap the URL request in a function, and perhaps store the response as a global variable. This is really more of a basic Python logic question than it is a urllib2 question. Any sugg

Re: How to test a URL request in a "while True" loop

2009-12-30 Thread Brian D
On Dec 30, 11:06 am, samwyse wrote: > On Dec 30, 10:00 am, Brian D wrote: > > > What I don't understand is how to test for a valid URL request, and > > then jump out of the "while True" loop to proceed to another line of > > code below the loop. There'

Re: How to test a URL request in a "while True" loop

2009-12-30 Thread Brian D
On Dec 30, 12:31 pm, Philip Semanchuk wrote: > On Dec 30, 2009, at 11:00 AM, Brian D wrote: > > > > > I'm actually using mechanize, but that's too complicated for testing > > purposes. Instead, I've simulated in a urllib2 sample below an attempt > &g

Re: How to test a URL request in a "while True" loop

2009-12-30 Thread Brian D
Thanks MRAB as well. I've printed all of the replies to retain with my pile of essential documentation. To follow up with a complete response, I'm ripping out of my mechanize module the essential components of the solution I got to work. The main body of the code passes a URL to the scrape_record

Re: How to test a URL request in a "while True" loop

2009-12-30 Thread Brian D
On Dec 30, 7:08 pm, MRAB wrote: > Brian D wrote: > > Thanks MRAB as well. I've printed all of the replies to retain with my > > pile of essential documentation. > > > To follow up with a complete response, I'm ripping out of my mechanize > > module the es

Re: Python Concurrency Workshop, Jan 14-15, 2010

2010-01-02 Thread Brian Blais
both places at the same time. bb -- Brian Blais bbl...@bryant.edu http://web.bryant.edu/~bblais http://bblais.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

fsync() doesn't work as advertised?

2010-01-04 Thread Brian D
If I'm running a process in a loop that runs for a long time, I occasionally would like to look at a log to see how it's going. I know about the logging module, and may yet decide to use that. Still, I'm troubled by how fsync() doesn't seem to work as advertised: http://docs.python.org/library/o

Re: fsync() doesn't work as advertised?

2010-01-04 Thread Brian D
On Jan 4, 10:29 am, Antoine Pitrou wrote: > Le Mon, 04 Jan 2010 08:09:56 -0800, Brian D a écrit : > > > > > What I've seen is that flush() alone produces a complete log when the > > loop finishes. When I used fsync(), I lost all of the write entries > > except t

Re: fsync() doesn't work as advertised?

2010-01-06 Thread Brian D
On Jan 5, 1:08 pm, Nobody wrote: > On Mon, 04 Jan 2010 08:09:56 -0800, Brian D wrote: > > If I'm running a process in a loop that runs for a long time, I > > occasionally would like to look at a log to see how it's going. > > > I know about the logging modu

Iterate over group names in a regex match?

2010-01-19 Thread Brian D
Here's a simple named group matching pattern: >>> s = "1,2,3" >>> p = re.compile(r"(?P\d),(?P\d),(?P\d)") >>> m = re.match(p, s) >>> m <_sre.SRE_Match object at 0x011BE610> >>> print m.groups() ('1', '2', '3') Is it possible to call the group names, so that I can iterate over them? The result I'

Re: Iterate over group names in a regex match?

2010-01-19 Thread Brian D
On Jan 19, 11:28 am, Peter Otten <__pete...@web.de> wrote: > Brian D wrote: > > Here's a simple named group matching pattern: > > >>>> s = "1,2,3" > >>>> p = re.compile(r"(?P\d),(?P\d),(?P\d)") > >>>> m =

Re: Iterate over group names in a regex match?

2010-01-19 Thread Brian D
On Jan 19, 11:51 am, Brian D wrote: > On Jan 19, 11:28 am, Peter Otten <__pete...@web.de> wrote: > > > > > Brian D wrote: > > > Here's a simple named group matching pattern: > > > >>>> s = "1,2,3" > > >>

turtle, ipython, and pylab don't mix

2010-01-20 Thread Brian Blais
more of a pain for my students. thanks, Brian Blais -- Brian Blais bbl...@bryant.edu http://web.bryant.edu/~bblais http://bblais.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

some turtle questions

2010-01-24 Thread Brian Blais
turtle can travel? it seems I can keep moving off of the screen. Is there a way to make it so that a forward(50) command, at the edge, either raises an exception (at the wall) or simply doesn't move the turtle because of the limit? thanks! bb -- Brian Blai

Stuck on a three word street name regex

2010-01-27 Thread Brian D
I've tackled this kind of problem before by looping through a patterns dictionary, but there must be a smarter approach. Two addresses. Note that the first has incorrectly transposed the direction and street name. The second has an extra space in it before the street type. Clearly done by someone

Re: Stuck on a three word street name regex

2010-01-27 Thread Brian D
On Jan 27, 6:35 pm, Paul Rubin wrote: > Brian D writes: > > I've tackled this kind of problem before by looping through a patterns > > dictionary, but there must be a smarter approach.> > > Two addresses. Note that the first has incorrectly transposed the

Re: Stuck on a three word street name regex

2010-01-27 Thread Brian D
On Jan 27, 7:27 pm, MRAB wrote: > Brian D wrote: > > I've tackled this kind of problem before by looping through a patterns > > dictionary, but there must be a smarter approach. > > > Two addresses. Note that the first has incorrectly transposed the > > direct

Re: Stuck on a three word street name regex

2010-01-28 Thread Brian D
> > [snip] > > Regex doesn't gain you much. I'd split the string and then fix the parts > > as necessary: > > >  >>> def parse_address(address): > > ...     parts = address.split() > > ...     if parts[-2] == "S": > > ...         parts[1 : -1] = [parts[-2]] + parts[1 : -2] > > ...     parts[1 : -1]

Re: Stuck on a three word street name regex

2010-01-28 Thread Brian D
On Jan 28, 7:40 am, Brian D wrote: > > > [snip] > > > Regex doesn't gain you much. I'd split the string and then fix the parts > > > as necessary: > > > >  >>> def parse_address(address): > > > ...     parts = address.split(

Re: Stuck on a three word street name regex

2010-01-28 Thread Brian D
> Correction: > > [snip] the expression "parts[1 : -1]" means gather list items from the > second element in the list (index value 1) to one index position > before the end of the list. [snip] MRAB's solution was deserving of a more complete solution: >>> def parse_address(address): # Ha

Re: Stuck on a three word street name regex

2010-01-28 Thread Brian D
On Jan 28, 8:27 am, Lie Ryan wrote: > On 01/28/10 11:28, Brian D wrote: > > > > > I've tackled this kind of problem before by looping through a patterns > > dictionary, but there must be a smarter approach. > > > Two addresses. Note that the first has incorr

Re: setting up dynamic descriptors in Python

2009-09-29 Thread brian h
I created a new class for each instance as you suggested and added the descriptor to the class. It worked great. Thanks for the help. Brian Huggins -- http://mail.python.org/mailman/listinfo/python-list

sympy returns a dictionary sometimes, and sometimes a list of tuples...why?

2009-09-30 Thread Brian Blais
n, but I'd like to know what is a solution for x, and for y. Why isn't it in a dictionary? Am I doing something wrong? thanks, Brian Blais -- Brian Blais bbl...@bryant.edu http://web.bryant.edu/~bblais -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular expression to structure HTML

2009-10-02 Thread Brian D
e, not criticize for the attempt to learn. Maybe one shouldn't learn how to use a hammer on a screw, but I wouldn't say that I have never hammered a screw into a piece of wood just because I only had a hammer. Thanks, Brian On Oct 2, 8:38 am, John wrote: > On Oct 2, 1:10 am, "50

Re: Regular expression to structure HTML

2009-10-02 Thread Brian D
The other thought I had was that I may not be properly trapping the end of the first row, and the beginning of the next row. On Oct 2, 8:38 am, John wrote: > On Oct 2, 1:10 am, "504cr...@gmail.com" <504cr...@gmail.com> wrote: > > > > > I'm kind of new to regular expressions, and I've spent hou

Re: The rap against "while True:" loops

2009-10-12 Thread Brian Blais
On Oct 12, 2009, at 15:18 , Falcolas wrote: Glad to hear, by the way, that you don't use gotos in Python. =D actually, it is there. http://entrian.com/goto/ I particularly like the comefrom construct! bb -- Brian Blais bbl...@bryant.edu http://web.bryant.edu/~b

Re: SimpleXMLRPCServer clobbering sys.stderr? (2.5.2)

2009-10-21 Thread Brian Quinlan
Do you have some code that we could see that provokes the problem? Cheers, Brian Joseph Turian wrote: I was having a mysterious problem with SimpleXMLRPCServer. (I am using Python 2.5.2) The request handlers were sometimes failing without any error message to the log output. What I discovered

multiprocessing deadlock

2009-10-22 Thread Brian Quinlan
bove then the script produces the expected output. I don't see any docs that would explain this problem and I don't know what the rule would be e.g. you just join every process that uses a queue before the queue is garbage collected. Any ideas why this is happening? Cheers, Brian --

Re: multiprocessing deadlock

2009-10-23 Thread Brian Quinlan
On 24 Oct 2009, at 00:02, paulC wrote: On Oct 23, 3:18 am, Brian Quinlan wrote: My test reduction: import multiprocessing import queue def _process_worker(q): while True: try: something = q.get(block=True, timeout=0.1) except queue.Empty

Re: multiprocessing deadlock

2009-10-23 Thread Brian Quinlan
On 24 Oct 2009, at 06:01, paulC wrote: Hey Paul, I guess I was unclear in my explanation - the deadlock only happens when I *don't* call join. Cheers, Brian Whoops, my bad. Have you tried replacing prints with writing a another output Queue? I'm wondering if sys.stdout has

Re: multiprocessing deadlock

2009-10-23 Thread Brian Quinlan
On 24 Oct 2009, at 14:10, Gabriel Genellina wrote: En Thu, 22 Oct 2009 23:18:32 -0300, Brian Quinlan escribió: I don't like a few things in the code: def _do(i): print('Run:', i) q = multiprocessing.Queue() for j in range(30): q.put(i*30+j

Re: multiprocessing deadlock

2009-10-24 Thread Brian Quinlan
On 24 Oct 2009, at 19:49, Gabriel Genellina wrote: En Sat, 24 Oct 2009 02:48:38 -0300, Brian Quinlan escribió: On 24 Oct 2009, at 14:10, Gabriel Genellina wrote: En Thu, 22 Oct 2009 23:18:32 -0300, Brian Quinlan > escribió: I don't like a few things in the code: I'm actuall

Re: multiprocessing deadlock

2009-10-24 Thread Brian Quinlan
On 24 Oct 2009, at 21:37, larudwer wrote: "Brian Quinlan" schrieb im Newsbeitrag news:mailman.1895.1256264717.2807.python-l...@python.org... Any ideas why this is happening? Cheers, Brian IMHO your code is buggy. You run in an typical race condition. consider following pa

futures - a new package for asynchronous execution

2009-11-05 Thread Brian Quinlan
P.txt And the code is here: http://pypi.python.org/pypi/futures3/ All feedback appreciated! Cheers, Brian -- http://mail.python.org/mailman/listinfo/python-list

Re: why does "help(import)" not work?

2009-11-06 Thread Brian Quinlan
Hi Robert, help() is just a regular function that must be called with correct Python syntax and the import keyword is not allowed in an argument list. The correct syntax is: help('import') Cheers, Brian On 6 Nov 2009, at 20:56, Robert P. J. Day wrote: i'm sure ther

Re: _winreg error on open key (64bit) - proper usage of _winreg.DisableReflectionKey

2009-11-18 Thread Brian Curtin
On Tue, Nov 17, 2009 at 19:59, Mark Hammond wrote: > On 18/11/2009 6:29 AM, Randall Walls wrote: > >> I don't believe so, but it seems like I'm in a catch 22, where I need to >> _winreg.OpenKey the key first before I can pass it to >> _winreg.DisableReflectionKey, but it doesn't exist, so I can't

Re: xmlrpc idea for getting around the GIL

2009-11-24 Thread Brian Blais
any sample code? bb -- Brian Blais bbl...@bryant.edu http://web.bryant.edu/~bblais -- http://mail.python.org/mailman/listinfo/python-list

odd drawing problem with turtle.py

2010-01-31 Thread Brian Blais
turtle.circle(self.r) self.turtle.fill(False) self.turtle.penup() for i in range(5): c=Circle(randint(-350,350),randint(-250,250),10,"red") T=Turtle() T.forward(100) T.forward(100) thanks, bb -- Bria

Re: [Edu-sig] odd drawing problem with turtle.py

2010-02-01 Thread Brian Blais
bb On Sun, Jan 31, 2010 at 4:27 PM, Brian Blais wrote: I'm on Python 2.5, but using the updated turtle.py Version 1.0.1 - 24. 9. 2009. The following script draws 5 circles, which it is supposed to, but then doesn't draw the second turtle which is supposed to simply move fo

mouse input in turtle module

2010-02-03 Thread Brian Blais
n or return a button=-1 or something. thanks, Brian Blais -- Brian Blais bbl...@bryant.edu http://web.bryant.edu/~bblais http://bblais.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

multiprocessing and games

2010-02-13 Thread Brian Blais
king about this incorrectly. Any help would be great! Pointers to other examples of using multiprocessing, especially with games, would be fantastic. thanks, Brian Blais -- Brian Blais bbl...@bryant.edu http://web.bryant.edu/~bblais http://bblais.blogs

Re: multiprocessing and games

2010-02-13 Thread Brian Blais
On Feb 13, 2010, at 12:54 , MRAB wrote: Brian Blais wrote: I've been thinking about implementing some simple games Forget about global variables, they're not worth it! :-) Think in terms of messages, sent via pipes, sockets or multiprocessing queues. okay...let's mak

Re: How to use python to register a service (an existing .exe file)

2010-02-15 Thread Brian Curtin
On Mon, Feb 15, 2010 at 18:10, News123 wrote: > Hi, > > Is there a python way to register new windows services. > > > I am aware of the > instsrv.exe program, which can be used to install services. > I could use subprocess.Popen to call > > > instsrv.exe "service_name" program.exe > > > but wonde

Re: listing existing windows services with python

2010-02-15 Thread Brian Curtin
On Mon, Feb 15, 2010 at 18:17, Alf P. Steinbach wrote: > * News123: > > Hi, >> >> >> What is the best way with python to get a list of all windows services. >> >> As a start I would be glad to receive only the service names. >> >> However it would be nicer if I could get all the properties of a

Re: xml-rpc

2010-03-29 Thread Brian Quinlan
/ Cheers, Brian --erdinc -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list

Re: Some syntactic sugar proposals

2010-11-15 Thread Brian Blais
too!" x=3.2 if x in range(1,10): print "yay!" if 1<=x<10: print "yay too!" output: yay! yay too! yay too! bb -- Brian Blais bbl...@bryant.edu http://web.bryant.edu/~bblais http://bblais.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

packaging and installing

2010-12-13 Thread Brian Blais
my own (1-line) .bat file, but I didn't want to reinvent the wheel. Perhaps there is a better way for me to do this, ideally in a platform independent way. thanks, Brian Blais -- Brian Blais bbl...@bryant.edu http://web.bryant.edu/~bblais http:/

Re: packaging and installing

2010-12-14 Thread Brian Blais
On Dec 13, 2010, at 12:30 PM, Godson Gera wrote: > > > On Mon, Dec 13, 2010 at 10:46 PM, Brian Blais wrote: >> Hello, >> >> I was wondering if there is any standard or suggested way of installing >> packages *without* going to the commandline. I often

Re: __pycache__, one more good reason to stck with Python 2?

2011-01-17 Thread Brian Curtin
On Mon, Jan 17, 2011 at 08:31, jmfauth wrote: > As a scientist using computer tools, and not as a computer > scientist, I discovered Python long time ago (it was in its > 1.5.6 version) and I remain an happy user up to now date. > Yesterday, I was happy to download and test Python 3.2rc1. > Pytho

Re: move to end, in Python 3.2 Really?

2011-01-18 Thread Brian Curtin
On Tue, Jan 18, 2011 at 12:33, rantingrick wrote: > > On Jan 18, 11:56 am, Antoine Pitrou wrote: > > On Tue, 18 Jan 2011 09:10:48 -0800 (PST) > > > > rantingrick wrote: > > > > > Well don't get wrong i want to join in --not that i have all the > > > solutions-- > > > > Take a look athttp://docs

Re: move to end, in Python 3.2 Really?

2011-01-18 Thread Brian Curtin
On Tue, Jan 18, 2011 at 13:22, rantingrick wrote: > > Thanks for offering a suggestion it was very welcome however i need to > emphasize that what i am proposing is sort of "community discussion > suggestion box". Like a "Python Suggestions" group or something. Where > any and all suggestions, ra

Re: Tkinter: The good, the bad, and the ugly!

2011-01-19 Thread Brian Curtin
On Wed, Jan 19, 2011 at 18:53, rantingrick wrote: > Without the car the driver is > nothing, and without the driver the car is nothing. But together, they > are a force to reckoned with. Well, unless the driver is Asian -- then > all bets are off! :-) Welcome to the auto-deletion filter. -- ht

Re: Finding the right Python executable on Windows

2011-01-25 Thread Brian Curtin
On Tue, Jan 25, 2011 at 04:25, Geoff Bache wrote: > Hi all, > > I have a Python process on Windows and would like to start a Python > subprocess using the same interpreter. I wonder how to go about this? > > First, I tried the obvious > > subprocess.Popen([ sys.executable, "subproc.py", ... ]) >

PSF Sprints - Call For Applications

2011-01-27 Thread Brian Curtin
/distutils), and most recently, the PyPy winter sprint in Switzerland. If your group is interested in hosting a sprint, check out the full details of our call for applications at http://www.pythonsprints.com/cfa/ and contact us at spri...@python.org. Thanks for your time, and happy sprinting! Brian Curtin

Re: Idea for removing the GIL...

2011-02-08 Thread Brian Curtin
On Tue, Feb 8, 2011 at 06:34, Vishal wrote: > Also, multiprocessing has issues on Windows (most probably because of > the way CreateProcess() functions...) Such as? -- http://mail.python.org/mailman/listinfo/python-list

PyCon 2011 news - going strong, sign up today!

2011-02-09 Thread Brian Curtin
Hey python-list readers! PyCon 2011 looks like it may very well break every single record in the past - making it one of the biggest and best PyCons of all time. We've gone all out this year - including Extreme Talks, a Startup Row, amazing talks, tutorials, Poster sessions. Extreme talks: http:/

Re: logging module -- better timestamp accuracy on Windows

2011-02-16 Thread Brian Curtin
On Wed, Feb 16, 2011 at 09:34, sturlamolden wrote: > On 16 Feb, 15:30, benhoyt wrote: > > > It seems to me that the logging module should use a millisecond-accurate > timestamp (time.clock) on Windows, just like the "timeit" module does. > > AFAIK, the Windows performance counter has long-term a

Re: logging module -- better timestamp accuracy on Windows

2011-02-16 Thread Brian Curtin
On Wed, Feb 16, 2011 at 12:23, benhoyt wrote: > > > AFAIK, the Windows performance counter has long-term accuracy issues, > > so neither is perfect. Preferably we should have a timer with the long- > > term accuracy of time.time and the short-term accuracy of time.clock. > > Thanks for the tip --

Re: Incorrect scope of list comprehension variables

2010-04-04 Thread Brian Blais
nd skimmed the section: http://docs.python.org/tutorial/datastructures.html which describes list comps, and didn't see any mention of this behavior. it's probably there, but it certainly doesn't jump out. bb -- Brian Blais bbl...@bryant.edu http://web.

Re: Download Visual Studio Express 2008 now

2010-04-16 Thread Brian Blais
isual Studio to do it? bb -- Brian Blais bbl...@bryant.edu http://web.bryant.edu/~bblais http://bblais.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: GUIs - A Modest Proposal

2010-06-09 Thread Brian Blais
me the standard. I guess that answers that one! :) bb -- Brian Blais bbl...@bryant.edu http://web.bryant.edu/~bblais http://bblais.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: GUIs - A Modest Proposal

2010-06-10 Thread Brian Blais
On Jun 10, 2010, at 4:28 , Gregory Ewing wrote: Brian Blais wrote: In this whole discussion, I haven't seen anyone mention wax (http:// zephyrfalcon.org/labs/wax_primer.html) Just had a quick look at that. In the third example code box: def Body(self): self.te

dynamically modify help text

2010-06-27 Thread Brian Blais
shown if one does: help(myobject) thanks, Brian Blais -- Brian Blais bbl...@bryant.edu http://web.bryant.edu/~bblais http://bblais.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: dynamically modify help text

2010-06-28 Thread Brian Blais
On Jun 27, 2010, at 22:37 , Red Forks wrote: Read you doc file and set the __doc__ attr of the object you want to change. On Monday, June 28, 2010, Brian Blais wrote: I know that the help text for an object will give a description of every method based on the doc string. Is there a way

Re: dynamically modify help text

2010-06-28 Thread Brian Blais
, Chris so that gets back to my original question: can I change this text at runtime. Doesn't look like I can, because it is defined for classes rather than instances. Am I thinking about this correctly? bb -- Brian Blais bbl...@bryant.edu http://web.bryant.edu/~b

Re: I strongly dislike Python 3

2010-06-30 Thread Brian Blais
rens are a bit more irritating than just a print 2) in my quick-and-dirty scripts, I often want to get rid of all of the prints after it works. 3) being able to redefine print vastly outweighs the irritation caused by the extra parens bb -- Brian Blais bbl...@bryan

Re: Solutions for hand injury from computer use

2010-07-01 Thread Brian Victor
ion was the Kensington Expert Mouse. For some reason, the trackball hurts me much less than a real mouse, and keeps me from being disproportionately annoyed when I have to pick up my pointing device to move the cursor where I want it. ;) -- Brian -- http://mail.python.org/mailman/listinfo/python-list

Re: how do you do a count of a result set?

2010-07-09 Thread Brian Quinlan
re than a few hundred results then you would be better so store them somewhere. Cheers, Brian -- http://mail.python.org/mailman/listinfo/python-list

Re: Accumulate function in python

2010-07-19 Thread Brian Victor
0, 2, 3 ] def running_sum(result, current_value): return result + [result[-1]+current_value if result else current_value] reduce(running_sum, x, []) Having offered this, I don't recall ever seeing reduce used in real python code, and explicit iteration is almost always preferred. -- Brian -- h

Re: Are those features still the same?

2010-07-24 Thread Brian Quinlan
(from the array module) are homogeneous, and limited to storing numerical data. Quite a different beast. He means that Python lists are implemented using arrays, not that the Python "array" module provides the functionality. Cheers, Brian -- http://mail.python.org/mailman/listinfo/python-list

Re: Check in interpreter if running a debug version of python

2010-07-27 Thread Brian Curtin
On Tue, Jul 27, 2010 at 09:06, John Reid wrote: > Can I check in the interpreter if I am running a debug version of python? I > don't mean if __debug__ is set, I want to know if python was compiled in > debug mode. > > Thanks, > John. Starting with Python 2.7 and 3.2 you can do this: >>> syscon

Re: Best practice way to open files in Python 2.6+?

2010-07-27 Thread Brian Curtin
On Tue, Jul 27, 2010 at 09:33, wrote: > What is the best practice way to open files in Python 2.6+ > > It looks like there are at least 3 different ways to open files: > - built-in open() > - io.open() > - codecs.open() > > It seems like io.open() combines the best of the built-in open() and the

Re: Windows: How to detect whether a Python app/script is running in console/GUI mode?

2010-07-27 Thread Brian Curtin
On Tue, Jul 27, 2010 at 09:36, wrote: > Windows: How can I detect whether a Python app/script is running in > console/GUI mode? By app I mean a script compiled to an exe via py2exe or > similar. > > Thank you, > Malcolm > I don't remember much about py2exe, but you could check if ``os.path.split

Re: Best practice way to open files in Python 2.6+?

2010-07-27 Thread Brian Curtin
On Tue, Jul 27, 2010 at 09:59, wrote: > Brian, > > Under Python 2.6.4 (Windows), "io.open is open" returns False. Retrieving > help() on io.open and open() reinforces that these are 2 different > implementations of open. > > My use case is reading and writing

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-07-31 Thread Brian Victor
raise Exception() Exception Since the idea of super() as I understand it is to make sure every class in an object's hierarchy gets its method called, there's really no way to implement super() in a way that didn't involve a non-superclass being called by some class's super() call. -- Brian -- http://mail.python.org/mailman/listinfo/python-list

Re: looping through possible combinations of McNuggets packs of 6,9 and 20

2010-08-12 Thread Brian Victor
ly you'll actually want to use it in an if statement. -- Brian -- http://mail.python.org/mailman/listinfo/python-list

Importing libs on Windows?

2010-08-12 Thread Brian Salter
I've seen a number of tutorials that describe how to bring in a dll in python, but does anybody know of a tutorial for how to bring in a lib? Is it even possible? Thanks, in advance! -- http://mail.python.org/mailman/listinfo/python-list

Re: Importing libs on Windows?

2010-08-12 Thread Brian Salter
It appears that every example is calling a dll, and I'm looking to bring in a lib. Does ctypes work with libs too? "Gary Herron" wrote in message news:mailman.2044.1281656800.1673.python-l...@python.org... On 08/12/2010 04:09 PM, Brian Salter wrote: I've seen a numb

Re: random number generation

2010-08-16 Thread Brian Blais
e, True], [ True, False, True, False, False, False, False], [False, False, False, False, False, False, False]], dtype=bool) just like matlab. bb -- Brian Blais bbl...@bryant.edu http://web.bryant.edu/~bblais http://bblais.blogspot.com/ -- http://mail.python.org

Re: Save/load like matlab?

2010-08-23 Thread Brian Blais
for two open source projects that I own: http://code.google.com/p/ssdf/ this is fantastic! what a great format! I've been looking for something like this for quite some time. thanks! bb -- Brian Blais bbl...@bryant.edu http://web.bryant.edu/~bblais

Re: Odd closure issue for generators

2009-06-05 Thread Brian Quinlan
Ned Deily wrote: In article <4a28903b.4020...@sweetapp.com>, Brian Quinlan wrote: Scott David Daniels wrote: [snipped] When you evaluate a lambda expression, the default args are evaluated, but the expression inside the lambda body is not. When you apply that evaluated lambda expr

Re: How to insert string in each match using RegEx iterator

2009-06-10 Thread Brian D
On Jun 10, 5:17 am, Paul McGuire wrote: > On Jun 9, 11:13 pm, "504cr...@gmail.com" <504cr...@gmail.com> wrote: > > > By what method would a string be inserted at each instance of a RegEx > > match? > > Some might say that using a parsing library for this problem is > overkill, but let me just put

Re: How to escape # hash character in regex match strings

2009-06-11 Thread Brian D
On Jun 11, 2:01 am, Lie Ryan wrote: > 504cr...@gmail.com wrote: > > I've encountered a problem with my RegEx learning curve -- how to > > escape hash characters # in strings being matched, e.g.: > > string = re.escape('123#abc456') > match = re.match('\d+', string) > print match > >

Re: How to escape # hash character in regex match strings

2009-06-11 Thread Brian D
On Jun 11, 9:22 am, Brian D wrote: > On Jun 11, 2:01 am, Lie Ryan wrote: > > > > > 504cr...@gmail.com wrote: > > > I've encountered a problem with my RegEx learning curve -- how to > > > escape hash characters # in strings being matched, e.g.:

Re: Perl's @foo[3,7,1,-1] ?

2009-06-13 Thread Brian Quinlan
se? It could be that a list isn't the appropriate data structure. Cheers, Brian -- http://mail.python.org/mailman/listinfo/python-list

Re: Perl's @foo[3,7,1,-1] ?

2009-06-13 Thread Brian Quinlan
ed by some_match.groups(). The match comes from a standard regexp defined elsewhere and that captures more groups than I need. (This regexp is applied to every line of a log file.) kj The common idiom for this sort of thing is: _, _, _, val1, _, _, _, val2, ..., val3 = some_match.groups() Cheers,

Re: Perl's @foo[3,7,1,-1] ?

2009-06-13 Thread Brian Quinlan
MRAB wrote: Brian Quinlan wrote: kj wrote: In Nick Craig-Wood writes: However I can't think of the last time I wanted to do this - array elements having individual purposes are usually a sign that you should be using a different data structure. In the case I was working with,

Re: Funny xmlrpc / linux problem

2009-06-16 Thread Brian Quinlan
Hey Hans, Try reversing the list of numbers and see if anything changes. Cheers, Brian Hans Müller wrote: Hello, I found a timing problem while playing with the xmlrpx stuff. I created a very simple server, running on a network node on windows. The client runs on windows or linux. It runs a

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: easy question, how to double a variable

2009-09-23 Thread Brian Blais
twice("an int parameter") -- Brian Blais bbl...@bryant.edu http://web.bryant.edu/~bblais -- http://mail.python.org/mailman/listinfo/python-list

Re: Most "active" coroutine library project?

2009-09-23 Thread Brian Hammond
On Aug 25, 12:51 am, Denis wrote: > You can also at gevent > > http://pypi.python.org/pypi/gevent Please, please document this! There are a lot of people who would love to use this but give up when they don't find a guide or something similar. -- http://mail.python.org/mailman/listinfo/python-l

setting up dynamic descriptors in Python

2009-09-24 Thread brian huggins
;) And Usage: >>> test=TestDesc() >>> test.x=0 Updating x >>> test.x=4 Updating x >>> test.x Retrieving x 4 >>> test.y When i access y, it appears to be a regular object and not a descriptor type object like x. Is there a way to make

Re: IDE for python similar to visual basic

2009-09-24 Thread brian huggins
g. And its free! Brian -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic Form

2009-09-24 Thread Brian Victor
rect after a successful POST. That way refreshing the browser won't try to re-POST the form. http://en.wikipedia.org/wiki/Post/Redirect/Get -- Brian -- http://mail.python.org/mailman/listinfo/python-list

Re: looking for open source python project

2010-08-29 Thread Brian Curtin
On Sat, Aug 28, 2010 at 19:50, mo reina wrote: > looking for a python project (preferably something a bit small) that > is looking for contributors. the small bit is because i've never > worked in a team before and haven't really read source code that's > 1000s of lines long, so i'm not too sure

Re: Source code for itertools

2010-08-30 Thread Brian Curtin
On Mon, Aug 30, 2010 at 22:06, vsoler wrote: > On 31 ago, 04:42, Paul Rubin wrote: > > vsoler writes: > > > I was expecting an itertools.py file, but I don't see it in your list. > > >> ./python3.1-3.1.2+20100829/Modules/itertoolsmodule.c > > > > looks promising. Lots of stdlib modules are wri

<    3   4   5   6   7   8   9   10   11   12   >