27;.0')
except OSError:
pass
Which isn't racy. Or if you wanted to be more thorough
import errno
try:
os.rename(paths.xferin_dir+'/COMM.DAT',paths.xferin_dir+'/COMM.DAT'+'.0')
except OSError, e:
if e.errno != err
Ole Streicher wrote:
> Hi Nick,
>
> Nick Craig-Wood writes:
> > mmaps come out of your applications memory space, so out of that 3 GB
> > limit. You don't need that much RAM of course but it does use up
> > address space.
>
> Hmm. So I have
the most common class (several hundred thousand
instances!).
When doing these optimisations I ran a repeatable script and measured
the total memory usage using the OS tools (top in my case).
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
f the
other which would then speed up the two access patterns enormously.
You needn't mmap the two arrays (files) at the same time either.
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
odule_name") you can then click in its output window to go
to the correct line of code.
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
dology above then when you re-organize (or refactor to
use the modern jargon) the code you can be 100% sure that you didn't
break anything which is a wonderful feeling.
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
>>
> >> On Linux: no.
> >
> > I wonder if there is no way to emulate ptys from userspace?
>
> Didn't I just answer that question?
>
> On Linux: no.
Actually you could do it with an LD_PRELOAD library
Intercept open("/dev/ttyS0",...). You
Well i use netbean is alot better i think and it work with 2.6 and 3.0
--- On Thu, 4/16/09, mousemeat wrote:
From: mousemeat
Subject: Re: What IDE support python 3.0.1 ?
To: python-list@python.org
Date: Thursday, April 16, 2009, 4:41 AM
Use eclipse with the pydev module. I use python(x,y) whi
ds"
This builds a set of all the files on the filesystem and prints
Found 314492 files in 1.152987957 seconds
on my laptop, using about 19 MB total memory
You could easily enough put that into an sqlite table instead of a set().
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
t;"
def search(self, r, s):
"""
Do a regular expression search and return if it matched.
"""
self.value = re.search(r, s)
return self.value
def __getitem__(self, n):
"""
Return n'th matched () item.
Note so the first matched item will be matcher[0]
"""
return self.value.group(n+1)
def groups(self):
"""
Return all the matched () items.
"""
return self.value.groups()
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
e here
http://packages.debian.org/sid/python-htmlgen
But I think its original website is gone.
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
When I visit ...
http://www.python.org/doc/lib/lib.html
... I get redirected to ...
http://www.python.org/doc/2.5.2/lib/lib.html
... which seems a bit old.
--
Brandon Craig Rhodes bran...@rhodesmill.org http://rhodesmill.org/brandon
--
http://mail.python.org/mailman/listinfo
There's a Python wrapper to the Skype API here:
http://sourceforge.net/projects/skype4py/
On Linux I've used the PyGTK GUI that uses this. It's called
SkySentials here:
http://www.kolmann.at/philipp/linux/skysentials/
Craig
On Apr 3, 6:50 am, "ISF (Computer Scientists with
this is great, thanks... we have used generators to create something
akin to a cooperative tasking environment... not to implement
multitasking, but to be able to control low level data processing
scripts. These scripts, written as generators, yield control to a
control loop which then can pause,
at C calls doubles.
When you do
>>> float( 0.222)
0.1
Python prints as many decimal places as are significant in the answer.
This is covered in the FAQ
http://www.python.org/doc/faq/general/#why-are-floating-point-calculations-so-inaccurate
If you want more precision use the built in decimal module or the
third party gmpy module.
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
ion in your program will rise.
I've noticed some programmers think in big classes and some think in
small classes. Train yourself to do the other thing and your
programming will improve greatly!
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
ect at 0xb7e897cc>
>>> Node(1,2,3).prev
1
>>> L = []
>>> for i in xrange(100):
... L.append(Node(1,2,3))
...
>>> import os
>>> os.getpid()
28203
>>>
(from top)
28203 ncw 20 0 43364 38m 1900 S0 1.9 0:04.41 python
So the Node class actually takes less memory 38 Mbytes vs 53 Mbytes for
the list.
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
enjoyed the encyclopedic nature of it. So if it appeals to you I'd
say go for it!
The fact that it doesn't use the latest version of python isn't a
problem - python doesn't change very quickly and emphasises backwards
compatibility, even for the jump to 3.x.
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
n to fold their work back into CPython when done too.
Sounds like a project to keep an eye on!
> Now the question is will this make Vista run faster?
Nothing could do that ;-)
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
rface file? Should the user defined header be placed
> > in the /usr/include directory?
> >
> > Any help on this is highly appreciated.
My advice to you is to compile the C stuff into a .so and use ctypes
instead of swig. You then write the interface code in python not C
and you'll have a lot more fun!
cython is very useful in this area too provided you don't mind an
extra dependency. If you are developing C code from scratch to
use with python, then write it in cython instead!
> Should you be putting a function body in a header file?
No
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
ld be easy. Try to compile python in the cross compiling
environment and see what happens!
However if you are running Nucleus with Linux and want to run python
in the Linux bit of it then I'd suggest to use the packages available
for the Linux side of it. (Eg if it is running debian then ap
y> rc(x)
> 2 # the name x, and a temporary reference as parameter
> py> rc([])
> 1 # only the temporary reference
> py> x = y = []
> py> rc(x)
> 3
> py> x = ()
> py> rc(x)
> 954 # the empty tuple is shared
That reminds me, you can use the g
nt only in the source code!
I think the others are just conventions and are not actually used by
anything, but I'd be interested to be proved wrong!
I tend to use
__author__ = "Nick Craig-Wood "
__version__ = "$Revision: 5034 $"
__date__ = "$Date: 2009-02-03 16:50:0
quite a few years of python programing
I'm still learning new things from c.l.py
As a long time usenet user I find it easy to ignore the occasional
flame wars. Posters with the wrong sort of attitude are brought
gently into line by the majority.
If usenet groups had ratings I'd give c.l
ll once
you've jumped the flaming hoops of fire that setting it up is!
Another thing you can try is run your process untill it leaks loads,
then make it dump core. Examine the core dump with a hex editor and
see what it is full of! This technique works suprisingly often.
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
unmatched brackets, empty brackets, etc) and be sure it works
exactly as specified. doctest is cool for this kind of stuff.
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
address is the address of the socket sending the data.
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
.4 is still perhaps the safest bet, even though it is more
> awkward for writing code close to Python 3 syntax.
I tend to target whatever is in Debian stable, which starting from
this month is 2.5 (recently upgraded from 2.4).
2.6 or 3.x is nowhere to be seen in Debian stable, testing or u
Jean-Paul Calderone wrote:
> On Mon, 23 Mar 2009 05:30:04 -0500, Nick Craig-Wood
> wrote:
> >Jean-Paul Calderone wrote:
> > [snip]
> >>
> >> In the case of a TCP to serial forwarder, you don't actually have to
> >> implement either a pro
Jean-Paul Calderone wrote:
> On Sun, 22 Mar 2009 12:30:04 -0500, Nick Craig-Wood
> wrote:
> >I wrote a serial port to TCP proxy (with logging) with twisted. The
> >problem I had was that twisted serial ports didn't seem to have any
> >back pressure. By that I
use up all my RAM
and explode.
What I wanted to happen was for twisted to stop taking the data when
the serial port buffer was full and to only take the data at 9600
baud.
I never did solve that problem :-(
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
python as with shell because it has
almost everything you'll need built in.
Using built in functions is much quicker than fork()-ing an external
command too.
> So much to learn, so little time (but so much fun!)
;-)
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
tly.
You would need to make a dictionary interface to sqlite, eg
http://code.activestate.com/recipes/576638/
Or do something a bit simpler yourself.
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
start = digits[0]
end = digits[-1]
f = open(minmax_path, "w")
f.write("%s %s" % (start, end))
f.close()
print "done"
if __name__ == "__main__": main()
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
dded ARM-Linux system ?
Works very well.
> Does cross compiling Python automatically include the standard
> Python library, or is that yet another adventure ?
If you use the debian compiled version then you get the lot.
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
y to people who haven't coded in Python for one reason
> or another.
Perhaps the OP is looking for something like this
http://pleac.sourceforge.net/pleac_python/index.html
Which is a sort of Rosetta stone for perl and python ;-)
(The perl cookbook translated into python.)
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
> andrew
thanks andrew, good advice, I should probably use that throughout our
code.
btw, hope the world is treating you well, long time no see...
-craig
--
http://mail.python.org/mailman/listinfo/python-list
cto standards
for this sort of thing (especially from the user pov but also from the
developer's)... so any comment are appreciated. I've been using
python for a few years now but this is the first time we are forming
it in the shape of a proper package.
cheers and thanks.
-craig
--
http://mail.python.org/mailman/listinfo/python-list
ute_key)
Which I think is clearer and more obvious. It gives you the
opportunity for a docstring also.
Yes it is a bit more typing, but who wants to play "code golf" all
day?
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
ing cannot end in a single backslash (since
the backslash would escape the following quote character).
The usual way round this is like this
>>> r"a" "\\"
'a\\'
>>>
Which isn't terribly elegant, but it doesn't happen very often.
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
On Mar 10, 1:39 pm, Paul Rubin <http://phr...@nospam.invalid> wrote:
> Craig Allen writes:
> > it raises an interesting question about why doesn't it. I can think
> > of practical answers to that, obviously, but in principle, if a
> > function compiles to
> There you go: a 30-second psychological diagnosis by an
> electrical engineer based entirely on Usenet postings. Â It
> doesn't get much more worthless than that...
>
> --
> Grant
rolf but interesting post nonetheless. I have been really somewhat
fascinated by AS since I heard of it about a dec
ainable.
Honestly, I've become more of a Python fan than I am really
comfortable with... it can't be as good as I think.
-craig
--
http://mail.python.org/mailman/listinfo/python-list
> I think the point is that function objects compare by object identity,
> so the two lambdas you use above are not equal even though they have the
> same code.
it raises an interesting question about why doesn't it. I can think
of practical answers to that, obviously, but in principle, if a
fun
ef long_function():
duration = Duration(5)
i = 0
print "starting"
while duration:
print i
i += 1
sleep(1)
print "finished"
long_function()
Which prints
starting
0
1
2
3
4
finished
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
docs.python.org/library/signal.html
Won't work on windows and there is only one sigalarm timer, so you
can't nest them :-(
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
gt; such a job easily. I need a c parser, is there any C parser written in
> > python?
>
> GCCXML is usually used to create ctypes-structures from headers.
Look at
http://pypi.python.org/pypi/ctypeslib/
And the h2xml and xml2py scripts that are part of it.
You'll need gcc
ng python as much of
the time as possible and C++ only when necessary.
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
On Mar 3, 10:17 am, Cool Dude wrote:
> Hello ,
> This is Aniket from Techclique, a New Jersey based software
> development and IT consulting firm providing top quality technical and
> software professionals on a permanent and contractual basis to
> Government and commercial customer including fort
e
http://docs.python.org/library/linecache.html
Which may be useful...
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
Ben wrote:
> On Feb 24, 11:31?am, Nick Craig-Wood wrote:
> > So do you want to embed python into your code?
> >
> > I'm still not clear what you are trying to achieve with python, though
> > I have a better idea what SLAG is now!
>
> Actually no, I want t
expanded
>
> My SLAG project does not care in reality WHICH or what language, it
> is simply handling menu and screen control.
So do you want to embed python into your code?
I'm still not clear what you are trying to achieve with python, though
I have a better idea what SLAG is now!
-
;, time='1:00 PM'
n='4', name='Adam', a='7', b='8', day='Monday', time='2:00 PM'
n='5', name='Bob', a='9', b='10', day='Monday', time='2:00 PM'
n='6', name='Charlie', a='11', b='12', day='Monday', time='2:00 PM'
n='7', name='Adam', a='13', b='14', day='Tuesday', time='1:00 PM'
n='8', name='Bob', a='15', b='16', day='Tuesday', time='1:00 PM'
n='9', name='Charlie', a='17', b='18', day='Tuesday', time='1:00 PM'
And leaves newfile.csv with the contents
1,2,3,Monday,1:00 PM
7,8,9,Tuesday,1:00 PM
4,5,6,Monday,2:00 PM
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
thon - it all happens behind the
scenes. If you are writing a python extension in C then you do need
to worry about reference counting - a lot!
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
fibonacci_noniterative(i)
t_noniterative = time() - t0
print "%10d, %10.6f, %10.6f" % (i, t_iterative, t_noniterative)
if f_iterative != f_noniterative:
print "Calculation error"
print "iterative", f_iterative
print "non iterative", f_noniterative
print "difference", f_iterative-f_noniterative
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
> The statement
>
> x=x+1
>
> (which, by the way, should stylistically be written
>
> x = x + 1
>
yes I was wondering what "x=x+1" meant until you translated it... oh,
"x = x + 1" of course! I thought to myself.
Oh wait no I'm sarcastic.
--
http://mail.python.org/mailman/listinfo/python-
t;
return self._A
def _setA(self, value):
print "Setting A"
self._A = value
A = property(_getA, _setA)
def main(self):
print self.A
print self.B
# dosomething
self.A = "aValue"
self.B = "aValue"
print self.A
print self.B
>>> a = Stuff()
>>> a.main()
Getting A
None
None
Setting A
Getting A
aValue
aValue
>>>
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
ibrary atof()
does. Ie only converting as much as it can and returning 0.0 for
an error.
"""
match = _float_pattern.search(value)
if match:
return float(match.group(1))
return 0.0
>>> atof("15.5 Sausages")
15.5
>>> atof(" 17.2")
tly the same on all supported platforms and since it
usually runs full screen that is fine. I imagine this GUI toolkit
fits the same niche.
Presumably since it uses SDL then all the GUI will appear in one
window? So windows within windows in the MDI style?
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
I would go to ubuntu linux if you can.
--- On Sun, 2/15/09, Diez B. Roggisch wrote:
From: Diez B. Roggisch
Subject: Re: python in emacs
To: python-list@python.org
Date: Sunday, February 15, 2009, 9:23 AM
kentand...@sbcglobal.net schrieb:
> When I visit a file with extension .py, emacs says "lo
all platforms. I used to use
> ctypes for wrapper but eventually I switched to Cython.
What sort of problems have you had?
I find as long as I use the same types as the C code actually uses it
all works fine. If on a 64 bit platform long is 64 bits then it will
be under ctypes too.
--
Nick
est:$1$3nvOlOaw$vRWaitT8Ne4sMjf9NOrVZ.:13071:0:9:7:::
(not a real password line!)
You need to work out how to write that format.
>From memory: the "$1" bit means it is an md5 hash, the next
"$3nvOlOaw$" is the salt and the final "$vRWaitT8Ne4sMjf9NOrVZ." is
the m
moredata = "A"*4096
test = StringConcatTest()
t = time.time()
for i in range(1000):
test.feed(moredata)
print "%0.3f ms"%(1000*(time.time() - t))
Before it was 3748.012 ms on my PC, afterwards it was 52.737 ms
However that isn't a perfect solution - what if something had anot
Jean-Paul Calderone wrote:
> On Wed, 11 Feb 2009 09:31:56 -0600, Nick Craig-Wood
> wrote:
> >r0g wrote:
> >> I'm writing a linux remastering script in python where I need to chroot
> >> into a folder, run some system commands and then come out and do some
debian, ubuntu and centos packages for it if you
look!
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
kurt.forrester@googlemail.com wrote:
> Any ideas on how to suppress the warning output:
> __main__:1: Warning: No data - zero rows fetched, selected, or
> processed
You can use the warnings module to suppress these I would have
thought.
--
Nick Craig-Wood -- http://www.craig
t. It then uses that new
compiler to compile a gcc for the target architecture.
I could imagine a similar scheme for python, but it would involve lots
of fiddling about and some commitment from the python maintainers.
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
flagg wrote:
> On Feb 3, 7:32?am, Nick Craig-Wood wrote:
> > flagg wrote:
> > > ?This xmlrpc server is designed to parse dns zone files and then
> > > ?perform various actions on said files. \
> > > ?It uses dnspython, and xmlrpclib
> > > ? I
t; raise Exception("Record not found")
>
>
> def changeRecord(self, record, type, target):
> """
> Changes a dns entry.
> @param record: which record to chance
> @param type: what type of record, A
th tangible problems, but we are
not starting a commune. "Uses a langague with sense of community that
advocates for their language over others" is never in a spec.
-craig
--
http://mail.python.org/mailman/listinfo/python-list
eclipse
--- On Sun, 2/1/09, Dennis Lee Bieber wrote:
From: Dennis Lee Bieber
Subject: Re: what IDE is the best to write python?
To: python-list@python.org
Date: Sunday, February 1, 2009, 3:31 AM
On Sat, 31 Jan 2009 23:42:42 -0800 (PST), "mcheun...@hotmail.com"
declaimed the following in comp.
ossible to fix to me. I'd love to
be proved wrong though!
If you were thinking of passing time.time() /
clock_gettime(CLOCK_MONOTONIC) along in the Queue too, then you'll
want to know that it can differ by significant amounts on different
processors :-(
Good luck!
--
Nick Craig-Woo
Thread(target=test_lock_process,
args=(lock,i,queue,)))
for t in threads:
t.start()
for t in threads:
t.join()
if print_result:
try:
while True: print queue.get(block=False)
except Empty:
pass
if __name__ == "__
t):
cls.registry[cls.__name__] = cls
class ThingOne(BaseThing):
pass
class ThingTwo(BaseThing):
pass
class ThingThree(BaseThing):
pass
print BaseThing.registry["ThingOne"]
print BaseThing.registry["ThingTwo"]
print BaseThing.registry["ThingTh
; Where is my fault?
You didn't (or you didn't show) defining the argument types of the
function.
myclib = CDLL("myclib.so") # or whatever
myclib.myfunction.argtypes = [ POINTER(INTERFACE) ]
myclib.myfunction.restype = c_int # or whatever
If you do that then you should be able to pass in myiface directly or
byref(myiface).
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
above and the original proposal
class InfiniteLoopError(Exception):
"""An 'infinite' loop has been detected"""
def infinite_loop(max=200):
for i in xrange(max):
yield i
raise InfiniteLoopError()
Use it like this
for i in infinite_loop():
if i > 10:
break
print "iteration", i
or
for i in infinite_loop(10):
print "iteration", i
> but I agree with Tim that a for ... else loop for the limit is
> clearer.
Probably yes
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
Thomas Heller wrote:
> Nick Craig-Wood schrieb:
> > Thomas Heller wrote:
> >> Nick Craig-Wood schrieb:
> >> > Interesting - I didn't know about h2xml and xml2py before and I've
> >> > done lots of ctypes wrapping! Something to help w
raise ValueError("Couldn't find subclass")
def __init__(self, input):
super(Field, self).__init__(input)
self.data = input
# Raise a ValueError in init if not suitable args for this subtype
class IntegerField(Field):
def __init__(self, s):
s = int(s)
super(IntegerField, self).__init__(s)
self.s = s
class ListField(Field):
def __init__(self, s):
if ',' not in s:
raise ValueError("Not a list")
super(ListField, self).__init__(s)
self.s = s.split(',')
class StringField(Field):
pass
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
are you processing at once? And how many MB of zip
files is it? As reading zip files does lots of disk IO I would guess
it is disk limited rather than anything else, which explains why doing
many at once is actually slower (the disk has to do more seeks).
--
Nick Craig-Wood -- http://www.cr
dahl's Law too where P is approx 0, N
irrelevant...
Being IO bound explains why it takes longer with multiprocessing - it
causes more disk seeks to run an IO bound algorithm in parallel than
running it sequentially.
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
Thomas Heller wrote:
> Nick Craig-Wood schrieb:
> > Interesting - I didn't know about h2xml and xml2py before and I've
> > done lots of ctypes wrapping! Something to help with the initial
> > drudge work of converting the structures would be very helpful.
> &g
thing sensible in ctypes,
c_byte * 0 is what is required plus a bit of casting. This is a
non-standard GNU extension to C though.
All that said though, it looks like a great time saver.
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
== Thread 7000 working ==
== Thread 8000 working ==
== Thread 9000 working ==
== Thread 1 working ==
Total time: 834.81882
--
Nick Craig-Wood -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
this is one of the most subtle trolls I've ever read.
you sir, are a master!
On Dec 22, 7:53 am, s...@pobox.com wrote:
> ... shouldn't people who spend all their time trolling be doing something
> else: studying, working, writing patches which solve the problems they
> perceive to exist in the t
On Dec 14, 6:38 pm, cm_gui wrote:
> hahaha, do you know how much money they are spending on hardware to
> make
> youtube.com fast???
>
> > By the way... I know of a very slow Python site called YouTube.com. In
> > fact, it is so slow that nobody ever uses it.
less than they'd spend to implement i
On Dec 16, 10:25 am, Joe Strout wrote:
> Here's my situation: I'm making an AIM bot, but the AIM server will
> get annoyed if you log in too frequently (and then lock you out for a
> while). So my usual build-a-little, test-a-little methodology doesn't
> work too well.
>
> So I'd like to restruct
David Cournapeau wrote:
> On Thu, Dec 11, 2008 at 10:30 PM, Nick Craig-Wood
> wrote:
> > David Cournapeau wrote:
> >> On Wed, Dec 10, 2008 at 12:04 PM, Chris Rebert wrote:
> >> > On Tue, Dec 9, 2008 at 6:49 PM, wrote:
> >> >> On Ubun
The dll needs to be on the Python path (sys.path). You can either add to
the path with sys.path.append("c:\") or put your dll in a folder in
the Python site-packages directory and add a .pth file (for Python.NET,
but not IronPython
-- it doesn't recognise the .pth files).
; BTW. It is a much better practice to install from source into
> /usr/local, or your $HOME, etc... Anywhere which is not /usr.
easy_install can do that I think...
I find it odd that easy_install doesn't have
a) a list what you installed with easy_install
b) uninstall
in an otherwise excellent program.
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
Roy Smith <[EMAIL PROTECTED]> wrote:
> In article <[EMAIL PROTECTED]>,
> Nick Craig-Wood <[EMAIL PROTECTED]> wrote:
>
> > My favourite mistake when I made the transition was calling methods
> > without parentheses. In perl it is common to call meth
In perl it is common to call methods without
parentheses - in python this does absolutely nothing! pychecker does
warn about it though.
perl -> $object->method
python -> object.method()
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
careful with nonlocal args & kwargs
return result
vs
def closure(*args, **kwargs):
# initialisation to local vars
while 1:
# normal stuff using args and kwargs
yield result
def make_closure(*args, **kwargs):
return closure(*args, **kwargs).next
I still pre
in Python?
With a class is the best way IMHO.
class make_counter(object):
def __init__(self, start_num):
self.x = start_num
def __call__(self):
x = self.x
self.x += 1
return x
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
Slaunger <[EMAIL PROTECTED]> wrote:
> On 3 Dec., 11:30, Nick Craig-Wood <[EMAIL PROTECTED]> wrote:
> > > ? ? ? ? ?cls = self.__class__
> > > ? ? ? ? ?if attr_name in cls.data_attr_names:
> >
> > self.data_attr_names should do instead of cls.data_attr_
Restore file position
> self.f.seek(initial_pos)
> # Unbind lazy attributes
> del self.f
> del self.ver
> del self.file_position
> del self.samples
>
> This seems to work out well. No infinite loops in __getattr__!
:-)
I would probably factor out the contents of the if statement into a
seperate method, but that is a matter of taste!
> At least it passes the unit test cases I have come up with so far.
>
> No guarantees though, as I may simply not have been smart enough to
> bring forth unit test cases which make it crash.
>
> Comments on the code is still appreciated though.
Looks fine!
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
which is faster" question which probably isn't
helpful for new Python programmers to focus on.
PS I enjoyed your book :-)
--
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list
what you have is a totally acceptable factory system. Not sure why
you are using a generator, but that's another matter.
I agree with the previous replies regarding inheritance... this is not
a case for inheritance. You could, however, have Bar be a borg with
the Bar factory built in as a class
> Just remember thought that if you threat Python like a
> hammer, suddenly everything will look like a bail.
>
don't you mean if you use Python like a pitchfork?
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano <[EMAIL PROTECTED]> wrote:
> On Tue, 02 Dec 2008 11:12:31 +0000, Nick Craig-Wood wrote:
>
> > I prefer the "from module import function". That means that if "module"
> > doesn't supply "function" it raises an
Slaunger <[EMAIL PROTECTED]> wrote:
> On 2 Dec., 11:30, Nick Craig-Wood <[EMAIL PROTECTED]> wrote:
>
> >
> > For 4 attributes I'd probably go with the __getattr__.
> >
> OK, I'll do that!
>
> > Or you could easily write
101 - 200 of 861 matches
Mail list logo