On Tue, 12 Jul 2005 08:28:45 -0700, Devan L wrote:
> How is this different from a nested function?
Well, "this" is a newsgroup posting written by you. Nested functions in
Python are callable objects that exist as attributes of other callable
objects, so the two are very different.
Alternatively,
thanks for the comments + help.
i think i got it working, although it's not pretty:
##
import os
import re
theRegEx = '.*abs:.*\.*.'
p = re.compile(theRegEx, re.IGNORECASE)
fileToSearch = 'compreg.dat'
print "File to perform search-and-replace on: " + fileToSea
> I would like to know how I could automatically fill a
> (search) form on a web page and download the resulting
> html page. More precisely I would like to make a
> program that would automatically fill the "Buscador
> lista 40" (in spanish, sorry) form in the following
> webpage:
> http://www.los
> I would like to know how I could automatically fill a
> (search) form on a web page and download the resulting
> html page.
http://wwwsearch.sourceforge.net/ClientForm/
Daniel
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 12 Jul 2005 08:25:50 -0700, rorley wrote:
> OK, so my problem is I have a text file with all of these instances,
> for example 5000 facts about animals. I need to go through the file
> and put all of the facts (lines) that contain the word lion into a file
> called lion.txt. If I come ac
Well, the string that gets passed is more or less a function
definition, which is then called with exec. I don't see why you'd need
to write a string out with the function definition and then call it.
You could just write the function.
As for the nested functions, I had been presuming that it was
Steven D'Aprano wrote:
> hex() of an int appears to return lowercase hex digits, and hex() of a
> long uppercase.
>
> >>> hex(75)
> '0x4b'
> >>> hex(75*256**4)
> '0x4BL'
>
> By accident or design? Apart from the aesthetic value that lowercase hex
> digits are ugly, should we care?
No, ju
Thanks A LOT for your help!
__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--
http://mail.python.org/mailman/listinfo/python-list
Peter Decker wrote:
> On 7/12/05, Dark Cowherd <[EMAIL PROTECTED]> wrote:
>
>
>>Most lists when i hit reply it puts the list address back in the To
>>address and some lists allow you to configure this.
>>
>>But in this list reply sends the mail back as a private mail and there
>>seems to be no op
In translating natural language to SQL, be sure you're not introducing
opportunities for SQL injection attacks. Code like
sql = 'SELECT %s FROM %s' % (this, that)
is considered dangerous, because a well-crafted value for "that" can be
used to, e.g., delete rows from your tables, run system com
As Steven said this looks too much like home work
But what the heck I am also learning python. So I wrote a small
program. A very small program. I am fairly new to Python, I am stunned
each time to see how small programs like this can be.
Since I am also learning can somebody comment if anything h
Not quite homework but a special project. Thanks for the advice. I'll
let you know if I run into anymore stumbling blocks. Reece
--
http://mail.python.org/mailman/listinfo/python-list
Bengt,
Thanks for your informative reply, further comments interleaved.
"Bengt Richter" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Mon, 11 Jul 2005 02:37:21 +1000, "Jeff Melvaine"
> <[EMAIL PROTECTED]> wrote:
>
>>I note that I can write expressions like "1 << 100" and the
Thanks for the hints, I think I've figured it out. I've only been
using Python for 2 days so I really needed the direction. If you were
curious, this is not homework but an attempt to use the ConceptNet data
(its an MIT AI project) to make a website in a Wiki-like format that
would allow the data
No, the replies from Grant's and Sybren's do answer my question. I
posted twice because my browser locked itself up, and I ended up typing
twice :(
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I just got the pywin32 "hello world" COM server to install and I did manage
to use it from VB 6.0.
However, there are some glitches I do not comprehend:
1) at one point I got a python runtime error telling me the "testcomserver"
was not found - I got rid of that problem by deleteting the app
Sorry: "Cache", not "Cash"
Philippe C. Martin wrote:
> Hi,
>
> I just got the pywin32 "hello world" COM server to install and I did
> manage to use it from VB 6.0.
>
> However, there are some glitches I do not comprehend:
>
> 1) at one point I got a python runtime error telling me the
> "tes
Steven D'Aprano wrote:
> hex() of an int appears to return lowercase hex digits, and hex() of a
> long uppercase.
>
> >>> hex(75)
> '0x4b'
> >>> hex(75*256**4)
> '0x4BL'
>
> By accident or design? Apart from the aesthetic value that lowercase hex
> digits are ugly, should we care?
>
> It wo
Hello everyone
I have to write a verilog parser in python for a class project. I was
wondering if all you folks could advise me on choosing the right python
parser module. I am not comfortable with lex/yacc and as a result find
myself strugging with any module which use lex/yacc syntax/philosophy.
Steven Bethard wrote:
> py> def ge(items):
> ... return (item for item in items if item)
> ...
Bengt Richter wrote:
> >>> dis.dis(ge)
>2 0 LOAD_CONST 1 ( expression> at 02EE4FA0, file "", line 2>)
>3 MAKE_FUNCTION0
>6 LOA
On Wed, 13 Jul 2005 03:24:48 +1000, "Jeff Melvaine" <[EMAIL PROTECTED]> wrote:
>Bengt,
>
>Thanks for your informative reply, further comments interleaved.
Can't reply fully now, but just had the thought that maybe some ideas
from 8-queens solvers might be useful or interesting. There is an old th
On Wed, Jul 13, 2005 at 03:24:48AM +1000, Jeff Melvaine wrote:
> Bengt,
>
> Thanks for your informative reply, further comments interleaved.
>
> "Bengt Richter" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > On Mon, 11 Jul 2005 02:37:21 +1000, "Jeff Melvaine"
> > <[EMAIL PROT
On Tue, 12 Jul 2005 11:52:41 -0400, Tim Peters <[EMAIL PROTECTED]> wrote:
>[Peter Hansen]
>...
>> I suppose I shouldn't blame setdefault() itself for being poorly named,
>
>No, you should blame Guido for that .
>
>> but it's confusing to me each time I see it in the above, because the
>> name does
<[EMAIL PROTECTED]> wrote
> > And what should happen for vectors of size != 3 ? I don't think that a
> > general purpose vector class should allow it; a Vector3D subclass would
> > be more natural for this.
>
> That's the 'magic' good idea I'm looking for. I think a unified Vector
> class for all
Recently I tried to slice every element of a list of strings. First I tried:
f = open("export.xls", "r")
lines = f.readlines()
for line in lines:
line = line[1:-5]
line = line.split('\"\t\"')
This went without returning any errors, but nothing was sliced or
split. Next I tried:
for i in
How's this for an answer, it even uses yahoo in the example!
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/391929
Greg
--
http://mail.python.org/mailman/listinfo/python-list
Alex Dempsey wrote:
>Recently I tried to slice every element of a list of strings. First I tried:
>
>f = open("export.xls", "r")
>lines = f.readlines()
>
>for line in lines:
>line = line[1:-5]
>line = line.split('\"\t\"')
>
>
This, in fact, did do the operation you expected, but after cr
"edgrsprj" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "edgrsprj" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> PROPOSED EARTHQUAKE FORECASTING
>> COMPUTER PROGRAM DEVELOPMENT EFFORT
>
>> it jumps strait to the display routine and uses the entered command to
>
Dark Cowherd wrote:
> But one advise that he gives which I think is of great value and is
> good practice is
> "Always catch any possible exception that might be thrown by a library
> I'm using on the same line as it is thrown and deal with it
> immediately."
That's fine advice, except for when it
Hi guys,
Thank you all for your input! It was good to see so much convergence in the
approach! Again, I think that it speaks loudly for the concise way of doing
thins in Python... Anyway, I have typed in all of the solutions and have
gained a great understanding of how to do this in future.
T
tuxlover wrote:
> I have to write a verilog parser in python for a class project. I was
> wondering if all you folks could advise me on choosing the right python
> parser module. I am not comfortable with lex/yacc and as a result find
> myself strugging with any module which use lex/yacc syntax/phi
Gary Herron wrote:
> Alex Dempsey wrote:
>> for line in lines:
>>line = line[1:-5]
>>line = line.split('\"\t\"')
> This, in fact, did do the operation you expected, but after creating the
> new value and assigning it to line, you promptly threw it away. (Because
> the loop then went back
Hi,
I think I need an iterator over a string of characters pulling them out
one by one, like a usual iterator over a str does. At the same time the
thing should allow seeking and telling like a file-like object:
>>> f = frankenstring("0123456789")
>>> for c in f:
... print c
... if c == "
Peter Otten wrote:
> Repton wrote:
>
>>I often find myself storing data in a list of tuples, and I want to ask
>>questions like "what is the index of the first tuple whose 3rd element
>>is x",
iter(n for n, elem in enumerate(lst) if elem[3] == x).next()
>>or "give me the first tuple whose 2
Alex Dempsey wrote:
> Recently I tried to slice every element of a list of strings. First I tried:
>
> f = open("export.xls", "r")
> lines = f.readlines()
>
> for line in lines:
> line = line[1:-5]
> line = line.split('\"\t\"')
>
> This went without returning any errors, but nothing was
tuxlover enlightened us with:
> No, the replies from Grant's and Sybren's do answer my question.
It would be a lot more polite to actually thank the people helping
you.
Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't
I recently was successful using pyparsing after messing around with ply
for a few hours. See my blog for more details (
http://panela.blog-city.com/icfp_contest_implementation_in_python_notes.htm
).
I personally corresponded with the author and he was very helpful as
well, giving my useful critiq
see StringIO or cStringIO in the standard library.
--
http://mail.python.org/mailman/listinfo/python-list
Devan L wrote:
> Well, the string that gets passed is more or less a function
> definition, which is then called with exec. I don't see why you'd need
> to write a string out with the function definition and then call it.
> You could just write the function.
>
> As for the nested functions, I had
Hi,
I am looking for documentation on the plot module. Does anyone know where I
can find this information? Thanks.
Shankar
--
http://mail.python.org/mailman/listinfo/python-list
Christopher Subich wrote:
> try:
> f=file('file_here')
> except IOError: #File doesn't exist
> error_handle
> error_flag = 1
> if not error_flag:
> do_setup_code
> do_stuff_with(f)
>
> which nests on weird, arbitrary error flags, and doesn't seem like good
> programming to me.
Alex Dempsey wrote:
> for line in lines:
> line = line[1:-5]
> line = line.split('\"\t\"')
>
> This went without returning any errors, but nothing was sliced or split.
> Next I tried:
>
> for i in range(len(lines)):
> lines[i] = lines[i][1:-5]
> lines[i] = lines[i].split('\"\t\"'
import math
class Vector:
def __init__(self, coordinates):
self.coordinates = coordinates
self.magnitude = sum([c**2 for c in coordinates])**0.5
self.direction = getangle(Vector([1]+[0 for i in
range(len(coordinates)-1)]))
def dotproduct(self, vector):
sum([a
| I've been doing a lot of reading about static methods in Python,
and possibly getting over-confused by the minutia of the CPython
implementation, as well as by the misnomer. Conceptually, a 'static
method'
is a function attribute of a class that is to be used as a function and not
as a method
tuxlover wrote:
> Hello everyone
>
> I have to write a verilog parser in python for a class project. I was
> wondering if all you folks could advise me on choosing the right python
> parser module. I am not comfortable with lex/yacc and as a result find
> myself strugging with any module which use
> You missed Steven's point which is to quote the message to which you are
> replying. Not everyone is reading this list in a conveniently threaded
> form, so you need to provide some context for them to be able to follow
> along.
Ah, sorry, I didn't quite get what he was referring to.
--
http:/
Thomas Lotze wrote:
>Hi,
>
>I think I need an iterator over a string of characters pulling them out
>one by one, like a usual iterator over a str does. At the same time the
>thing should allow seeking and telling like a file-like object:
>
>
Okay, first off, this is never going to be *fast* comp
On Wed, 13 Jul 2005 03:47:07 +0800, "Ric Da Force" <[EMAIL PROTECTED]> wrote:
>Hi guys,
>
>Thank you all for your input! It was good to see so much convergence in the
>approach! Again, I think that it speaks loudly for the concise way of doing
>thins in Python... Anyway, I have typed in all of
Well... Thanks for that! The work is almost completed now! ;o)
Yannick
--
http://mail.python.org/mailman/listinfo/python-list
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> hex() of an int appears to return lowercase hex digits, and hex() of a
> long uppercase.
Already bug-reported and fixed for 2.5 (to use lowercase, I believe).
http://sourceforge.net/tracker/?group_id=5470&atid=105470
Christopher Subich <[EMAIL PROTECTED]> wrote:
>try:
>f = file('file_here')
>do_setup_code
>do_stuff_with(f)
>except IOError: # File doesn't exist
>error_handle
It's also a good idea to keep try blocks as small as possible, so you
know exactly where the error happened. Imagine if
Ric Da Force wrote:
> Hi guys,
>
> Thank you all for your input! It was good to see so much convergence in the
> approach!
Just for divergence, you can also do this with regular expressions:
>>> import re
>>> re.sub("(.*),(.*)", r"\1 and\2", "C1, C2, C3")
'C1, C2 and C3'
Alan.
--
http://mail.
On Tue, 12 Jul 2005 22:08:55 +0200, Thomas Lotze <[EMAIL PROTECTED]> wrote:
>Hi,
>
>I think I need an iterator over a string of characters pulling them out
>one by one, like a usual iterator over a str does. At the same time the
>thing should allow seeking and telling like a file-like object:
>
>>
jay graves wrote:
> see StringIO or cStringIO in the standard library.
Just as with files, iterating over them returns whole lines, which is
unfortunately not what I want.
--
Thomas
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 12 Jul 2005 13:30:14 -0700, Robert Kern <[EMAIL PROTECTED]> wrote:
>tuxlover wrote:
>> Hello everyone
>>
>> I have to write a verilog parser in python for a class project. I was
>> wondering if all you folks could advise me on choosing the right python
>> parser module. I am not comfortab
Peter Otten wrote:
> Repton wrote:
>
> > I often find myself storing data in a list of tuples, and I want to ask
> > questions like "what is the index of the first tuple whose 3rd element
> > is x", or "give me the first tuple whose 2nd element is y".
> >>> items = [(1, "a", 10), (2, "b", 20), (3,
Thomas Lotze wrote:
> Hi,
> I think I need an iterator over a string of characters pulling them out
> one by one, like a usual iterator over a str does. At the same time the
> thing should allow seeking and telling like a file-like object:
>
>
f = frankenstring("0123456789")
for c in f:
>
"Hank Oredson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "edgrsprj" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > "edgrsprj" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >> PROPOSED EARTHQUAKE FORECASTING
> >> COMPUTER PROGRAM DEVELOPMENT
I'm parsing a text file to extract word definitions. For example the
input text file contains the following content:
di.va.gate \'di_--v*-.ga_-t\ vb
pas.sim \'pas-*m\ adv : here and there : THROUGHOUT
I am trying to obtain words between two literal backslashes (\ .. \). I
am not able to match wo
I like to use Pythonwin as my desktop calculator. It's bothersome
to have to type in "from __future__ import division" into the
interactive window every time I open it. I've tried various ways to
attempt to get it to import new division at startup, but no luck. I
can get it to execute a file, bu
On Tue, 12 Jul 2005 21:17:07 +1000, Steven D'Aprano <[EMAIL PROTECTED]> wrote:
>hex() of an int appears to return lowercase hex digits, and hex() of a
>long uppercase.
>
hex(75)
>'0x4b'
hex(75*256**4)
>'0x4BL'
>
>By accident or design? Apart from the aesthetic value that lowercas
Robert Kern wrote:
>Not everyone is reading this list in a conveniently threaded
>form
>
>
Why not? Just about every modern newsgroup reader and e-mail app has a
threaded view option.
--
http://mail.python.org/mailman/listinfo/python-list
Alex Dempsey wrote:
> Recently I tried to slice every element of a list of strings. First I tried:
"slice"? Interesting terminology. Next problem you have, try posting an
example of your input, and your expected output.
E.g.
repr(input_string): '"foo"\t"barre"\t"zot"\t"X"\n'
repr(output_list): [
Stephen Toledo-Brown wrote:
> Tony Meyer wrote:
>
>>> Everyone complaining about Eclipse in this thread needs to go try
>>> 3.1. The interface is much much much more responsive.
>>
>>
>>
>> The problem with Eclipse, IMO, is Java. I've tried 3.1 on a WinXP
>> machine
>> and, like just about any
Has anyone written a browser plug-in for Python, similar to the Java
plug-in that Sun has switched to for applets?
Bill
--
http://mail.python.org/mailman/listinfo/python-list
Markus Wankus wrote:
>
> My opinion - If you aren't willing to try something new, or have an
> aversion to it in the first place, nothing we can say will change your
> mind.
Correction...
*There are some people, who* if they aren't willing to try something
new, or have an aversion to it in th
"edgrsprj" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "Hank Oredson" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> "edgrsprj" <[EMAIL PROTECTED]> wrote in message
>> news:[EMAIL PROTECTED]
>> > "edgrsprj" <[EMAIL PROTECTED]> wrote in message
>> > news:[EMAIL P
[EMAIL PROTECTED] wrote:
> I'm parsing a text file to extract word definitions. For example the
> input text file contains the following content:
>
> di.va.gate \'di_--v*-.ga_-t\ vb
> pas.sim \'pas-*m\ adv : here and there : THROUGHOUT
>
> I am trying to obtain words between two literal backslash
[Steven D'Aprano]
> > hex() of an int appears to return lowercase hex digits, and hex() of a
> > long uppercase.
[Terry Reedy]
> Already bug-reported and fixed for 2.5 (to use lowercase, I believe).
> http://sourceforge.net/tracker/?group_id=5470&atid=105470&func=detail&aid=1224347
Score another
This should give you an idea of how to go about it (needs python 2.3 or
newer):
import re
slashPattern = re.compile(r'\\(.*?)\\')
for i,line in enumerate(file("parseinput")):
print "line", i+1,
match = slashPattern.search(line)
if match:
print "matched:", match.group(1)
e
[EMAIL PROTECTED] wrote:
> Hi,
>
> I want to append one (huge) file to another (huge) file. The current
> way I'm doing it is to do something like:
>
> infile = open (infilename, 'r')
> filestr = infile.read()
> outfile = open(outfilename, 'a')
> outfile.write(filestr)
>
> I wonder if there is
Back in the day there was 'grail', which was a browser in its own right.
There may also have been a plug-in for other browsers, but I don't know
any real details about them.
Python itself has deprecated the 'restricted execution' environment it
had in previous versions, because ways to break out o
Joseph Garvin wrote:
> Robert Kern wrote:
>
>> Not everyone is reading this list in a conveniently threaded form
>>
>>
> Why not? Just about every modern newsgroup reader and e-mail app has a
> threaded view option.
My newsreader supports threading, but the first message I see in this
thread
Joseph Garvin wrote:
> Robert Kern wrote:
>
>>Not everyone is reading this list in a conveniently threaded
>>form
>
> Why not? Just about every modern newsgroup reader and e-mail app has a
> threaded view option.
Good point. Allow me to modify my statement: not all newsreaders/email
apps thre
Hi,
I'm after a no-op command, so that i can redirect
logging commands in performance critical code.
Something like this:
def log(*args): print args
def null_log(*args): pass
if not DEBUG: log = null_log
is unacceptable because of the overhead of calling
functions in python.
log ("about to sl
On Tue, 12 Jul 2005 17:17:46 -0600, Joseph Garvin wrote:
> Robert Kern wrote:
>
>>Not everyone is reading this list in a conveniently threaded
>>form
>>
>>
> Why not? Just about every modern newsgroup reader and e-mail app has a
> threaded view option.
Technology as a substitute for manners
[Michael Hudson]
> I doubt anyone else is reading this by now, so I've trimmed quotes
> fairly ruthlessly :)
Damn -- there goes my best hope at learning how large a message gmail
can handle before blowing up . OK, I'll cut even more.
[Michael]
>>> Can't we use the stuff defined in Appendix F and
I just use Gnuplot for plot module.
Maybe you can visit
http://gnuplot-py.sourceforge.net/
or the mailing list
http://lists.sourceforge.net/lists/listinfo/gnuplot-py-users
--- "Shankar Iyer ([EMAIL PROTECTED])"
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am looking for documentation on the plot mo
Shankar Iyer ([EMAIL PROTECTED]) wrote:
> Hi,
>
> I am looking for documentation on the plot module. Does anyone know where I
> can find this information? Thanks.
What is "the plot module"? There are any number of Python modules for
making plots and charts. Some of them may even be called "pl
[EMAIL PROTECTED] wrote:
> I will transfer eventually use a database but is there any way for now
> you could help me make the text files? Thank you so much. Reece
>
No. There is utterly no reason why you should create 5000 or 3 text
files. While you are waiting to get a clue about databas
Scott David Daniels wrote:
> Now if you want to do it for a file, you could do:
>
> for c in thefile.read():
>
The whole point of the exercise is that seeking on a file doesn't
influence iteration over its content. In the loop you suggest, I can
seek() on thefile to my heart's
Yes, thanks, back in the day I used Grail and played with rexec.
I notice that one of the Summer of Code projects was to recreate
rexec, but don't know if it was funded.
Presumably a Firefox plug-in for Python would restrict the execution
environment in some safe way, and provide some kind of UI
When: July 13, 7:30-9:00 PM
Where: Zope Corp offices
(513 Prince Edward Street; Fredericksburg, VA 22408)
Details at http://www.zope.org/Members/poster/fxbgzpug_announce_2
Hope to see you there!
--
Benji York
--
http://mail.python.org/mailman/listinfo/python-list
Does anyone know of a good standalone implementation of multivariable
polynomials in python?
Thanks,
Chris
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 13 Jul 2005 11:00:14 +1000, Simon Burton wrote:
> Hi,
>
> I'm after a no-op command, so that i can redirect
> logging commands in performance critical code.
>
> Something like this:
>
> def log(*args): print args
> def null_log(*args): pass
> if not DEBUG: log = null_log
>
> is unaccep
Dark Cowherd <[EMAIL PROTECTED]> writes:
> But one advise that he gives which I think is of great value and is
> good practice is
> "Always catch any possible exception that might be thrown by a library
> I'm using on the same line as it is thrown and deal with it
> immediately."
Yuch. That sort
"Jive Dadson" <[EMAIL PROTECTED]> writes:
> I like to use Pythonwin as my desktop calculator. It's bothersome
> to have to type in "from __future__ import division" into the
> interactive window every time I open it. I've tried various ways to
> attempt to get it to import new division at startu
(All previous quoting ruthlessly snipped.)
A question for Tim Peters, as I guess he'll have the most experience in
this sort of thing.
With all the cross-platform hassles due to the various C compilers not
implementing the IEEE standard completely or correctly, I wonder how much
work would be inv
On Wed, 13 Jul 2005 11:38:44 +1000, John Machin wrote:
> [EMAIL PROTECTED] wrote:
>> I will transfer eventually use a database but is there any way for now
>> you could help me make the text files? Thank you so much. Reece
>>
>
> No. There is utterly no reason why you should create 5000 or 300
On Wed, 13 Jul 2005 11:00:14 +1000, Simon Burton <[EMAIL PROTECTED]> wrote:
>
>Hi,
>
>I'm after a no-op command, so that i can redirect
>logging commands in performance critical code.
>
>Something like this:
>
>def log(*args): print args
>def null_log(*args): pass
>if not DEBUG: log = null_log
>
>
OK, I can see that the Python way of doing things is very different.
However I think Roy made a very pertinent point
"Imagine if do_setup_code or
do_stuff_with(f) unexpectedly threw an IOError for some reason totally
unrelated to the file not existing."
This is the kind of situation that the rule '
Thomas Lotze wrote:
> Neither does it to me. What about
>
> try:
> f=file('file_here')
> except IOError: #File doesn't exist
> error_handle
> else:
> do_setup_code
> do_stuff_with(f)
>
> (Not that I'd want to defend Joel's article, mind you...)
That works. I'm still not used to
> You know, this is the most concise example of feature-creep in a
> specification that I've ever seen.
>
You're right. I'm afraid it's from too much work and too little sleep.
I'll try to be more precise next time.
Thanks to everyone for their help.
Chris
--
http://mail.python.org/mailman/lis
Bengt Richter wrote:
> On Wed, 13 Jul 2005 11:00:14 +1000, Simon Burton <[EMAIL PROTECTED]> wrote:
>
>
>>Hi,
>>
>>I'm after a no-op command, so that i can redirect
>>logging commands in performance critical code.
>>
>>Something like this:
>>
>>def log(*args): print args
>>def null_log(*args): pas
On Wed, 13 Jul 2005 03:49:16 +0200, Thomas Lotze <[EMAIL PROTECTED]> wrote:
>Scott David Daniels wrote:
>
>> Now if you want to do it for a file, you could do:
>>
>> for c in thefile.read():
>>
>
>The whole point of the exercise is that seeking on a file doesn't
>influence iter
On Monday 11 July 2005 08:53 pm, Bengt Richter wrote:
> On Tue, 12 Jul 2005 10:12:33 +1000, John Machin <[EMAIL PROTECTED]> wrote:
> >Bengt Richter wrote:
> >> for x in (x for x in seq if x is not None):
> >Byzantine ...
> Perhaps not if you wanted to enumerate the selected elements, as in
>
>> Jorey Bump wrote:
>>
>>> Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
>>>
it's.
>>> +1 for this becoming the official name of Python 3000. ;)
Monty Python's Flying Circus used to begin with "It's..." I had read at one
time that "It's" was one of the original names proposed f
Content violation found in email message.
From: python-list@python.org
To: [EMAIL PROTECTED]
File(s): message.zip
Matching filename: message.zip
--
http://mail.python.org/mailman/listinfo/python-list
On Tuesday 12 July 2005 10:28 am, Tim Golden wrote:
> [Jeremy Sanders]
> | rbt wrote:
> |
> | > What is the appropriate way to break out of this while loop
> | if the for
> | > loop finds a match?
> |
> | queue discussion why Python doesn't have a "break N" statement...
>
>
>
> Presumably you
Reinhold Birkenfeld wrote:
> Jacob Page wrote:
>
>>I'd like to
>>run my code through actual set and frozenset unit tests. Does any such
>>code exist? Is it in pure Python? If so, where can it be obtained?
>
> Look at /usr/lib/python2.x/test/ (on unix platforms).
Thanks for pointing that to
101 - 200 of 205 matches
Mail list logo