using the following program:
prefixes = "JKLMNOPQ"
suffix = "ack"
for letter in prefixes:
print letter + suffix
if prefixes == "O" or "Q"
print letter + "u" + suffix
For this program I am trying to combine the individual letters with the suffix to form names...but for O and Q I n
I have started out trying to learn Python for my first programming language. I am starting off with the book "how to think like a computer scientist." I spend about 4-5 hrs a day trying to learn this stuff. It is certainly no easy task. I've been at it for about 1-2 weeks now and have a very el
Does anyone know if there is an "answer key" to all of the exercises in "how to think like a computer scientist"sure would be a lot easier to refer to that instead of tying up this forum with questions about exercises I'm sure that have been asked before
Yahoo! FareChase - Search multiple tr
I am learning as Python as we speak, to do some text processing stuff. For instance,>>> l = [[]]*5>>> l[0].append("a")>>> l[['a'], ['a'], ['a'], ['a'], ['a']]just bit me; however, thats not the question. In an effort to avoid another potential mistake, I am wondering if the anonymous file ob
Here's one I used a while back. Returns a dict containing details per
partition
def _getAvailPartitions():
validTypes = [ 'ufs', 'nfs', 'reiserfs' ]
mntTab = file( '/etc/mtab', 'r' )
drvDetails = {}
for mntLine in mntTab:
splitLine = mntLine.split()
Attacked is a piece of code which first hits the login page
successfully and receives back login cookies. But then when I attempt
to hit a page which is restricted to logged in users only, I fail.
That seems to be because I am not successfully re-attaching the cookies
to the header portion of the
ders on my request object, they are empty? I thought
that I should find the cookies there which are being sent back. This
is what I thought the problem was. Thanks if anyone can explain how
that works.
John
(PS i have stopped attacking the cookies now)
[EMAIL PROTECTED] wrote:
> Attacked
HeyI have signed up to receive emails from the python forum and the amount of emails I receive on any day is fairly numerous...Does anyone know if I can somehow separate all mails coming from the python forum from all of my other mail, so I can open it from another folder or something like that
Hi all,
I'm using teh tkFileDialog to let teh user select a directory. We have
long names which make
it difficult to view the directories.
For some reason the GUI windows doesn;t expand on Windows like it does
on OS X or Linux.
Is there a method to make the widths of the tkFileDialog windows
hey...I know this is off the "python" topicbut I have yahoo mail and would like to change my "sender name" I have gone to the "edit account" area and have changed all names that can be edited to a consistent name other than the current sender name...but for some reason it will not change the s
On Wed, 10 Nov 2004 19:55:54 +0100 (CET)
[EMAIL PROTECTED] wrote:
> Send Python-list mailing list submissions to
> python-list@python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://mail.python.org/mailman/listinfo/python-list
> or, via email, send a
I am looking for a Python tookit that will enable me to cut section of
a picture out from an EPS file and create another EPS file.
I am using a proprietary package for doing certain engineering
calculations. It creates single page x-y line plots that has too much
blank spaces around the plotted a
Thanks for the reply.
Yes, that would have been too easy :=)
If I change the bbox, I would cut out the lower 1/3 of the plot. I
only want to apply it to the top 2/3 of the page.
Regards,
--
JH
--
http://mail.python.org/mailman/listinfo/python-list
bazfoobar'
>>> foofoo.match(s).group(1)
'foo'
>>> foofoo.match(s).group(2)
'barbaz'
>>> foofoo.match(s).group(3)
'foo'
>>> foofoo.match(s).group(4)
'bar'
>>>
So, is this a bug, or just a problem with my understanding? If it's my
brain that's broken, what's the proper way to do this with regexps?
And, if the above is expected behavior, should I submit a doc bug? It's
clear that the "?" qualifier (applied to the second foo group) is _not_
greedy in this situation.
-John
--
http://mail.python.org/mailman/listinfo/python-list
> [John Hazen]
> > I want to match one or two instances of a pattern in a string.
> >
> > >>> s = 'foobarbazfoobar'
> > >>> foofoo = re.compile(r'^(foo)(.*?)(foo)?(.*?)$')
> > >>> foofoo.match(s).group(1)
> > &
tch, and you
> try again. The "greedy" vs. "non-greedy" describes the order that the
> term in question tries matches. If it's greedy, it will try the
> longest possible match first. If it's non-greedy, it'll try the
> shortest possible match first.
That
Hi,
For strings of > 1 character, what are the chances
that hash(st) and hash(st[::-1]) would return the
same value?
My goal is to uniquely identify multicharacter strings,
all of which begin with "/" and never end with "/".
Therefore, st != st[::-1].
Thanks,
John
--
Scott David Daniels wrote:
> John Marshall wrote:
>
>>For strings of > 1 character, what are the chances
>>that hash(st) and hash(st[::-1]) would return the
>>same value?
>
>
> Why not grab a dictionary and do the stats yourself?
I was actually interested
Tim Peters wrote:
> [John Marshall]
> Second, what are your assumptions about (a) the universe of strings;
> and, (b) the hash function?
My assumptions are:
(a) valid and "reasonable" pathnames (e.g., 1024
characters long)
(b) just the builtin hash().
The goal is to b
Hi.
>>> import time, calendar, datetime
>>> n= 1133893540.874922
>>> datetime.datetime.fromtimestamp(n)
datetime.datetime(2005, 12, 6, 10, 25, 40, 874922)
>>> lt= _
>>> datetime.datetime.utcfromtimestamp(n)
datetime.datetime(2005, 12, 6, 18, 25, 40, 874922)
>>> gmt= _
So it's easy to create datet
I think that's supposed to be [(i + j) % 2] for the index to the
("green","red") tuple
(since i*8 is always even).
[EMAIL PROTECTED] wrote:
> Mike,
>
> Thanks for your insight. It has been a big help.
>
> I guess I was trying to learn too much with my original code. Trying to
> implement inheritan
Andrew Dalke wrote:
> "It's me" wrote:
> > Here's a NDFA for your text:
> >
> >b 0 1-9 a-Z , . + - ' " \n
> > S0: S0 E E S1 E E E S3 E S2 E
> > S1: T1 E E S1 E E E E E E T1
> > S2: S2 E E S2 E E E E E T2 E
> > S3: T3 E E S3 E E E E E E T3
>
> Now if I only h
I've been interested in Python for a while now but haven't had an
opportunity to use / learn it. I'm tasked now with a project at work that
might be my first opportunity.
I have to write a ~75 concurrent user document storage app. that allows
users to scan documents from locally attached scan
Hello there. I've run into some missing functionality with HTTP Digest
authentication in the 2.3 library and I was wondering if I'm just
missing something.
Missing functionality the first: urllib2
1a. You can add "handlers" to your opener indicating that you want to
use HTTP Digest auth.
Kamilche wrote:
> What a debug nightmare! I just spent HOURS running my script through
> the debugger, sprinkling in log statements, and the like, tracking
down
> my problem.
>
> I called a function without the ending parentheses. I sure do WISH
> Python would trap it when I try to do the following
Dan Bishop wrote:
> Kamilche wrote:
> > What a debug nightmare! I just spent HOURS running my script
through
> > the debugger, sprinkling in log statements, and the like, tracking
> down
> > my problem.
> >
> > I called a function without the ending parentheses. I sure do WISH
> > Python would tra
In comp.lang.python, [I] wrote:
> Hello there. I've run into some missing functionality with HTTP Digest
> authentication in the 2.3 library and I was wondering if I'm just
> missing something.
>
> Missing functionality the first: urllib2
>
> 1a. You can add "handlers" to your opener indicating
cles/teoseatsoecg/theendofsoftwareengineering.htm
His thesis is very simple: engineering took a wrong turn after
WW II, and the people who coined the term "software engineering"
didn't have a clue.
Of course, he puts it a bit more diplomatically, but he's
got the data to demonstrate that software engineer
y merely be exposing a bug in your
code caused by e.g. an uninitialised variable. (-: When you say "things
work fine" in normal interpreter mode, where does this lie in the
continuum between "it ran regression tests and volume tests happily all
night" and "I fired it
Anders J. Munch wrote:
> Another way is the strategy of "it's easier to ask forgiveness than
to
> ask permission".
> If you replace:
> if(not os.path.isdir(zfdir)):
> os.makedirs(zfdir)
> with:
> try:
> os.makedirs(zfdir)
> except EnvironmentError:
> pass
>
> the
[EMAIL PROTECTED] wrote:
> the script i have sock.py runs if i say something like :
>
> python sock.py
>
> but ./sock.py results in a :bad interpreter error
> how do i troubleshoot something like this?
sounds like you've been editting the script on a windows machine, and
it's inserted it's evil l
ical, not practical.
>
> Python was designed for and logic (among everything else). If you
want
> practical code, use it.
>
> if match1 and match2: do whatever.
>
Provided you are careful to avoid overlapping matches e.g. data = 'Fred
Johnson', query = ('John',
On 03 Jan 2005 18:11:06 +, John J. Lee <[EMAIL PROTECTED]> wrote:
> (Re ternary operator: Everybody who read this list at certain times in
> the past is painfully aware of that fact, and of precisely why it's
> not quite true, and of all the syntax alternatives for real te
On 03 Jan 2005 18:27:52 +, John J. Lee <[EMAIL PROTECTED]> wrote:
> Jonas Galvez <[EMAIL PROTECTED]> writes:
>
>> Christopher J. wrote:
>> > I tried this, but it didn't work:
>> > conn.request("GET", "/somepage.html", None,
&
Steven Bethard wrote:
> Sorry if this is a repost -- it didn't appear for me the first time.
>
>
> So I was looking at the Language Reference's discussion about
emulating
> container types[1], and nowhere in it does it mention that .keys() is
> part of the container protocol.
I don't see any refe
Fuzzyman wrote:
> I have a friend who would like to move and program lights and other
> electric/electro-mechanical devices by computer. I would like to help
-
> and needless to say Python would be an ideal language for the
> 'programmers interface'.
Try Googling for "Python X10"
--
http://mail
n favor of the direction Guido
seems to be going.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
Steven Bethard wrote:
> John Machin wrote:
> > Steven Bethard wrote:
> >
> >>So I was looking at the Language Reference's discussion about
> >>emulating container types[1], and nowhere in it does it mention
that
> >> .keys() is part of the container
"right" table.
Step 3: for english, obj in mydict.iteritems(): process(english, obj)
As your datasets are stored in MS Excel spreadsheets, N < 64K so
whether your solution is O(N) or O(N*log(N)) doesn't matter too much.
You are however correct to avoid O(N**2) solutions.
Hoping this sketch of the view through the telescope (and the
rear-vision mirror!) is helpful,
John
--
http://mail.python.org/mailman/listinfo/python-list
##
from Tkinter import *
tk = Tk()
tk.iconbitmap(default='foo.ico')
Label(tk, text='This window now has a custom icon.').pack()
t = Toplevel(tk)
Label(t, text='This one has the same custom icon.').pack()
tk.mainloop()
#
I hope this is helpful to people...
(now to see if I can figure out how to submit a patch in Sourceforge)
--
John.
--
http://mail.python.org/mailman/listinfo/python-list
g to spend those same months writing
a current source to XML translator, and then writing
XSLT or more scripts to do the translations to final
format, a strategy which would arguably be much more
beneficial for the Python community as a whole.
The bottom line is that I'm not going to be w
hat could be
compiled directly to machine code, and start recoding the
various C and Asm parts in that. See the PyPy project for
the direction they're taking for writing the Python system in
Python.
Have fun with the project!
John Roth
Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
Any thoughts would be appreciated.
John Pote
--
http://mail.python.org/mailman/listinfo/python-list
I'm putting together a new project which I'm using to learn Python and have
questions about pyro. I like the idea of the abstraction that pyro offers
from sockets programming but I cannot determine if I'm giving up some
possibly needed functionality.
If the server needs to send an unsolicited a
.
Going the other way, the word "self" could become
a keyword, removing the necessity of specifying it
among the method parameters. While I like the idea,
there's enough dislike of the notion that it's not going
to happen.
John Roth
--
mvh Björn
--
http://mail.python.org/mailman/listinfo/python-list
uot;self". Using anything else, while legal, is just being different for
the sake of being different.
Didn't you mean instance method? Class methods are a different
beast, and the few examples I've seen seem to use the word "klas".
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
un into an application
where they need to use it.
I think it would be a good idea for the Python team to address
decent support for multiprocessors, but I hardly think it is a crisis.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
"Donn Cave" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Quoth Skip Montanaro <[EMAIL PROTECTED]>:
|
| Jp> How often do you run 4 processes that are all bottlenecked on
CPU?
|
| In scientific computing I suspect this happens rather frequently.
I think he was trying to say more
"Peter Hansen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
John Roth wrote:
I have yet to write a multi-thread program for performance reasons.
If we include in the set of things covered by the term
"performance" not only throughput, but also latency, t
brolewis wrote:
> I need to install Python on a number of laptop computers (at least a
> dozen). I am needing to install Python 2.4, pycrypto, win32all,
> wxPython, and pyCurl.
You could try the recently-announced MOVPY, or NSIS/InnoSetup as you
say.
Or simply put the five installers on a disk -
Bulba! wrote:
> On 4 Jan 2005 14:33:34 -0800, "John Machin" <[EMAIL PROTECTED]>
> wrote:
>
> >(b) Fast forwarding 30+ years, let's look at the dictionary method,
> >assuming you have enough memory to hold all your data at once:
> >
> >Step 1:
an operating system kernel and can also be converted
cleanly to the operating system subset of C, and write a converter
that does it.
That's the easy part. The hard part is writing the operating
system. Look at the (lack of) progress the GNU HURD
project has been making recently.
John Roth
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
ban :-)
I should probably get back to it at some stage.
As my ex-wife was fond of saying, "I wish you'd have
told me it was impossible before I did it."
John Roth
see http://cleese.sourceforge.net/
James Tauber
http://jtauber.com/blog/
--
http://mail.python.org/mailman/listinfo/python-list
n Smalltalk but not in Python
is that Smalltalk requires the declaration of instance variables. Also
Smalltalk does not have things like module variables and builtins.
The interpreter knows exactly what every name references, which
isn't true in Python.
John Roth
Alex
--
http://mail.python.org/mailman/listinfo/python-list
Bulba! wrote:
> On 8 Jan 2005 18:25:56 -0800, "John Machin" <[EMAIL PROTECTED]>
> wrote:
>
> >Secondly, you are calling cmp() up to THREE times when once is
enough.
> >Didn't it occur to you that your last elif needed an else to finish
it
> >off, and
that the fastest version
uses the array module, and is quite comprehensible -
if you know the array module and how it works.
It doesn't use the map function.
John Roth
?
--
http://mail.python.org/mailman/listinfo/python-list
Steven Bethard wrote:
> Note that list comprehensions are also C-implemented, AFAIK.
Rather strange meaning attached to "C-implemented". The implementation
generates the code that would have been generated had you written out
the loop yourself, with a speed boost (compared with the fastest DIY
ap
Andrea Griffini wrote:
> On 9 Jan 2005 12:39:32 -0800, "John Machin" <[EMAIL PROTECTED]>
> wrote:
>
> >Tip 1: Once you have data in memory, don't move it, move a pointer
or
> >index over the parts you are inspecting.
> >
> >Tip 2: Develop an
make all I had to do was
chance cl to icl and use the correct linker. You can tune the
performance playing with switches, but I got a factor 3 improvement on
a DCT type algorithm with out of the box settings.
I can send you an example makefile if you want
John Carter
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
you probably want to look into building set-like objects ontop of
tries, given the homogeneity of your language. You should see
imrpovements both in size and speed.
--
http://mail.python.org/mailman/listinfo/python-list
It doesn't work because Python scripts
must be in ASCII except for the
contents of string literals. Having a function
name in anything but ASCII isn't
supported.
John Roth
"Michel Claveau - abstraction mÃta-galactique non triviale en fuite
perpÃtuelle." <[EMAIL PROTECTED]&
On Tue, Jan 11, 2005 at 12:33:42AM +0200, Simo Melenius wrote:
> "John Lenton" <[EMAIL PROTECTED]> writes:
>
> > you probably want to look into building set-like objects ontop of
> > tries, given the homogeneity of your language. You should see
>
Class.__methods__
> 2) dict (because of default values: "param = None") =
> Class.__method__[0].__params__
>>> import inspect
>>> help(inspect)
HTH
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
In Greene, New York, it is illegal to eat peanuts and walk bac
; different value for the second parameter, maybe?)
Å isn't part of ISO 8859-1, so you can't get it that way. You can do
one of
u'\u0153'
or, if you must,
unicode("\305\223", "utf-8")
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
t; ord(c_cedilla)
231
>>> ord("\347")
231
What you did with c_cedilla "worked" because it was effectively doing
nothing. However if you do unicode(char, encoding) where char is not in
encoding, it won't "work".
As John Lenton has pointed out, if
Some poster wrote (in connexion with another topic):
> ... unicode("\347", "iso-8859-1") ...
Well, I haven't had a good rant for quite a while, so here goes:
I'm a bit of a retro specimen, being able (inter alia) to recall octal
opcodes from the ICT 1900 series (070=call, 072=exit, 074=branch, .
brolewis wrote:
> I have a directory that has two files in it:
>
> parse.py
> parser.py
>
> parse.py imports a function from parser.py and uses it to parse out
the
> needed information. On Linux, the following code works without a
> problem:
>
> parse.py, line 1:
> from parser import regexsearch
>
brolewis wrote:
> I have a directory that has two files in it:
>
> parse.py
> parser.py
>
> parse.py imports a function from parser.py and uses it to parse out
the
> needed information. On Linux, the following code works without a
> problem:
>
> parse.py, line 1:
> from parser import regexsearch
>
avoid considering words that are so long or so
short that they cannot possibly be matches. For example, with
approximate matching based on edit distance, if you are searching for a
10-letter word allowing for 2 errors, you can avoid doing the
complicated comparison on words shorter than 8 or longer than 12.
HTH,
John
--
http://mail.python.org/mailman/listinfo/python-list
Lucas Raab wrote:
> I didn't want to go through the rigamole of adding myself to the
SciTe
> mailing list, so I'm asking my question here. How do I choose a
> different C/C++ compiler to compile in?? I don't use the g++
compiler; I
> use the VC 7 compiler.
>
> TIA,
> Lucas
How the @#$% should we
matching the regexp against the big string, may
> well be faster than using some fancy algorithm coded completely in
> python.
Paul, given the OP appears to want something like words that match any
(per)mutation of any substring of his query string -- and that's before
factoring in wi
> Quite frequently, I find the need to iterate over two sequences at
the
> same time, and I have a bit of a hard time finding a way to do this
in a
> "pythonic" fashion. One example is a dot product. The straight-ahead
> C-like way of doing it would be:
>
> def dotproduct(a, b):
>psum = 0
>
> Downloading, installing, and getting to know numerical modules for
> Python is mext on my list :). However, I was under the impression
that
> Numarray is preferred to Numeric -- is that correct? Are these two
> competing packages? (Hopefully this is not flame war bait...)
Numeric's dot uses, if
> If you could help me figure out how to code a solution
> that won't be a resource whore, I'd be _very_ grateful. (I'd prefer
to
> keep it in Python only, even though I know interaction with a
> relational database would provide the fastest method--the group I'm
> trying to write this for does not
s
index method -- which by now you have probably found works straight out
of the box and is more than fast enough for your needs.
BTW, you need to clarify "don't have access to an RDBMS" ... surely
this can only be due to someone stopping them from installing good free
software freely a
anged.
Classic classes will go away sometime in the future, currently
planned for the semi-mythical 3.0 release.
John Roth
Sw.
--
http://mail.python.org/mailman/listinfo/python-list
If what you want is to insert a method into an
instance, look at new.instancemethod.
John Roth
"michael" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hi,
below is a snipplet that could be seen as a part of a spreadsheet with
getter and setter properties and a way ho
just: it has
to work the same on the core platforms, and
if anyone else really wants to work on the others,
more power to them.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
read())
although you might want to be smarter with the errors...
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
The whole world is a scab. The point is to pick it constructively.
-- Peter Beard
signature.asc
Description: Digital signature
--
http://mail.python.org/mailman/listinfo/python-list
. But I was
> wondering if anyone had a better option?
the bug is because os.path is assuming posix semantics, which fat
doesn't have.
Not using fat sounds like the best idea to me, but I'm probably
strongly biased against that piece of crap.
--
John Lenton ([EMAIL PROTECTE
quot;, and start reading.
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
Obviously I was either onto something, or on something.
-- Larry Wall on the creation of Perl
signature.asc
Description: Digital signature
--
http://mail.python.org/mailman/listinfo/python-list
pos)
if pos == -1:
break
m.seek(pos)
line = m.readline()
pos = m.tell()
# this is the bit that probably only works with FASTA
# files like I was able to find on the 'net.
sep = line.ind
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--
http://mail.python.org/mailman/listinfo/python-list
lso be emphasized that the default instance hash
and cmp functions quoted make it impossible for two different
instances to compare equal, thus there is no reason to store them
as dictionary keys: it's simpler to make the value an attribute of
the instance and bypass the additional complexi
is also a reference to protocol 0
files being viewable in a text editor.
In other words, enough to lead even the most careful Reader of TFM up
the garden path :-)
Cheers,
John
--
http://mail.python.org/mailman/listinfo/python-list
em, I would probably have set up different
server processes (consumer(s), producer(s), and queue(s)), coordinated
by somthing like pyro's event server. But I don't really know the
problem, so it's probably just bad guesswork on my part---you probably
don't need to scale at all.
cond argument, and with its access
argument in sync with open()'s second arg.
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
If the aborigine drafted an IQ test, all of Western civilization would
presumably flunk it.
-- Stanley Garn
signature.asc
Description: Digital signature
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
>
> lst = [i for i in lst if i != 2]
>
> (if you have 2.4, try replacing [] with () and see what happens)
The result is a generator with a name ("lst") that's rather misleading
in the context. Achieving the same result as the list comprehension, by
doing lst = list(i for
Nick Coghlan wrote:
>
> I think this is about the best you can do for an in-place version:
>for i, x in enumerate(reversed(lst)):
> if x == 2:
>del lst[-i]
Don't think, implement and measure. You may be surprised. Compare these
two for example:
!def method_del_bkwds(lst, x):
!
Michael Hoffman wrote:
> skull wrote:
> > but I still have an other thing to worry about coming with this
way: does
> > performance sucks when the list is big enough?
> > It makes a copy operation!
> >
> > here is a faster and 'ugly' solution:
> >
> > lst = [1, 2, 3]
> > i = 0
> > while i < len(ls
Nick Coghlan wrote:
> I think this is about the best you can do for an in-place version:
>for i, x in enumerate(reversed(lst)):
> if x == 2:
>del lst[-i]
I think del lst[-i-1] might be functionally better.
--
http://mail.python.org/mailman/listinfo/python-list
Michael Hoffman wrote:
> John Machin wrote:
>
> > Three significant figures is plenty. Showing just the minimum of
the
> > results might be better.
>
> It might be, but how much time do you want to spend on getting your
> results for a benchmark that will be run
ent into outer space, taking about
20 times as long. The above timeit runs show a simpler scenario where
the genexp also seems to be going quadratic.
Comments, clues, ... please.
TIA,
John
--
http://mail.python.org/mailman/listinfo/python-list
Bengt Richter wrote:
> No one seems to have suggested this in-place way yet,
> so I'll trot it out once again ;-)
>
> >>> lst = [1, 2, 3]
> >>> i = 0
> >>> for item in lst:
> ...if item !=2:
> ...lst[i] = item
> ...i += 1
> ...
> >>> del lst[i:]
> >>> lst
> [1, 3]
Wo
On Sun, 16 Jan 2005 12:18:23 GMT, "Raymond Hettinger"
<[EMAIL PROTECTED]> wrote:
>"John Machin" <[EMAIL PROTECTED]> wrote in message
>news:[EMAIL PROTECTED]
>> Please consider the timings below, where a generator expression starts
>> out slowe
skull wrote:
> According to Nick's article, I added three 'reversed' methods to your
provided
> test prog. and the result turned out method_reversed is faster than
others except the 'three' case.
> Following is my modified version:
[snip]
> def method_reversed_idx(lst):
> idx = 0
> for i
ould it be elided?
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
Are Linux users lemmings collectively jumping off of the cliff of
reliable, well-engineered commercial software?
-- Matt Welsh
signature.asc
Description: Digital signature
--
http://mail.python.org/mailman/listinfo/python-list
lose to the second, but YMMV.
Converting from these image-specific average values to CMYK is a
non-trivial problem (impossible in the general casew); see for example
http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/2d0c54513c4970f7
where this issue was discussed.
--
Joh
using mutables as hash keys, we advise newbies
> to stick with immutable keys until they have gathered
> enough knowledge and experience to adequatly weight
> the pro and cons of a mutable key solution against
> an immutable key solution.
knowledgeable and experienced users know when to igno
odenly applying
the single exit rule where it doesn't belong frequently
winds up creating nested if-elif-else structures and extranious
flag variables.
If an embedded return isn't clear, the method probably
needs to be refactored with "extract method" a few
times until it
1101 - 1200 of 9369 matches
Mail list logo