get use of them in python programs like:
from sdd.goodidea import File
...
...
or (actually my current style):
from sdd import goodidea
...
...
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
f a sixteen-bit
> value. You will notice that 3072 == 2 * 256.
For the rest of us playing along at home, there is a typo there:
The preceding line should read:
> value. You will notice that 3072 == 12 * 256.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
rom being rawstring. It gives people
bad intuitions to refer to some strings as "raw" when what you really
mean is that the notation you are using is a "raw" notation for a
perfectly normal string.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
>>> class B(object): pass
>>>> a = B()
>>>> a.spam = 1
>>>>
>
> What is subclassing adding to the class here? Why can't I assign to
> attributes of an instance of object?
object itself doesn't have a __dict__ slot, so that very s
dly-to-translation-in-a-statically-typed-language way.
Besides, if you can freely use "eval" and "exec", how hard is a pure
python language interpreter?
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
for chunk in chunky(somedata, size):
...
for size in range(1, 30):
print size, list(chunky('abcdefghijklmnopqrstuvwxyz', size))
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Hacked(Pending, SomeTrickyClass):
_pending = sample_value_generator()
TempHold, SomeTrickyClass = SomeTrickyClass, Hacked
try:
finally:
SomeTrickyClass = TempHold
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo
t;self-calling-
functions," you should change your wishes.
If, however, you are talking solely about the interactive prompt and
ease of typing, you might want to check out ipython (find via your
favorite search tool). Its flexibility may well be to your taste.
--Scott David Daniels
[EMAIL
ython 2.2 and 2.3 installer, but the sources are there
for you to compile (in which case you might toss a package back to me,
and I'll put it up). If you look it over and have questions, let me
know.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
_new__(class_):
instance = object.__new__(class_)
instance.a = 1
return instance
You might have figured more of this out with:
>>> t = T()
>>> print repr(t)
>>> newt = NewT()
>>> print repr(newt)
>>> T.a
>>> t.a
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
trvalue)
raise # re-raise the exception that got us here.
...
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ou intend to get the newsgroup to
write your code for you. Come back with your efforts and any problems
you have with them.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
a list and loop to do the null checking,
> and it still stops when (I think) it hits a blank value:
> TypeError: cannot concatenate 'str' and 'NoneType' objects
What's the data and program that does that?
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
his code uses a while != "" loop and doesn't look
> pythony (it looks too 'c'). Not that there's anything wrong with that!
>
> Any help is really appreciated.
for line in AP_file:
print >>decoded_File, '%s.%04d' % divmod(int(line[:8],
another so you can use
it again after the function is done (a system call). Next do the
raw open (which should get the available channel), and the C stdout
stuff is successfully redirected. Once done w/ your function,
close your new stdout and copy the channel back.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
def __init__(self):
self.guns = [Gun(), Gun()]
def getShellsLeft(self):
numShells = 0
for aGun in self.guns:
numShells += aGun.shells
return numShells
theBizmark = Battleship()
print theBizmark.getShellsLeft()
> In the abo
ot;sum" primitive
...
def getShellsLeft(self):
return sum([aGun.shells for aGun in self.guns])
...
For Python 2.4 or later: # allows generator expressions
...
def getShellsLeft(self):
return sum(aGun.shells for aGun in self.guns)
...
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
MRAB wrote:
> Scott David Daniels wrote:
>> [EMAIL PROTECTED] wrote:
> In Windows the null device is, strictly speaking, "nul" or "nul:", not
> "nul.txt", but the latter appears to work too.
Although I find the windows design and reasoning to be a mist
["a", "b"],
["a", "b", "c", "d"]]
You can find the longest with:
maxlength, maxlist = max((len(lst), lst) for lst in list_of_lists)
or (for those pre-2.5 people):
maxlength, maxlist = max([(len(lst), lst) for lst in list_of_lists])
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
uot;xaaayz123aaabab",
"xyz123babaaabab", "xyz123aabbaaab", "xaaayz123abab"]
[re.search(pattern, case) is not None for case in cases]
[True, True, True, False, False, False]
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
_not_
Paragraph 3 in "Why Python":
Some people uppose because Python ...
I'd prefer the word "suppose."
and later in that paragraph, I'd change:
... extensions that provide compact numerical solutions
to:
... extensions that provide compact high-speed n
r column in range(1,10):
for row in range(1,10):
grid[column, row] = None
...
valueInCellOfGrid = grid[col, row]
grid[col, row] = 9
...
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
s callable, just as you know "type"s are callable. Seeing
that it is class partial, you can (if you are nosey), see what the
arguments already provided are (so you could get a nicer print).
For example, adding a method to partial:
def __repr__(self):
return 'partial(%r, *%r, **%r)' % (self.fn, self.args, self.kw)
> Something like perhaps? Is there any way for a
> class to customise the type representation?
--
-Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Ilias Lazaridis wrote:
> As a first step, a free personal edition (non-commercial and academic
> use) would help to spread the Komodo IDE within the communities.
Yeah, and ActiveState makes up the loss in income on volume, eh?
I've got no problem paying for good work.
--
-Scott Da
icant difference.
The nice thing is that file size grew over time, so (for a while) I
could run on the machine with other users. By the last block of
tapes I was sitting alone in the machine room at 3:00 AM on Sat mornings
afraid to so much as fire up an editor.
--
-Scott David Daniels
[EMAIL P
ition = lst.index(X, position + 1)
except ValueError:
pass # finally could not find X
I mention this only because people always seem to forget than index
allows you to specify a start (and/or stop) position w/in the list.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail
write your old language in Python.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Terry Hancock wrote:
> On Fri, 27 Jan 2006 13:44:19 -0800
> Scott David Daniels <[EMAIL PROTECTED]> wrote:
>> Paragraph 3 in "Why Python":
>> and later in that paragraph, I'd change:
>> ... extensions that provide compact numerical
>> s
ickle/pypickle and StringIO/pyStringIO
How about something like a package py for all such python-coded modules
so you use py.StringIO (which I hope gets renamed to stringio in the
Py3K shift).
--
-Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
t.
finally:
results.close()
Captured "standard" output:
import sys
former, sys.stdout = sys.stdout, open('myname.txt', 'w')
try:
print 'This goes out.'
print 'Similarly, this is the next line.'
drawables[id(self)] = self
--
-Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Scott David Daniels wrote:
> Alex Martelli wrote: (in effect)
>>aptbase.drawables = weakref.WeakValueDictionary()
>> then in each __init__
>>aptbase.drawables[len(aptbase.drawables)] = self
>> then in show:
>>for o in aptbase.drawables.values():
>&g
f the code -- no simple translation
would be much faster than the CPython implementation.
By the way, be careful about your tone. It sounds like
brick-throwing in this generally friendly newsgroup.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
for table_name in 'first', 'second', 'third', 'fourth':
def perform(query, args):
return cursor.execute(
table_name.join(query.split('')), args)
perform('UPDATE SET col1 = %s, col2 = %s
r than Python will run the same thing,
but in Python you may race five algorithms and keep the fastest.
Using programmer resources effectively is Python's secret sauce.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
doesn't. Any tips?
Give us examples that should work and that should not (test cases),
and the proper results of those tests. Don't make people trying to
help you guess about anything you know.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ich subtree to choose.
Because I am a clueless American, so I don't know if Piñero is a common
name or not. Are you perhaps related to the playwright?
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
pyluke wrote:
> Scott David Daniels wrote:
>> pyluke wrote:
>>> I... want to find lines with ... "\[" but not instances of "\\["
>>
>> If you are parsing with regular expressions, you are running a marathon.
>> If you are doing regular expres
self.pushback(data)
return data
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
> Nicola Musatti wrote:
>> What is important to me is to keep your get_initial_data() function
>> outside Klass if it's task is non trivial, e.g. it has to interact with
>> the OS or a DB.
>
> why ?
In order to simplify testing.
--Scot
d a new simulation control object'''
self.epoch = epoch
self.iter_per_epoch = iter_per_epoch
self.epoch_per_display = epoch_per_display
self.seed = seed
self.keep_epochs = keep_epochs
self.save_input = save_input
...
More some other time.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
suggest you consider using a DB for your application.
I do note that some of the most modern operating systems are trying
to provide "log-structured file systems," which may help with the
durability of file writes. I understand there is an attempt even to
provide transactional interactions
id(8**7)
True
>>> a, b = 7**8, 8**7
>>> id(a) == id(b) # this time there are other references to a and b
False
If you wanted to test the original code for identity match:
>>> B.bar is B().bar
False
is the appropriate test (the 'is' test holds the identities through
the comparison).
By the by, this is tricky stuff, nobody should expect to understand
it thoroughly without both study and testing.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Magnus Lycka wrote:
>... I sometimes come across things that I once new but had forgotten.
I'm sorry, and I mean no offense, _but_ I think _new_ there is a
lovely typo. :-) I stopped, corrected it in my head, proceeded,
and then I backed up, put it back and laughed out loud.
--Sco
__call__(self): return 'Text'
Now the SomeClass object (which is a subclass of object) has an
attribute named "__call__". Should that define how the expression
SomeClass()
is evaluated? Should that return the string 'Text' or create a
new instance of SomeClass?
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
then discard it." -- not good style.
Also, it is good style to then call somefile.close() after
you are done with the file.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
lf):
return self._tree.text
def _deltext(self):
self._tree.text = ''
text = property(_gettext, _settext, _deltext, 'text property')
d = Demo()
d.text = 'my text'
print repr(d.text)
del d.text
print repr(d.text)
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Kirk McDonald wrote:
> Scott David Daniels wrote:
>
> You know what? That makes perfect sense. Thank you.
Thanks a lot for mentioning this. I do try to help out, and sometimes
it feels like talking to the wind. A thanks every now and then is
greatly appreciated.
Just for fun, you
te near the modern edge, and the changes you will
have to learn are not that great. People are still running code written
under 1.5.2, so 2.3 is really quite modern.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
class__ = FunnyType
def __repr__(self):
print 'Lucky_%s' % id(self)
OK, now:
v = SomeClass(please=True)
print v
works, but
v = SomeClass()
doesn't, nor does:
v = SomeClass(please=False)
Think aboutwhat this code should do before running it
don't have an idea "except *what*").
Fairly normal practice is to wait for a failure (or try to instigate
one) _without_ the try: ... except: ..., and then use the one you get.
Or, you could go for IOError, which sounds right to me. remember your
current "except:" is catch
velop" jpeg, but really for those who
"develop programs" -- that is run compilers and linkers. If you need
to compile and link a program that uses one of these libraries, you need
the "developer library." Even if the only sense in which you are a
developer is that you
)
> returns [3, 5])
However:
intersection = set(list1) & set(list2)
[element for element in list1 if element in intersection]
or
[element for element in list2 if element in intersection]
Give you the result you'd like.
--Scott David Daniels
[EMAIL PROTECTED]
--
it in a paint program to
Typically you don't "own" a font, but you have a license to use it.
You need to read the license to figure out what you are allowed to do
with it.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
except ValueError:
result = list(data)
Or you could simply:
try:
data = data[: data.index(oh)]
except ValueError:
pass
and data will be either the sublist you want or the original list.
--
-Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Scott David Daniels wrote:
> [EMAIL PROTECTED] wrote:
>> Problem:
>>
>> You have a list of unknown length, such as this: list =
>> [X,X,X,O,O,O,O]. You want to extract all and only the X's. You know
>> the X's are all up front and you know that the it
Lad wrote:
> Hello,
> How can I check that a string does NOT contain NON English characters?
> Thanks
> L.
>
If all you care about is ASCII vs. non-ASCII, you could use:
ord(max(string)) < 128
--
-Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailm
the whole previous message, we have google groups (or other
archives). This is not your email, but a public board that others
will later search for answers.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ate(coefs):
> if coef == 0:
> del coefs[i]
> else:
> break
for index, coef in enumerate(coefs):
if coef:
if index:
del coefs[: index]
break
--Scott David Daniels
[EMAIL PROT
ze 46) in C takes no more room.
the alignment to the end shows up in a C sizeof.
data = struct.pack('30sdic', 'John Q. Public', 57123.25, 43, 'M')
nomz, taille, age, plop = struct.unpack('30sdic', data)
nom = nomz.rstrip('\0')
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ion and OS.
> any ideas?
As above, but to test my theory:
...
except Exception, e:
print 'caught %r: %r (IndexError is %r)' % (
e, e.__class__, IndexError)
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
27;)
>>>> nom
> 'Dupont\x00\x80\xbf\xff\xf70\x8f\xe0u\xa4\x00\x00.8\xfe\xfe\xfe\xff\x80\x80\x80\x80'
Sorry, I thought you had NUL-filled data.
For NUL terminated data:
nom = nomz[: nomz.index('\0')]
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
fs)
longer = reversed(other.coefs)
if len(self.coefs) > len(other.coefs):
shorter, longer = longer, shorter # insure shorter first
coefs = [c1+c2 for c1,c2 in it.izip(shorter, longer)]
if len(self.coefs) == len(other.coefs):
whil
#x27;s intuition is great WRT performance, and you'd be
shocked at the number of hours people spend speeding up a chunk of code
that cannot possibly substantially affect an applications performance.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
o conform to your personal idea
of "best practices," then hire them and tell them to do it your way.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ou can re-implement your code without being tightly
coupled to your I/O formats. If you still want to use the name
I'd go with:
globals()[classname]()
over eval, but it is your code.
Here's a danger to think about:
Suppose your source of class names has:
'__import__(
time.gmtime(oldtime)),
time.strftime('%Y_%m_%d_%Hh_%Mm_%Ss',
time.gmtime(newtime)))
to see if you get time running backwards as well.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
.org/~esr/faqs/smart-questions.html
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
have seen a new one quite recently.
Perhaps that one was:
Yapgvb,
a Python wrapper around the AT&T's graph layout library Graphviz.
URL: http://yapgvb.sourceforge.net
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Your other questions were correctly answered elsewhere
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
wever, you could wrap an output destination
with an encoder and get the effect you want.
import sys, codecs
sys.stdout, _held = (codecs.getwriter('utf-8')(sys.stdout),
sys.stdout)
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
When you acquire a
language with JIT, you miss the subtleties of the language.
You will be doomed to writing the same kinds of programs in every
language you touch ("writing Fortran in Algol" is what we used to
call it). I've worked on code that was Java-in-Python, and it was
frustrat
))
>> assert len(d) == len(s1)
>> sorted(d)
>> s1[:] = d.values()
Dictionaries are not ordered, the "sorted" line does nothing except produce
a sorted list of the dictionary's keys which is ignored.
> This probably should be:
>
> def psort
the path, and delays may happen at any
packet boundary (including those boundaries created by the network).
You need to do something like "sendall" and your receiver needs to know
when it needs to wait for more data (as a matter of protocol design).
--
-Scott David Daniels
[EMAIL PROTECTED
to:
foo = 'bar'
something = 42
azimov= 3
which makes code differences hard to read.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
.sort(key=os.path.dirname)
Learn to have your skin itch when you see:
... lambda name:(name)
And yes, I concede that it _is_ useful in your .lower expression.
It's not that lambda is bad, rather that it seems to encourages
this 'lambda x:f(x)' stuff.
--Scott David Daniels
[E
first month to cover what we
spent on the license for the two years we used it (then the
company died).
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
the meantime your code will read just fine. If you are in
trouble now, your code reads much more like:
for i in range(10):
...
The general rule is make the code clear, measure if its too slow,
and "don't worry, be happy (yagni)."
--Scott David Daniels
[EMAIL PRO
ges that use
significant whitespace; you might miss a re-blocking change while
suppressing the hassles from the extra "prettifying" spaces.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
r_hash(word):
return "".join(sorted(word))
sorted takes an iterable, and strings are iterables.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Paul Rubin wrote:
> Scott David Daniels <[EMAIL PROTECTED]> writes:
>> And, for 2.4 or later:
>>
>> def letter_hash(word):
>> return "".join(sorted(word))
>>
>> sorted takes an iterable, and strings are iterables.
>
> I do
nough. If not (if you run a real
risk of multiple threads accessing the log simultaneously), have
a queue of log messages that you feed to a single logging thread.
--
-Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
e append method is not an assignment.
>
> The solution here is simply to use 'global a' to tell the compiler that you
> meant to assign the the global variable rather than creating a new local
> variable.
As Duncan knows but forgot to mention, eric.append(spam) doesn't wr
[EMAIL PROTECTED] wrote:
> i have a result tuple from a MySQLdb call that would like to change in
> place..
What you probably want:
source = (1, 2, 'three')
wanted = list(source)
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ipfile.ZIP_DEFLATED, and (later) zipfile.ZIP_BZIP2. This way you can
catch an exception when using an unimplemented compression format as
you retrieve the compression code, rather than waiting to get into the
midst of compression / decompression before getting a failure.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ing to help you do any work you cannot do yourself.
Imagine yourself browsing the newsgroup and trying to decide whether to
spend some time trying to help someone with a problem. Would _you_ want
to spend time trying to guess what the code was with the problem as well
as what the problem was, or woul
lf):
return self.files.pop(thread.get_ident())
def write(self, data):
self.files.get(thread.get_ident(),
self.original).write(data)
except KeyError:
self
sys.stdout = ThreadSpecificFile(sys.stdout)
--Scott D
tton Cereals was pressed.
mButton Rice was pressed. Selection: ('Rice',)
cButton Male was pressed. Selection: ('Male',)
cButton Female was pressed. Selection: ('Male', 'Female')
Button Both was pressed.
Demo constructed
I suspect you are either not running the code you think you are running,
or you are not really telling us what code you are running. You are
trying to simplify for exposition, and in the process hiding the issue.
By the way, none of this code runs the Tkinter mainloop (which would
probably be a good idea). I would suggest running something like this
at the end:
if __name__ == '__main__' :
import Tkinter
# MyClass()
# print 'MyClass constructed'
Demo(None)
print 'Demo constructed'
Tkinter.mainloop()
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
.__getitem__)
Make a list of indices, and says the sort key is "over there" to sorted.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
e systems used a line count (leaving
no end-of-line string), and so on
It is a good idea to provide an indication of whether a file
is binary or text to the file system; the clue could guide
compression information.
-Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ns of values. A sample definition and
use of the anonymous keyword follows:
def anonymous(text):
return 'modified ' + text
print 'Sample', anonymous('words')
--Scott David Daniels (with his tongue jammed firmly in his cheek)
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ass carol(object):
...def __init__(self, **kwargs):
...for name, method in kwargs.items():
...setattr(self, name,
... new.instancemethod(method, self, carol))
This should behave as you prefer.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ight work is to keep a weakref to Evil in Evil_twin.
Upon refresh, you could check if the weakref has gone stale.
Is that good enough?
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
André Roberge wrote:
> Scott David Daniels wrote:
>
>> André Roberge wrote:
>>
>>> ... Each time I refresh the screen, I could
>>> force that call, then check to see if Evil has been
>>> destroyed by Python, which would give me the information
>
Alex Nordhus wrote:
...
> for ln in inputfile.readlines():
> words = string.split(ln)
> if len(words) >= 2:
> # print (words[1])
Try:
print >>outputfile, words[1]
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/ma
) time
to read the problem.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
uiltin types and any
user-defined subtypes.
> Thanks, I don't need the isinstance(), type works here just as well.
But the isinstance version is better than the type(...) in ... version.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
or name in sorted(namelist, key=str.lower):
print >>dest, name
from cStringIO import StringIO
def textnames(namelist):
hold = StringIO()
printnames(namelist, hold)
return hold.getvalue()
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ber in wxPython)
> while waiting for the result (like the rotating circle in firefox)
The one extra thing you might want to do, if your application gets
regular use, is show elapsed time. The user will come to know how
long it should take, while your application probably won't get an
one as the print destination),
rather than printing the result of calling the string function.
I just did the StringIO thing to show you that printing as you go
needn't mean you cannot get the string value without duplicating code.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/ma
1101 - 1200 of 2115 matches
Mail list logo