On May 16, 1:13 pm, Victor Kryukov <[EMAIL PROTECTED]> wrote:
> Hello list,
>
> I've found the following strange behavior of cPickle. Do you think
> it's a bug, or is it by design?
>
> Best regards,
> Victor.
>
> from pickle import dumps
> from cPickle import dumps as cdumps
>
> print dumps('100179
ST 2007; root:xnu-792.18.15~1/RELEASE_I386 i386 i386
If you unpickle though will the results be the same? I suspect they
will be. That should matter most of all (unless you plan to compare
objects' identity based on their pickled version.)
Remember, that by default pickle and cPickle will cr
selected
: employee">'''
>>> s
'\'D132258\\\',\\\'\\\',\n\\
\'status=no,location=no,width=630,height=550,left=200,top=100\\
\')"\ntarget="_blank" class="dvLink" title="Send an Email to selected
\nemp
modified in place, create another
wrapper function that calls your qsort and then will copy all data
from the result into the original list and you are done. Something
like:
def qsort_in_place(L):
sortedL=qsort(L)
for (i,x) in enumerate(sortedL):
L[i]=x
Cheers,
-Nick Vatamaniuc
--
http://mail.python.org/mailman/listinfo/python-list
rsMesh(BaseMesh):
def __init__(self,...):
BaseMesh.__init__(self,...)
etc. initializer...
def refine(self,...):
...user's refine method would go here...
--
So for each different refine() method the user can
riority value between 0.0 (the lowest) and up.
Then look at the run trace and notice that on average the 0.75
priority thread is called more often than the 1.0 priority.
Hope this helped,
-Nick Vatamaniuc
>>> from threading import Thread
>>> from time import sleep
On May 10, 1:28 am, Ron Adam <[EMAIL PROTECTED]> wrote:
> Nick Vatamaniuc wrote:
> > Ron,
>
> > Consider using epydoc if you can. Epydoc will sort the methods and it
> > will also let you use custom CSS style sheets for the final HTML
> > output. Check out the
It seems I can get some of these fairly easy with the inspect module, but
> others I need to test in multiple ways.
>
> Any ideas?
>
> Cheers,
> Ron
Ron,
Consider using epydoc if you can. Epydoc will sort the methods and it
will also let you use custom CSS style sheets for the final HT
--
and return an __iterator__.
The iterator as a the result is excellent because you can iterate over
results much larger than your virtual memory. But in the background
PyDBTable will retrieve rows from the database in large batches and
cache them as to o
ields. The result was that my disk I/
O was saturated (i.e. the application was running as fast as the hard
drive would let it), so it was good enough for me.
Hope this helps,
-Nick Vatamaniuc
--
http://mail.python.org/mailman/listinfo/python-list
try:
[var for var in dir() if not (var.startswith('_') or var=='var')]
Example:
---
>>> a=10
>>> b=20
>>> [var for var in dir() if not (var.startswith('_') or var=='var')]
['a', 'b']
>>>
---
Hope that helps,
Nick Vatamaniuc
--
http://mail.python.org/mailman/listinfo/python-list
way to
> write the above code?
Hrvoje,
To make it more elegant I would do this:
1. Put all the ...do somethings... in functions like
re1_do_something(), re2_do_something(),...
2. Create a list of pairs of (re,func) in other words:
dispatch=[ (re1, re1_do_something), (re2, re2_do_something), .
On May 7, 10:42 pm, Nick Vatamaniuc <[EMAIL PROTECTED]> wrote:
> On May 7, 10:07 pm, johnny <[EMAIL PROTECTED]> wrote:
>
> > Is there a way to call a function on a specified interval(seconds,
> > milliseconds) every time, like polling user defined method?
>
>
gt;> from threading import Timer
>>> timer=Timer(5.0,baz)
>>> timer.start()
>>> Baz!
>>>
Cheers,
-Nick Vatamaniuc
--
http://mail.python.org/mailman/listinfo/python-list
rest of the lines will have to be shifted to
accommodate, the potentially larger new line.
-Nick Vatamaniuc
On May 7, 3:51 pm, rohit <[EMAIL PROTECTED]> wrote:
> hi,
> i am developing a desktop search.For the index of the files i have
> developed an algorithm with which
> i shou
On May 7, 7:03 am, [EMAIL PROTECTED] wrote:
> Hi,
>I have a dictionary which is something like this:
> id_lookup={
> 16:'subfunction',
> 26:'dataId',
> 34:'parameterId',
> 39:'subfunction',
> 44:'dataPackageId',
> 45:'parameterId',
> 54:'subfunction',
> 59:'dataId',
> 165:'subfunction',
> 1
ork but as soon as you use the set
property it fails and even 'get' won't work after that. It surely is
deceiving, I wish it would just give an error or something. See
below.
-Nick Vatamaniuc
>>> class O:
: def __init__(self):
: self._x=15
erver at a time so you still 'play nice' with
each of the servers. If you want to have a max # of server threads
running (in case you have way to many servers to deal with) then run
batches of server threads.
Hope this helps,
Nick Vatamaniuc
--
http://mail.python.org/mailman/listinfo/python-list
On Mar 11, 3:36 pm, Gordon Airporte <[EMAIL PROTECTED]> wrote:
> I'm trying to find a way to take a file that another program has opened
> and writes to periodically, open it simultaneously in Python, and
> automatically update some of my objects in Python when the file is
> written to.
> I can ope
gt;>> #note > means big endian
>>> packed
'\xca\xfe'
>>> #oh, wow it spells cafe! ;-)
>>> #now unpack
>>> unpacked=unpack('>H',packed)
>>> unpacked
(51966,)
>>> odata=unpacked[0]
>>> vars=[]
>>> for
On Mar 7, 3:49 pm, "John" <[EMAIL PROTECTED]> wrote:
> Then is there anyway to sort the numeric keys and avoid future implemetation
> confusion?
>
> "Ant" <[EMAIL PROTECTED]> wrote in message
>
> news:[EMAIL PROTECTED]
>
> > On Mar 7, 8:18 pm, "John" <[EMAIL PROTECTED]> wrote:
> > ...
> >> However,
On Mar 5, 5:16 pm, "Alex Li" <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I would like to use Python 2.5 on Windows with Graphviz to generate
> graphs. I used yapgvb but it only requires Python 2.4 (won't work
> with Python 2.5). Other packages like pydot seems to be unmaintained
> or requires custom
>From the www.parallelpython.com , the 'Features' section:
Features:
*Parallel execution of python code on SMP and clusters
---
PP uses processes, and thus it will take advantage of multiple cores
for a CPU bound task.
-Nick
On Feb 6
On Feb 6, 5:47 am, "Johny" <[EMAIL PROTECTED]> wrote:
> Where and when is good/nescessary to use `repr` instead of `str` ?
> Can you please explain the differences
> Thanks
> LL
When you want to provide a representation of an object from which you
can create another object if you had to.
Use 'str
--
>>> S=('a','b','d')
>>> L=('alpha,'beta','delta')
>>> f={}
>>> for i in range(3):
: f[S[i]]=L[i]
: f[L[i]]=S[i]
>>> f
{'a': 'alpha',
Epydoc is the way to go. You can even choose between various formating
standards (including javadoc ) and customize the output using CSS.
On Jan 22, 7:51 pm, "Stuart D. Gathman" <[EMAIL PROTECTED]> wrote:
> On Mon, 22 Jan 2007 17:35:18 -0500, Stuart D. Gathman wrote:
> > The HTML generated by py
Carl,
Some well known design applications have plugins for UML<->Python
translation. For example EnterpriseArchitect
(http://www.sparxsystems.com.au/resources/mdg_tech/) has a plugin for
Python. ObjectDomain though supports it natively:
http://www.objectdomain.com/products/od/overview.do
The goo
The regular string split does not take a _class_ of characters as the
separator, it only takes one separator. Your example suggests that you
expect that _any_ of the characters "; ()[]" could be a separator.
If you want to use a regular expression as a list of separators, then
you need to use the s
If you are agile it means that the developer is in constant
communication with the user/client often changing and updating the
requirements. The typical work that you specify though is not of that
nature because it a list of specifications and then the coder
implements it, and when done gets back
Vyz wrote:
> I am looking for a PDF to text script. I am working with multibyte
> language PDFs on Windows Xp. I need to batch convert them to text and
> feed into an encoding converter program
>
> Thanks for any help in this regard
Multibyte languages are not easy. I do text extraction from PDF
The two are not of the same type:
-
In : import sets
In : s1=sets.Set([1,2,3])
In : s2=set([1,2,3])
In: type(s1)
Out:
In : type(s2)
Out:
In : s1==s2
Out: False # oops!
In: s2==set(s1)
Out: True # aha!
--
You'll have to ju
A[2,0]=-10
>>> print A
(1, 2)10
(2, 0)-10
>>>
The only way it could be helpful is if you get a lil_matrix returned as
an object from some code and you need to list all the elements...
Hope this helps,
Nick Vatamaniuc
deLenn
ments
flatnonzero() returns the non-zero elements of the flattened version
of the array.
Cheers,
Nick Vatamaniuc
deLenn wrote:
> Hi,
>
> Does scipy have an equivalent to Matlab's 'find' function, to list the
> indices of all nonzero elements in a sparse matrix?
>
> Cheers.
--
http://mail.python.org/mailman/listinfo/python-list
If the other commands work but 3) doesn't, it means there is something
different (wrong?) with the command.
So try running 3) , then one of the other ones and see the difference.
The getCommandOutput() , I suspect, just waits for the data from the
actual command and the command is not returnin
I am not familiar with SQLite driver, but a typical Pythonic way to
check if you can do something is to just try it, and see what happens.
In more practical terms: try to just use the cursor or the connection
and see if an exception will be raised.
Nick V.
John Salerno wrote:
> John Salerno wr
I think you are afraid of references because you are not trusting your
own code. You are afraid it will do "magic" behind the scenes and mess
everything up. One way around that is to simply write better code and
test often.
If everything was copied when passed around it would be pretty awful --
i
You can always start with open source. Find a project that you really
like based on Python, and get involved -- look at the source, create
add-ons, fix bugs. This way you get to learn, and you get to contribute
and help others out as well. After a while you will have under your
belt and perhaps i
Good point. enterprise.adbapi is designed to solve the problem. The
other interface was deprecated.
Thanks,
Nick Vatamaniuc
Jean-Paul Calderone wrote:
> On 29 Oct 2006 13:13:32 -0800, Nick Vatamaniuc <[EMAIL PROTECTED]> wrote:
> >Snor wrote:
> >> I'm attempting to
Try the --skip-networking option for mysqld
Paul Rubin wrote:
> "Nick Vatamaniuc" <[EMAIL PROTECTED]> writes:
> > The simplest solution is to change your system and put the DB on the
> > same machine thus greatly reducing the time it takes for each DB query
>
? Have you read it from beginning to end. What did you think about
functions being introduced later than files and exceptions?
-Nick V.
Fredrik Lundh wrote:
> Nick Vatamaniuc wrote:
>
> > I would consider that an omission. Functions are very important in
> > Python. I think the
t; off with functional programming the last few years (mostly SML) and am
> interested in seeing the extend to which Python is genuinely
> "multi-paradigm" - able to blend the functional and imperative (and OO)
> paradigms together.
>
> -John Coleman
>
> Nick Vatamaniuc
Snor,
The simplest solution is to change your system and put the DB on the
same machine thus greatly reducing the time it takes for each DB query
to complete (avoid the TCP stack completely). This way you might not
have to change your application logic.
If that is not an option, then you are fac
should be right there with the integers, strings, files,
lists and dictionaries. Another important point to stress, in my
opinion, is that functions are first-class objects. In other words
functions can be passes around just like strings and numbers!
-Nick Vatamaniuc
John Coleman wrote:
> Greet
ts in a list then apply reverse() on
it.
Hope this helps,
Nick Vatamaniuc
frankie_85 wrote:
> Ok I'm really lost (I'm new to python) how to use the reverse function.
>
>
> I made a little program which basically the a, b, c, d, e which I have
> listed below and basic
Edward Diener No Spam wrote:
> Nick Vatamaniuc wrote:
> > Edward Diener No Spam wrote:
> >> Michael wrote:
> >
> > Python does not _need_ a component model just as you don't _need_ a RAD
> > IDE tool to write Python code. The reason for having a componen
Edward Diener No Spam wrote:
> Michael wrote:
> > Edward Diener No Spam wrote:
> >
> >> Has there ever been, or is there presently anybody, in the Python
> >> developer community who sees the same need and is working toward that
> >> goal of a common component model in Python, blessed and encourag
See here:
http://wiki.python.org/moin/DistributedProgramming
-Nick V.
Martin Drautzburg wrote:
> Hello all,
>
> I've seen various attempts to add distributed computing capabilities on top
> of an existing language. For a true distributed system I would expect it to
> be possible to instantiate o
user and group IDs, not with user and group names.
Hope that helps,
-Nick Vatamaniuc
[EMAIL PROTECTED] wrote:
> hi
>
> due to certain constraints, i will running a python script as root
> inside this script, also due to some constraints, i need to switch user
> to user1 to run the
mportant to
realize that there will be some collision between the keys if the
number of all possible digests (as limited by the digest algoritm) is
smaller than the number of the possible messages. In practice if you
have large enough integers (64) you shouldn't see any collisions
occu
Tkinter is
behind other modern GUI kits out there.
Hope this helps,
Nick Vatamaniuc
MakaMaka wrote:
> Hi,
> Does anybody know of a good widget for wxpython, gtk, etc. that allows
> the editing of block diagrams and make it easy to export the diagram as
> a digraph? It has to be a
ou can use cPickle for a much faster pickle (but check out the
constraints imposed by cPickle in the Python documentation).
Hope this helps,
-Nick Vatamaniuc
Jay wrote:
> Is there a way through python that I can take a few graphics and/or
> sounds and combine them into a single .dat file?
Matt,
In [26]: inspect.getargspec(f)
Out[26]: (['x1', 'x2'], None, None, None)
For more see the inspect module.
-Nick Vatamaniuc
Matthew Wilson wrote:
> I'm writing a function that accepts a function as an argument, and I
> want to know to all the parameters t
Panda3D is pretty good http://www.panda3d.org/ . It is very well
documented and it comes with many examples.
There is also pygame.
Jay wrote:
> I'd like to experiment a little bit with vector graphics in python.
> When I say 'vector graphics' I don't mean regular old svg-style. I
> mean vecto
If your thread is long running and it is not possible to easily set a
flag for it to check and bail out, then how does it display the
progress in the progress dialog. How often does that get updated? If
the progress dialog is updated often, then at each update have the
thread check a self.please_di
glenn wrote:
> Hi
> can anyone tell me how given a directory or file path, I can
> pythonically tell if that item is on 'removable media', or sometype of
> vfs, the label of the media (or volume) and perhaps any other details
> about the media itself?
> thanks
> Glenn
It won't be trivial because
be fairly easy.
Note: I am not familiar with the syntax of the mail log so I presented
a general idea only. My assumptions about the syntax might have been
wrong.
Hope this helps,
Nick Vatamaniuc
Andi Clemens wrote:
> Hi,
>
> we had some problems in the last weeks with our mailserver.
Of course you can always use grep as an external process (if the OS has
it). For example:
---
In [1]: import subprocess
In [2]: out=subprocess.Popen( 'grep -i blah ./tmp/*',
stdout=subprocess.PIPE, shell=True ).communicate()[0]
In [
f'
code as
-
result=S.split(sep) if maxsplit is None else S.split(sep,maxsplit)
-----
-Nick Vatamaniuc
Steven D'Aprano wrote:
> I'm having problems passing a default value to the maxsplit argument of
> str.split. I'm trying to write a function which act
Jay,
Your problem is specific to a particular internet dictionary provider.
UNLESS
1) The dictionary page has some specific link that gets you a
random word, OR
2) after you click through a couple of word definitions you find in
the URLs of the pages that the words are indexed usin
Perhaps it will be addressed in 3.0...
I hope True and False could become keywords eventually. That would stop
silliness like:
-
In [1]: False=True
In [2]: not False
Out[2]: False
In [3]: False
Out[3]: True
-
Nick V.
John Roth wrote:
> Saizan wrote:
>
The most modest way is to use pure Python and interface via CGI with
the web. I would start there.
As you code you will find yourself saying "I wonder if a framework is
out there that already has automated this specific process (say
templating)?", well then you can search and find such a framework
It depends on the language as it was suggested, and it also depends on
how a token is defined. Can it have dashes, underscores, numbers and
stuff? This will also determine what the whitespace will be. Then the
two main methods of doing the splitting is to either cut based on
whitespace (specify w
rypy, Turbogears and others). If your GUI will be more
complicated in the future, just stick with what you know (Tkinter for
example).
Good luck,
Nick Vatamaniuc
H J van Rooyen wrote:
> "Nick Vatamaniuc" <[EMAIL PROTECTED]> wrote:
>
>
> |HJ,
> |
> |As far as
but not in the case of a user
desktop.
Hope this helps,
Nick Vatamaniuc
H J van Rooyen wrote:
> "Bruno Desthuilliers" <[EMAIL PROTECTED]> wrote:
>
>
> |H J van Rooyen a écrit :
> |> Hi,
> |>
> |> I want to write a small system that is transaction base
atabase, but you probably
know this already...
Hope this helps,
Nick Vatamaniuc
H J van Rooyen wrote:
> Hi,
>
> I want to write a small system that is transaction based.
>
> I want to split the GUI front end data entry away from the file handling and
> record keeping.
>
> Now
For a tutorial try the Python Tutorial @ http://docs.python.org/tut/
For a book try "Learning Python" from O'Reilly Press
For reference try the Python library reference @
http://docs.python.org/lib/lib.html
For another good book try "Dive Into Python" @
http://diveintopython.org/
It is a book
54529656e+68
>>> a**N
150130937545296572356771972164254457814047970568738777235893533016064L
>>> #now call the function again. no compilation this time, the result was
>>> cached!
>>> ans=weave.inline(c_code, ['a','N'], support_code=includes)
>>
#x27;s Python Editor wrote:
> Nick Vatamaniuc schreef:
>
> > I found Komodo to
> > be too slow on my machine, SPE was also slow, was crashing on me and
> > had strange gui issues,
>
> I hope you didn't install SPE from the MOTU repositories with synaptic
> o
ctic_ consistency,
as opposed to 'a surprise'. As in t=(1,2,3,) f(1,2,3,) f(1,*[2,3],)
and f(1,*[2],**{'c':3},) should all be 'OK'.
Perhaps more Python core developers would comment...
Nick Vatamaniuc
Dennis Lee Bieber wrote:
> On 29 Jul 2006 07:26:57 -0700
you shoud be the one
submitting the bug report! Here is PEP 3 page with the guidelines for
bug reporting:
http://www.python.org/dev/peps/pep-0003/
Just mark it as a very low priority since it is more of a cosmetic bug
than a serious showstopper.
-Nick V
Roman Susi wrote:
> Nick Vatamaniuc wr
Aptitude, are you still using that? Just use Synaptic on Ubuntu. The
problem as I wrote in my post before is that for some IDEs you don't
just download an executable but because they are written for Linux
first, on Windows you have to search and install a lot of helper
libraries that often takes q
What do you mean?
The html table is right there (at least in Firefox it is...). I'll
paste it in too. Just need to isolate with some simple regexes and
extract the text...
Nick V.
---
#
Graham,
I won't write the program for you since I have my own program to work
on but here is an idea how to do it.
1) Need to have a function to download the page -- use the urllib
module. Like this:
import urllib
page=urllib.urlopen(URL_GOES_HERE).read()
2) Go to the page with your browser and v
True, that is why it behaves the way it does, but which way is the
correct way? i.e. does the code need updating or the documentation?
-Nick V.
[EMAIL PROTECTED] wrote:
> Nick Vatamaniuc wrote:
> > Roman,
> >
> > According to the Python call syntax definition
> >
Your description is too general. The way to 'collect the results'
depends largely in what format the results are. If they are in an html
table you will have to parse the html data if they are in a simple
plaintext you might use a different method, and if the site renders the
numbers to images and a
axError: invalid syntax
>>> f(*[1,2])
>>> f(*[1,2],)
File "", line 1
f(*[1,2],)
^
SyntaxError: invalid syntax
>>> f(**{'a':1,'b':2})
>>> f(**{'a':1,'b':2},)
File "", line 1
f(**{'a':1,'b':2},)
,
PyGTK, PyQT and so on. In general though, the time spent learning how
to design a gui with a designer could probably be used to just write
the code yourself in Python (now for Java or C++ it is a different
story... -- you can start a war over this ;-)
Hope this helps,
Nick Vatamaniuc
Vi
It seems that both ways are here to stay. If one was so much inferior
and problem-prone, we won't be talking about it now, it would have been
forgotten on the same shelf with a stack of punch cards.
The rule of thumb is 'the right tool for the right job.'
Threading model is very useful for long C
Hello Chaos,
Whatever you do in "#Actions here ..." might be expressed nicely as a
ufunction for numeric. Then you might be able to convert the expression
to a numeric expression. Check out numpy/scipy.
In general, if thisHeight, thisWidth are large use xrange not range.
range() generates a list
tuff because f is callable...
except TypeError:
pass
# ... if f is not callable, then I don't care...
But of course it is much shorter to do:
if callable(f):
#...do stuff because f is callable...
Hope this helps,
Nick Vatamaniuc
John Salerno wrote:
> My code is below. The main
Unfortunately rotor has been deprecated but it hasn't been replaced
with anything reasonable as far as encryption goes -- there are just a
bunch of hashing funtions (sha, md5) only. If you need to replace rotor
all together I would sugest the crypto library from:
http://www.amk.ca/python/code/cryp
Don't optimize prematurely. Write whatever is cleaner, simpler and
makes more sense. Such that if someone (or even yourself) looks at it
10 years from now they'll know exactly what is going on. As far as
what is slower or what functionality you will use and what you won't --
well, if you won't us
Quick-n-dirty way:
After you get your whole p string: FOO
Remove any tags delimited by '<' and '>' with a regex. In your short
example you _don't_ show that there might be something between the
and tags so I assume there won't be anything or if there would be
something then you also want it i
and issue a warning. Also check the memory on your machine in
case some buffer fills the memory up and the machine gets stuck.
To understand what's really happening try to debug the program. Try
Winpdb debugger you can find it here:
http://www.digitalpeers.com/pythondebugger/
Nick Vatamaniuc
than using isinstance to check if it is of a partucular type.
You are doing things 'the pythonic way' ;)
Nick Vatamaniuc
Tim N. van der Leeuw wrote:
> Hi,
>
> I'd like to know if there's a way to check if an object is a sequence,
> or an iterable. Something l
Dave,
Sometimes generating classes from .ini or XML files is not the best
way. You are just translating one language into another and are making
bigger headaches for your self. It is certainly cool and bragable to
say that "my classes get generated on the fly from XML" but Python is
terse and rea
I can't think of any project that does that. Calling stuff from Java is
not easy to beging with you have to go through the native interface
(JNI) anyway.
I would suggest instead to create some kind of a protocol and let the
applications talk using an external channel (a FIFO pipe file, a socket
or
Use __slots__ they will simply give you an error. But at the same time
I don't think they are inheritable and in general you should only use
slots for performance reasons (even then test before using).
Or you could also simulate a __slots__ mechanism the way you are doing
i.e. checking the attribu
Dave,
Python properties allow you to get rid of methods like c.getAttr(),
c.setAttr(v), c.delAttr() and replace them with simple constructs like
c.attr, c.attr=v and del c.attr.
If you have been using Java or C++ you know that as soon as you code
your class you have to start filling in the get()
(...) #override some methods
...
and so on. Of course I am not familiar with your problem in depth all
this might not work for you, just use common sense.
Hope this helps,
Nick Vatamaniuc
[EMAIL PROTECTED] wrote:
> I have a problem. I'm writing a simulation program with a n
ject
print msg.source
I tried it before and it didn't work, it said login failed. Perhaps it
will work for you. Looking at the source is always a GoodThing
(especially if you give your password to a program you just downloaded
as an input...).
Nick Va
gmax2006,
Yes, perhaps the MySQLdb project should mention that packages are
usually available in the popular distributions. I am using Ubuntu and
everything I needed for MySQL and Python was in the repositories ,
'apt-get' one-lines is all that is needed. In general though, I found
that more often
I think file object should be closed whether they will be garbage
collected or not. The same goes for DB and network connections and so
on. Of course in simple short programs they don't have to, but if
someone keeps 1000 open files it might be better to close them when
done. Besides open files (
Assuming a one person per one machine per one chat protocol it might be
possible to recreate the tcp streams (a lot of packet capturing devices
already do that). So the gateway would have to have some kind of a
dispatch that would recognize the initialization of a chat loggon and
start a capture pr
Michael,
You only need to call the __init__ method of the superclass if you need
to do something special during initialization. In general I just use
the SuperClass.__init__(self,...) way of calling the super class
constructors. This way, I only initialize the immediate parents and
they will in tur
John,
Cycles are tricky. Python is an interpreted dynamic language, whatever
object you instantiate in your methods is a different thing than class
hierarchy. Your class hierarchy is fine: ClassA->ClassASubclass->ClassC
and it should work. If it doesn't, create a quick mock example and
post it alo
Brian,
You can try the setdefault method of the dictionary.
For a dictionary D the setdefault work like this:
D.setdefault(k, defvalue). If k not in D then D[k] is set to defvalue
and defvalue is returned.
For example:
In [1]: d={}
In [2]: d.setdefault(1,5)
Out[2]:5
In [3]: d
Out[3]:{1: 5}
In y
Use it anywhere a quick definition of a function is needed that can be
written as an expression. For example when a callback function is
needed you could say:
def callback(x,y):
return x*y
some_function(when_done_call_this=callback)
But with lambda you could just write
some_function(when_done_cal
idea from above won't work too well, you
will have to capture all the traffic then decode each stream, for each
side, for each protocol.
3) Recording or replay is easy. Save to files or dump to a MySQL table
indexed by user id, timestamp, IP etc. Because of buffering issues you
will probably
;t be able to jump to line 15000 without
reading lines 0-14999. You can either iterate over the rows by yourself
or simply use the 'linecache' module like shown above. If I were you I
would use the linecache, but of course you don't mention anything about
the context of your project
1 - 100 of 126 matches
Mail list logo