You could invert your if-expressions, e.g. instead of
if query_company_name:
...
you could write
if not query_company_name:
return adresses, company
...
This way you could save some indentation.
If you want to get rid of the for loops, you could look at list
comprehensions, e
On Fri, Sep 25, 2009 at 1:00 AM, Norman Khine wrote:
>>> Is there a better method to write the last bit of the code.
> Apologies for not being clear. I was thinking more that I may have
> one the too many 'for' loops at the end of the code.
>
> http://paste.lisp.org/display/87659#1
It's only t
On Thu, Sep 24, 2009 at 10:25 PM, Kent Johnson wrote:
> On Thu, Sep 24, 2009 at 2:12 PM, Norman Khine wrote:
>> Hello,
>> I have this function in my class:
>>
>> http://paste.lisp.org/display/87659
>>
>> Is there a better method to write the last bit of the code.
>
> Better in what way? What are
On Thu, Sep 24, 2009 at 2:12 PM, Norman Khine wrote:
> Hello,
> I have this function in my class:
>
> http://paste.lisp.org/display/87659
>
> Is there a better method to write the last bit of the code.
Better in what way? What are these things? What is resource? Some
context would be helpful, I s
Hello,
I have this function in my class:
http://paste.lisp.org/display/87659
Is there a better method to write the last bit of the code.
Thanks
Norman
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.py
Jacob S. wrote:
>> Text mode is the default, you have to specify the 'b' if you want
>> binary mode. And open() seems to accept any mode quite happily:
>>
>> >>> f=open('build.xml', 'rt')
>> >>> f
>>
>> >>> f.close()
>> >>> f=open('build.xml', 'rabcd')
>> >>> f
>>
>>
>> Kent
>
>
> I'll bet you
> Text mode is the default, you have to specify the 'b' if you want binary
> mode. And open() seems to accept any mode quite happily:
>
> >>> f=open('build.xml', 'rt')
> >>> f
>
> >>> f.close()
> >>> f=open('build.xml', 'rabcd')
> >>> f
>
>
> Kent
I'll bet you'll find that open() is coded somet
lmac wrote:
> ---
>
>The problem with downloading the images is this:
>
>-
>http://images.nfl.com/images/globalnav-shadow-gray.gif
>Traceback (most recent call last):
> File "/home/internet/bin/nflgrab.py", line 167, in ?
>urllib.urlretrieve(img,img[f:])
> File "/usr/
-- Forwarded message --
Date: Tue, 11 Oct 2005 20:55:24 +0200
From: lmac <[EMAIL PROTECTED]>
To: Danny Yoo <[EMAIL PROTECTED]>
Subject: Re:code improvement for beginner ?
Danny Yoo wrote:
>
>>>The point of this restructuring is to allow you to add more image
>>>types without too
Kent Johnson wrote:
> Roel Schroeven wrote:
>
>> Danny Yoo wrote:
>>
>>
>>> Looking at pageimgs(): I'm not sure what 't' means in the open
>>> statement:
>>>
>>> f = open(filename, "rt")
>>
>> It's not a typo. 't' opens the file in text mode.
>
>
> Are you sure? Is that documented anywhere?
> > The point of this restructuring is to allow you to add more image
> > types without too much pain, since there's no more hardcoded array
> > indexing against r1. It also simplifies to calls to imgreg from:
> >
> > if imgreg(r1[0],a) == 1:
> > continue
> > if imgreg(r1[1],a) =
Roel Schroeven wrote:
> Danny Yoo wrote:
>
>>Looking at pageimgs(): I'm not sure what 't' means in the open statement:
>>
>> f = open(filename, "rt")
>
> It's not a typo. 't' opens the file in text mode.
Are you sure? Is that documented anywhere?
Text mode is the default, you have to spec
Danny Yoo wrote:
>
> On Sat, 8 Oct 2005, lmac wrote:
>
>
>>Ok. Here we go. Wanted to start my page long ago. Now is the right time.
>>
>>http://daderoid.freewebspace24.de/python/python1.html
>
>
> Hi lmac,
>
> I'll pick out some stuff that I see; I'm sure others will be happy to give
> commen
Danny Yoo wrote:
> Looking at pageimgs(): I'm not sure what 't' means in the open statement:
>
> f = open(filename, "rt")
>
> and I think that 't' might be a typo: I'm surprised that Python doesn't
> complain. Can anyone confirm this? I think you may have tried to do "r+"
> mode, but even
On Sat, 8 Oct 2005, lmac wrote:
> Ok. Here we go. Wanted to start my page long ago. Now is the right time.
>
> http://daderoid.freewebspace24.de/python/python1.html
Hi lmac,
I'll pick out some stuff that I see; I'm sure others will be happy to give
comments too. I'll try to make sure that all
Ok. Here we go. Wanted to start my page long ago. Now is the right time.
http://daderoid.freewebspace24.de/python/python1.html
Thank you.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On Sat, 8 Oct 2005, lmac wrote:
> i wonder if i could post some of my scripts and anyone can tell me if
> there is a better way for coding the problem. In the way of some
> teaching class. ;-)
Sure, that's perfectly fine. If the script is very large, you may want to
post it on the web and sen
Hi there,
i wonder if i could post some of my scripts and anyone can tell me if
there is a better way for coding the problem. In the way of some
teaching class. ;-)
Or is this mailing-list only for specific questions ?
Thanks.
___
Tutor maillist - Tu
18 matches
Mail list logo