dmitrey [EMAIL PROTECTED] wrote:
On Jul 1, 12:00 pm, Duncan Booth [EMAIL PROTECTED] wrote:
You 'need something like this', so write something like that.
Did you intend to ask a question?
I would gladly write the one, but the example doesn't work, and I
don't know any easy way (moreover
7stud [EMAIL PROTECTED] wrote:
Here is a program to print out the files in a directory:
---
import os
myfiles = os.listdir(../)
print myfiles
for afile in myfiles:
print afile
if os.path.isfile(afile):
print afile, ___file
if os.path.isdir(afile):
Douglas Alan [EMAIL PROTECTED] wrote:
Is one of your preconditions that no one will ever handle an
exception raised by your code or by their own code when it is
invoked by yours?
A precondition of much of my Python code is that callers won't
squirrel away large numbers of tracebacks for
[EMAIL PROTECTED] wrote:
Let me add that instead of an an-close-as-possible translation
from the original Perl code, one can rewrite this as:
def bcdlen(length):
... strlen = %04s % length
... return chr(int(strlen[2:4], 16)) + chr(int(strlen[0:2], 16))
which is more Pythonic
massimo s. [EMAIL PROTECTED] wrote:
Now I know that:
- every sane Python class should return type 'instance' after
type(self)
Wrong. Only old style classes are 'instance' type, and you should never be
using an old style class unless you have a very good reason for it. Always
use 'object'
Martin v. Löwis [EMAIL PROTECTED] wrote:
Is urllib wrong?
I can't see how. HTTP 1.1 says that the parameter to the GET
request should be an abs_path; RFC 2396 says that
/../acatalog/shop.html is indeed an abs_path, as .. is a valid
segment. That RFC also has a section on relative
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
def f():
a = 12
def g():
global a
if a 14:
a=13
g()
return a
print f()
This function raises an error. Is there any way to access the a in f()
from inside g().
I could find few past
[EMAIL PROTECTED] wrote:
I have many users using two different versions of python, 2.4 and
2.5. I am running Python scripts on their computers programmatically,
but I can't run it with the full path because they have different
versions installed. I need to run it like 'python {script
asincero [EMAIL PROTECTED] wrote:
handle_case = {}
handle_case[1] = doCase1()
handle_case[2] = doCase2()
handle_case[3] = doCase3()
handle_case[4] = doCase4()
handle_case[5] = doCase5()
handle_case[c]()
If the switch values are simple integers then a list would be a
Josiah Carlson [EMAIL PROTECTED] wrote:
Samuel wrote:
On Sun, 17 Jun 2007 11:00:58 +, Duncan Booth wrote:
The elegant and lazy way would be to change your specification so
that $ characters are escaped by $$ not by backslashes. Then you can
write:
from string import Template
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
def __del__ (self):
try:
os.remove (self.name + '.old')
except:
pass
And setting:
sys.stderr = logger(...)
It seems my cleanup (__del__) is never called,
...
Mmm... If I read the
Samuel [EMAIL PROTECTED] wrote:
Hi,
How would you implement a simple parser for the following string:
---
In this string $variable1 is substituted, while \$variable2 is not.
---
I know how to write a parser, but I am looking for an elegant (and lazy)
way. Any idea?
The elegant and
Gabriel Genellina [EMAIL PROTECTED] wrote:
But you already have multiline lambdas right now in that sense, no
need to add anything. I think you were talking about lambdas *with*
statements inside.
bin = lambda x:((x8 and '*' or '_') +
(x4 and '*' or '_') +
Chris Allen [EMAIL PROTECTED] wrote:
I am confused on one aspect of exception handling. If you specify the
exception object type to match in an except statement it is possible
to also obtain the exception object itself, but I can't figure out how
to get the exception object when I don't
Adam Olsen [EMAIL PROTECTED] wrote:
So there you have it: if you're using a dict with custom classes (or
anything other than str) across multiple threads, and without locking
it, it's possible (though presumably extremely rare) for a lookup to
fail even through the key was there the entire
Steve Holden [EMAIL PROTECTED] wrote:
Actually you can copy and paste from a Windows cmd/command shell:
right-click the title-bar of the window, select Edit from the pop-up
menu, then Mark from the sub-menu to copy whatever you want to select
into the Windows clipboard.
HTH,
Better
Grant Edwards [EMAIL PROTECTED] wrote:
[Please quit saying a container if you mean lists and tuples.
A container is way too general. There most probably _are_
containers for which c() does not fail.]
One example of such a container is any folderish content in Zope:
subscripting gets you the
NeBlackCat (lists) [EMAIL PROTECTED] wrote:
Depending on what you read, sys.exc_info() is supposed to return
(None,None,None) when there is no active exception, but it seems that
it returns info about the last exception when there isn't one
currently active.
For example:
try:
a =
[EMAIL PROTECTED] wrote:
On May 31, 12:31 am, Warren Stringer [EMAIL PROTECTED] wrote:
This is inconsistent:
why does c[:][0]() work but c[:]() does not?
Why does c[0]() has exactly the same results as c[:][0]() ?
Moreover, c[:][0]() implies that a slice was invoked
It's not
Clodoaldo [EMAIL PROTECTED] wrote:
On May 29, 12:57 pm, Richard Brodie [EMAIL PROTECTED] wrote:
Clodoaldo [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I was looking for a function to transform a unicode string into
htmlentities.
u'São Paulo'.encode('ascii',
Diez B. Roggisch [EMAIL PROTECTED] wrote:
setuptools - which you install using the ez_setup.py - will install a
script called easy_install. Under unix, this is installed in /usr/bin,
I'm not sure where it is installed under windows - go use a search.
It puts easy_install.exe (and variations
Wim Vogelaar wim.vogelaar at mc2world dot org wrote:
why this output isn't ordered, giving:
{2: 3, 4: 5, 6: 7, 8: 9, 10: 11 }
I made the original list two elements longer: a =
[1,2,3,4,5,6,7,8,9,10,11,12]
and to my surprise the output is now ordered, giving: {2: 3, 4: 5, 6:
7, 8:
Hendrik van Rooyen [EMAIL PROTECTED] wrote:
Duncan Booth [EMAIL PROTECTED] wrote:
Hendrik van Rooyen [EMAIL PROTECTED] wrote:
Aside from the hashing issue, there is nothing that a tuple can do
that can't be done as well or better by a list.
There are a few other cases where you have
HMS Surprise [EMAIL PROTECTED] wrote:
I am trying to understand the 'if' statement and the exec statement in
the code below.
from PyHttpTestCase import PyHttpTestCase
from com.bitmechanic.maxq import Config
global validatorPkg
if __name__ == 'main':
validatorPkg =
Hendrik van Rooyen [EMAIL PROTECTED] wrote:
Aside from the hashing issue, there is nothing that a tuple can do
that can't be done as well or better by a list.
There are a few other cases where you have to use a tuple, for example in a
try..except statement the exception specification must be
Ian Clark [EMAIL PROTECTED] wrote:
Now I tried this in the shell and got different id's for a and b, but
when I typed it into a file and ran from there the id's where always
the same. Must have something to do with other programs allocating
space faster than I can type everything out (I do
Szabolcs [EMAIL PROTECTED] wrote:
I was wondering about why are there both tuples and lists? Is there
anything I can do with a tuple that I cannot do with a list?
In what circumstances is it advantageous to use tuples instead of lists?
Is there a difference in performance?
I am still
Gabriel Genellina [EMAIL PROTECTED] wrote:
- Someone proposed using escape sequences of some kind, supported by
editor plugins, so there is no need to modify the parser.
I'm not sure whether my suggestion below is the same as or a variation
on this.
- Refactoring tools should let you
Tom Gur [EMAIL PROTECTED] wrote:
I was wondering how do I get control over a window (Win32).
to be more specific, I need to find a handle to a window of a certain
program and minimize the window.
Here's a function which returns a list of all windows where the class is
'PuTTY' or the title
mosscliffe [EMAIL PROTECTED] wrote:
I am looking for a simple split function to create a list of entries
from a string which contains quoted elements. Like in 'google'
search.
eg string = 'bob john johnny cash 234 june'
and I want to have a list of ['bob', 'john, 'johnny cash', '234',
Bruno Desthuilliers [EMAIL PROTECTED]
wrote:
Stefan Behnel a écrit :
Bruno Desthuilliers wrote:
but CS is english-speaking, period.
That's a wrong assumption.
I've never met anyone *serious* about programming and yet unable to
read and write CS-oriented technical English.
I don't
Eric Brunel [EMAIL PROTECTED] wrote:
On Tue, 15 May 2007 09:38:38 +0200, Duncan Booth
[EMAIL PROTECTED] wrote:
Recently there has been quite a bit of publicity about the One Laptop
Per Child project. The XO laptop is just beginning rollout to
children and provides two main programming
Anton Vredegoor [EMAIL PROTECTED] wrote:
Whatever you make of my position I would appreciate if you'd not
directly conclude that I'm just being arrogant or haven't thought
about the matter if I am of a different opinion than you.
Sorry, I do apologise if that came across as a personal attack
Donn Cave [EMAIL PROTECTED] wrote:
[Spanish in Brazil? Not as much as you might think.]
Sorry temporary[*] brain failure, I really do know it is Portugese.
[*] I hope.
--
http://mail.python.org/mailman/listinfo/python-list
HMS Surprise [EMAIL PROTECTED] wrote:
The string s below has single and double qoutes in it. For testing I
surrounded it with triple single quotes. I want to split off the
portion before the first \, but my split that works with shorter
strings does not seem to work with this one.
Ideas?
Hamilton, William [EMAIL PROTECTED] wrote:
No, they'll work just fine. They just won't work with Python 3. It's
not like the Python Liberation Front is going to hack into your
computer in the middle of the night and delete you 2.x installation.
Is that a breakaway group from the PSU?
--
Alexander Schmolck [EMAIL PROTECTED] wrote:
scheme (major implementations such as PLT and the upcoming standard),
the most popular common lisp implementations, haskell[1], fortress[2],
perl 6 and I should imagine (but haven't checked) all new java or .NET
based languages (F#, IronPython,
Stefan Behnel [EMAIL PROTECTED] wrote:
Just to confirm that: IronPython does accept non-ascii identifiers.
From Differences between IronPython and CPython:
IronPython will compile files whose identifiers use non-ASCII
characters if the file has an encoding comment such as # -*-
coding:
Daniel Nogradi [EMAIL PROTECTED] wrote:
Hi list,
How does one prevent elementtree converting to amp; (and similarly
for other entities)?
from xml.etree import ElementTree as et
x = et.Element( 'test' )
x.text = ''
et.tostring( x )
'testamp;/test'
Sometimes I would like to have the
lazy [EMAIL PROTECTED] wrote:
I want to pass a string by reference. I understand that strings are
immutable, but Im not
going to change the string in the function, just to aviod the overhead
of copying(when pass-by-value) because the
strings are long and this function will be called over and
Dave Baum [EMAIL PROTECTED] wrote:
In article [EMAIL PROTECTED],
johnny [EMAIL PROTECTED] wrote:
scope of def main() interms of class A?
myModule:
class A:
main()
def main():
Yes, class A can access main. The name main will be defined at the
top level of the module, and
Grant Edwards [EMAIL PROTECTED] wrote:
http://www.ariel.com.au/jokes/An_Interview_with_Bjarne_Stroustrup.html
Maybe BS thought he was joking, but IMO, it's true.
Stroustrup: Remember the length of the average-sized 'C'
project? About 6 months. Not nearly long enough for a guy
Jean-Paul Calderone [EMAIL PROTECTED] wrote:
- would I need to override another methods e.g. update() or items() in
order to remain thread-safe or is this enough?
No, you'll need to protect almost everything. items may be safe. update,
clear, get, has_key, pop, and setdefault all need a lock in
johnny [EMAIL PROTECTED] wrote:
Can a class inside a module, access a method, outside of class, but
inside of the module?
Eg. Can instance of class a access main, if so how? What is the
scope of def main() interms of class A?
myModule:
class A:
main()
def main():
thnx.
HMS Surprise [EMAIL PROTECTED] wrote:
Trying not to be a whiner but I sure have trouble finding syntax in
the reference material. I want to know about list operations such as
append. Is there a pop type function? I looked in tutorial, language
reference, and lib for list, append, sequence. Is
Jorgen Bodde [EMAIL PROTECTED] wrote:
I will try this approach. The idea was that I could give a list to the
SQL execute command, so that the results coming back would
automatically be assigned to variables.
Don't forget that in Python a function can return multiple results (or
rather can
Paul Miller [EMAIL PROTECTED] wrote:
Bastion and rexec have been deprecated since Python 2.2, so it seems
we (the Python community) have gotten along well enough without them.
Have these modules not been reimplemented because:
a) There are no valid use cases for them.
b) Doing so would be
EuGeNe Van den Bulke [EMAIL PROTECTED] wrote:
Duncan Booth wrote:
However, the decoded text looks as though it is utf16 encoded so it
should be written as binary. i.e. the output mode should be wb.
Thanks for the wb tip that works (see bellow). I guess it is
experience based but how
wang frank [EMAIL PROTECTED] wrote:
Hi,
I am a new user on Python and I really love it.
I have a big text file with each line like:
label 3
teststart 5
endtest 100
newrun 2345
I opened the file by uu=open('test.txt','r') and then read the data as
EuGeNe Van den Bulke [EMAIL PROTECTED] wrote:
import base64
base64.decode(file(hebrew.b64,r),file(hebrew.lang,w))
It runs but the result is not correct: some of the lines in hebrew.lang
are correct but not all of them (hebrew.expected.lang is the correct
file). I guess it is a unicode
Pascal Costanza [EMAIL PROTECTED] wrote:
That still doesn't explain what DLR actually does. You can implement
these languages on top of the JVM as well. You could implement them on
any Turing-complete language, for that matter. The interesting question
how well integrated such an
[EMAIL PROTECTED] (Alex Martelli) wrote:
Is there a reason for using the closure here? Using function
defaults seems to give better performance:
What measurements show you that...?
...
brain:~ alex$ python -mtimeit -s'import powi; p=powi.powerfactory1(3)'
'p(27)'
100 loops, best
sturlamolden [EMAIL PROTECTED] wrote:
I am curious to know how it performs in comparison to CPython and an
efficient compiled Lisp like CMUCL. Speed is a major problem with
CPython but not with .NET or CMUCL, so it will be interesting to see
how the DLR performs in comparison. It would be
[EMAIL PROTECTED] (Alex Martelli) wrote:
Duncan Booth [EMAIL PROTECTED] wrote:
means in pure Python code the string has python methods, but in
Python using the CLR it gains the CLR methods. Presumably in Ruby
code it looks like a Ruby string and so on, but (and this is what's
new
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
I'm trying to use the gpp utility (Gnu points to
http://en.nothingisreal.com/wiki/GPP) to do conditional compilation in
Python, and I'm running into a problem: the same '#' character
introduces Python comments and is used by default to introduce
Jeff Rush [EMAIL PROTECTED] wrote:
Initially, they'd like feedback (not yet the answers themselves) from
us regarding their proposed evaluation criteria - questions to add or
that give no value, rewording to make them more clear. I've posted
their draft criteria, which came as a spreadsheet
7stud [EMAIL PROTECTED] wrote:
Does deepcopy work?
It doesn't copy a function.
The easiest way to make a modified copy of a function is to use the 'new'
module.
def f(x=2): print x=, x
g = new.function(f.func_code, f.func_globals, 'g', (3,),
f.func_closure)
g()
x= 3
f()
x= 2
--
Michel Claveau [EMAIL PROTECTED] wrote:
Hi!
SilverLight (MS flash killer), is a plug-in for InternetExplorer
(Win), FireFox (Win), and Safari (Mac).
The release 1.1-Alpha come with JScript Python (or ironPython?)
IronPython.
Perhaps SilverLight is a new substitute for
Méta-MCI [EMAIL PROTECTED] wrote:
Re!
it can do much more than active scripting.
Hummm Perhaps.
But, with ActiveScripting, I can define functions class in Python,
Ruby(script), Jscript, VBscript, Perl. I can call these
functions/objects directly from Python, and share many objects
Bart Willems [EMAIL PROTECTED] wrote:
gtb wrote:
appear at the end of many examples I see. Is this to cause a .class
file to be generated?
This might be obvious, but no one else mentioned it: the Python
interpreter cannot execute code that it hasn't compiled yet, which is
why the if
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
There is no (that I am aware of) ICMP module in the standard library.
See http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/409689 for
an example of a Python implementation of ping.
Google also finds another implementation at:
spohle [EMAIL PROTECTED] wrote:
as of now i have a __init__.py file in the directory with:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
but i still have to import each class by it's own. im really looking
for something like import wx
and then get all my
proctor [EMAIL PROTECTED] wrote:
so my question remains, why doesn't the star quantifier seem to grab
all the data. isn't findall() intended to return all matches? i
would expect either 'abc' or 'a', 'b', 'c' or at least just
'a' (because that would be the first match). why does it give
Paul McGuire [EMAIL PROTECTED] wrote:
The Enable/Disable decorators on the Python wiki (http://
wiki.python.org/moin/PythonDecoratorLibrary?highlight=%28decorator
%29#head-8298dbf9ac7325d9ef15e7130e676378bbbda572) help you do
something very similar, without having to replicate the function
proctor [EMAIL PROTECTED] wrote:
re.findall('(.)*', 'abc')
['c', '']
thank you this is interesting. in the second example, where does the
'nothingness' match, at the end? why does the regex 'run again' when
it has already matched everything? and if it reports an empty match
along with
Steve Holden [EMAIL PROTECTED] wrote:
Wording to that effect makes it more clear that it is a crutch
that can be usefull now but that it should be discarded later.
Most people reading a tutorial are aware that they are being given the
knowledge they need to put the subject matter to
sophie_newbie [EMAIL PROTECTED] wrote:
I'm wondering if there is a way to get a python script to write text
to an input box in a window of another program that is running? For
example a text box in a web browser window?
Yes there is, but the solution depends on the operating system
and the
Szabolcs [EMAIL PROTECTED] wrote:
In Python this would be something like
result = processData(list(reversed(sorted(data
I know that is only intended as an example, but by trying to use
Mathematica idioms in Python you are perhaps blinding yourself to using
Python's own idioms. A more
Isaac Rodriguez [EMAIL PROTECTED] wrote:
In real life, the skills of the two people in
question are likely to be much closer, and since designing libraries for
use in all kinds of applications is a really hard task, it's likelier
than the library designer will make an error in designing his
Daniel Nogradi [EMAIL PROTECTED] wrote:
Why is the strip( ) method returning something that is not a mystr
instance? I would expect all methods operating on a string instance
and returning another string instance to correctly operate on a mystr
instance and return a mystr instance.
Why would
Isaac Rodriguez [EMAIL PROTECTED] wrote:
The fact that I had
to resort to this trick is a big indication of course that genuinely
private members (as opposed to a 'keep off' naming convention) are a bad
idea in general.
The fact that you had to resort to this trick is a big indication
[EMAIL PROTECTED] wrote:
% python
Python 2.6a0 (trunk:54264M, Mar 10 2007, 15:19:48)
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type help, copyright, credits or license for more
information.
import struct
struct.pack(f, float(Inf))
James Stroud [EMAIL PROTECTED] wrote:
I like this one for some reason. Just the using self would save
hella typing in a lot of classes. I would favor a convention with
leading dots to disambiguate from other variables. This wouldn't
conflict with, say, floats, because variable names can't
BJörn Lindqvist [EMAIL PROTECTED] wrote:
? Not having to bother with petty things like that is an advantage.
Javascript has with-statements that are equivalent to your
using-statements but from what I've seen most programmers avoid them.
They don't increase readability one bit.
That is at
jamadagni [EMAIL PROTECTED] wrote:
If you are going to reference self.quit a lot of times then it makes
sense to also assign it to a local variable and then you already get
even fewer characters (239):
But you realize readability decreases considerably.
Not as much as it would with your
7stud [EMAIL PROTECTED] wrote:
Really, it does work (probably). There are other ways to get at private
members in C++ but this is the easiest.
I can also access private methods of a class if my sister backspaces
over private and types public instead.
In your example, no private methods
Dan Bishop [EMAIL PROTECTED] wrote:
I have a job as a C++ programmer and once tried this trick in order to
get at a private member function I needed. Didn't work: Apparently, VC
++ includes the access level in its name mangling, so you get linker
errors.
I don't have a copy of VC to hand
7stud [EMAIL PROTECTED] wrote:
On Apr 12, 2:47 am, Jorgen Bodde [EMAIL PROTECTED] wrote:
Is it possible to call a private base method? I come from a C++
background, and I liked this construction as my base class has helper
methods so that I do not have to duplicate code.
I'd like to see
7stud [EMAIL PROTECTED] wrote:
On Apr 12, 5:04 am, Duncan Booth [EMAIL PROTECTED] wrote:
7stud [EMAIL PROTECTED] wrote:
On Apr 12, 2:47 am, Jorgen Bodde [EMAIL PROTECTED] wrote:
Is it possible to call a private base method? I come from a C++
background, and I liked this construction as my
Alan Isaac [EMAIL PROTECTED] wrote:
I doubt that *anyone* who programs in Python
has not encountered the situation where they change
a tuple to a list *solely* for the purpose of getting
access to the index method. This suggests a missing
method, does it not? Who has not done this?
Name
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
To really get a picture of what is coming out of the DB I had the
program print out everything about this string using this code:
print code
print repr(code)
print type(code)
for char in code:
print ord(char),char
To
Antoon Pardon [EMAIL PROTECTED] wrote:
When a new feature is requested, the burden of proof is on the requester
to show that it has uses.
I don't agree. Good or bad design is not dependant on what is
implemented and what is not.
There is a cost to every new language feature: it has to be
Antoon Pardon [EMAIL PROTECTED] wrote:
On 2007-04-10, Duncan Booth [EMAIL PROTECTED] wrote:
There is a cost to every new language feature: it has to be
implemented, documented, maintained, and above all learned by the
users. Good design involves, in part, not adding to these burdens
except
=?utf-8?B?5Lq66KiA6JC95pel5piv5aSp5rav77yM5pyb5p6B5aSp5rav5LiN6KeB5a62?=
[EMAIL PROTECTED] wrote:
print r'\\.\'
This line will cause error. I just want to print the
\\.\
why the prefix character r isn't effective. Thanks!
See the FAQ:
Michael Bentley [EMAIL PROTECTED] wrote:
On Apr 9, 2007, at 3:29 AM, 人è¨è½æ¥æ¯å¤©æ¶¯ï¼ææ天涯ä¸
è§å®¶ wrote:
Is there a simple function to generate a list like ['a', 'b', 'c', ...
'z']? The range() just can generate the numeric list.
import string
Gabriel Genellina [EMAIL PROTECTED] wrote:
En Mon, 09 Apr 2007 08:21:44 -0300, Duncan Booth
[EMAIL PROTECTED] escribió:
[EMAIL PROTECTED] wrote:
print r'\\.\'
See the FAQ:
http://www.python.org/doc/faq/general/#why-can-t-raw-strings-r-strings
-end-with-a-backslash
This form
Gabriel Genellina [EMAIL PROTECTED] wrote:
You have to build the handlers list, containing (regex, handler) items;
the unknown case might be a match-all expression at the end.
Well, after playing a bit with decorators I got this:
snip
That's a nice class, and more maintainable with the
[EMAIL PROTECTED] wrote:
Performing a list of mutually exclusive checks that require data
processing can cause excessive tabification. For example, consider
the following python snipet...
temp = my_re1.match(exp)
if temp:
# do something with temp
else:
temp = my_re2.match(exp)
Carsten Haese [EMAIL PROTECTED] wrote:
If that's your only justification for this proposal, that's almost
certainly not enough to convince anybody of its necessity. Your code
example should be rewritten as a loop:
match_actions = [(my_re1, action1),
(my_re2, action2),
bahoo [EMAIL PROTECTED] wrote:
I don't see where the str came from, so perhaps the output of
open('source.txt').readlines() is defaulted to str?
Apart from Grant's explanation that str is the type of a string, what you
perhaps haven't yet grasped is that if you have a type and an instance of
Steven D'Aprano [EMAIL PROTECTED] wrote:
On Mon, 02 Apr 2007 23:44:41 -0700, Jim Aikin wrote:
Working through the tutorial, I created a file called fibo.py in my
text editor, and imported it into Idle. It worked as expected. I then
edited the file and resaved it. I used del fibo, followed
Ernesto García García [EMAIL PROTECTED] wrote:
Hi experts,
How would you do this without the more and more indenting cascade of
ifs?:
match = my_regex.search(line)
if match:
doSomething(line)
else:
match = my_regex2.search(line)
if match:
doSomething2(line)
else:
Rehceb Rotkiv [EMAIL PROTECTED] wrote:
Wait, I made a mistake. The correct result would be
reaction is BUT by the
pattern , BUT it is
rapid , BUT it is
sea , BUT it is
sodium , BUT it is
this manner BUT the dissolved
because by the comes before and the dissolved after it is. Sorry
Peter Otten [EMAIL PROTECTED] wrote:
Duncan Booth wrote:
from operator import itemgetter
data.sort(key=itemgetter(0))
data.sort(key=itemgetter(1))
data.sort(key=itemgetter(4))
data.sort(key=itemgetter(3))
Or, in Python 2.5:
data.sort(key=itemgetter(3, 4, 1, 0))
Thanks, I'd
Steven D'Aprano [EMAIL PROTECTED] wrote:
py id(object()) == id(object())
True
py object() is object()
False
That's weird. How on earth does that happen?
The lifetimes of the two objects createted in the first comparison do
not overlap: once the call to id() returns it immediately drops
DE [EMAIL PROTECTED] wrote:
Here is what I do in C++ and can not right now in python :
pushMatrix()
{
drawStuff();
pushMatrix();
{
drawSomeOtherStuff()
}
popMatrix();
}
popMatrix();
If I understand this contortion is because you have some
John Nagle [EMAIL PROTECTED] wrote:
Strictly speaking, it's Microsoft's fault.
title=!--http://www.microsoft.com/usability/information.mspx-
is supposed to be an HTML comment. But it's improperly terminated.
It should end with --. So all that following stuff is from what
follows
Justin Ezequiel [EMAIL PROTECTED] wrote:
On Mar 29, 4:08 pm, Duncan Booth [EMAIL PROTECTED] wrote:
John Nagle [EMAIL PROTECTED] wrote:
title=!--http://www.microsoft.com/usability/information.mspx-
is supposed to be an HTML comment. But it's improperly terminated.
It is an attribute
Robin Becker [EMAIL PROTECTED] wrote:
I am hugely encouraged by this
C:\Python\devel\pypy-1.0.0\python24\python \python\lib\test
\pystone.py
Pystone(1.1) time for 5 passes = 1.49586
This machine benchmarks at 33425.6 pystones/second
C:\Python\devel\pypy-1.0.0.\pypy-c.exe
Chris Lasher [EMAIL PROTECTED] wrote:
I noticed that I absolutely cannot jump back to the first statement
(line 3, a = 1) using the jump command. I can jump to any other line
BUT the first statement's using the jump line number command. I
experience the same behavior with Winpdb and rpdb2.
901 - 1000 of 1755 matches
Mail list logo