Re: cPickle.dumps differs from Pickle.dumps; looks like a bug.

2007-05-16 Thread Nick Vatamaniuc
based on their pickled version.) Remember, that by default pickle and cPickle will create a longer ASCII representation, for a binary representation use a higher pickle protocol -- 2 instead of 1. Hope that helps, -Nick Vatamaniuc -- http://mail.python.org/mailman/listinfo/python-list

Re: cPickle.dumps differs from Pickle.dumps; looks like a bug.

2007-05-16 Thread Nick Vatamaniuc
version the size initially is 0 but then is incremented with p++; Any developers that know more about this? -Nick Vatamaniuc -- http://mail.python.org/mailman/listinfo/python-list

Re: Splitting a string

2007-05-15 Thread Nick Vatamaniuc
employee s.split('\\') ['D132258, ',, ', ',\n, 'status=no,location=no,width=630,height=550,left=200,top=100, '\')\ntarget=_blank class=dvLink title=Send an Email to selected \nemployee'] -Nick Vatamaniuc -- http://mail.python.org/mailman/listinfo/python-list

Re: Beginner question: module organisation

2007-05-14 Thread Nick Vatamaniuc
,...): ...user's refine method would go here... -- So for each different refine() method the user can derive a new class from BaseMesh and overload the refine(...) method. Hope that helps, -Nick Vatamaniuc -- http://mail.python.org

Re: Sorting troubles

2007-05-14 Thread Nick Vatamaniuc
) in enumerate(sortedL): L[i]=x Cheers, -Nick Vatamaniuc -- http://mail.python.org/mailman/listinfo/python-list

Re: Setting thread priorities

2007-05-13 Thread Nick Vatamaniuc
. 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 class Worker(Thread): ...: def __init__(self,pri): ...: Thread.__init__

Re: PYDOC replacement. (Was:Sorting attributes by catagory)

2007-05-10 Thread Nick Vatamaniuc
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 documentation of my PyDBTable module. http

Re: Multiple regex match idiom

2007-05-09 Thread Nick Vatamaniuc
(),... 2. Create a list of pairs of (re,func) in other words: dispatch=[ (re1, re1_do_something), (re2, re2_do_something), ... ] 3. Then do: for regex,func in dispatch: if regex.match(line): func(...) Hope this helps, -Nick Vatamaniuc -- http://mail.python.org/mailman/listinfo/python

Re: view workspace, like in MatLab ?

2007-05-09 Thread Nick Vatamaniuc
() 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

Re: Questions about bsddb

2007-05-09 Thread Nick Vatamaniuc
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

Re: Questions about bsddb

2007-05-09 Thread Nick Vatamaniuc
larger than your virtual memory. But in the background PyDBTable will retrieve rows from the database in large batches and cache them as to optimise I/O. Anyway, on my machine PyDBTable saturates the disk I/O (it runs as fast as a pure MySQL query). Take care, -Nick Vatamaniuc -- http

Re: Sorting attributes by catagory

2007-05-09 Thread Nick Vatamaniuc
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 documentation of my PyDBTable module. http://www.psipy.com/PyDBTable -Nick Vatamaniuc -- http://mail.python.org/mailman/listinfo/python-list

Re: Properties on old-style classes actually work?

2007-05-07 Thread Nick Vatamaniuc
. Regards, Paul Paul, Sorry to dissapoint, but properties don't work in old style classes. The 'get' property seems to work 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

Re: assisging multiple values to a element in dictionary

2007-05-07 Thread Nick Vatamaniuc
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',

Re: randomly write to a file

2007-05-07 Thread Nick Vatamaniuc
of the 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 should be able to read

Re: How to make Python poll a PYTHON METHOD

2007-05-07 Thread Nick Vatamaniuc
) timer.start() Baz! Cheers, -Nick Vatamaniuc -- http://mail.python.org/mailman/listinfo/python-list

Re: How to make Python poll a PYTHON METHOD

2007-05-07 Thread Nick Vatamaniuc
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? Thanks. Sure, def baz(): ...: print

Re: urllib timeout issues

2007-03-27 Thread Nick Vatamaniuc
image per server 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

Re: Bitpacked Data

2007-03-11 Thread Nick Vatamaniuc
] - So in binary v1='1100' v2='101011' v3='11' v4='1110' If you concatenate them: 110010101110 you get the original idata... Hope this helped, Nick Vatamaniuc -- http://mail.python.org/mailman/listinfo/python-list

Re: Watching a file another app is writing

2007-03-11 Thread Nick Vatamaniuc
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 open the

Re: Is numeric keys of Python's dictionary automatically sorted?

2007-03-07 Thread Nick Vatamaniuc
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, I am not sure whether it

Re: Graphviz Python Binding for Python 2.5 on Windows?

2007-03-05 Thread Nick Vatamaniuc
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 building

Re: Can Parallel Python run on a muti-CPU server ?

2007-02-07 Thread Nick Vatamaniuc
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

Re: Two mappings inverse to each other: f, g = biject()

2007-02-06 Thread Nick Vatamaniuc
': 'd'} f['b'] 'beta' f['beta'] 'b' -- Hope this helps, And remember : Simple Is Better Than Complex [http://www.python.org/ doc/Humor.html#zen] Nick Vatamaniuc -- http://mail.python.org/mailman/listinfo/python-list

Re: Repr or Str ?

2007-02-06 Thread Nick Vatamaniuc
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' if

Re: Best way to document Python code...

2007-01-24 Thread Nick Vatamaniuc
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 pydoc

Re: Tools Designing large/complicated applications

2007-01-12 Thread Nick Vatamaniuc
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 good

Re: Finding skilled pythonistas for micro-jobs?

2006-11-19 Thread Nick Vatamaniuc
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

Re: Why isn't SPLIT splitting my strings

2006-11-19 Thread Nick Vatamaniuc
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

Re: PDF to text script

2006-11-10 Thread Nick Vatamaniuc
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 but

Re: Finding Nonzero Elements in a Sparse Matrix

2006-11-07 Thread Nick Vatamaniuc
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

Re: Finding Nonzero Elements in a Sparse Matrix

2006-11-07 Thread Nick Vatamaniuc
)-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 wrote: Thanks for the reply. 'nonzero' deos not seem to work with sparse

Re: unpickling Set as set

2006-11-07 Thread Nick Vatamaniuc
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: class 'sets.Set' In : type(s2) Out: type 'set' In : s1==s2 Out: False # oops! In: s2==set(s1) Out: True # aha!

Re: NEWBIE: Script help needed

2006-11-05 Thread Nick Vatamaniuc
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

Re: scared about refrences...

2006-10-30 Thread Nick Vatamaniuc
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 --

Re: checking if a sqlite connection and/or cursor is still open?

2006-10-30 Thread Nick Vatamaniuc
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

Re: Reverse function python? How to use?

2006-10-29 Thread Nick Vatamaniuc
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 basically I want it th result to be printed

Re: Observation on Core Python Programming

2006-10-29 Thread Nick Vatamaniuc
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: Greetings, My copy

Re: Event driven server that wastes CPU when threaded doesn't

2006-10-29 Thread 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

Re: Observation on Core Python Programming

2006-10-29 Thread Nick Vatamaniuc
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 wrote: I would consider that an omission. Functions are very important in Python. I think

Re: Observation on Core Python Programming

2006-10-29 Thread Nick Vatamaniuc
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 user/reader should see the _def_

Re: Event driven server that wastes CPU when threaded doesn't

2006-10-29 Thread Nick Vatamaniuc
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 to complete (avoid the TCP stack completely

Re: Event driven server that wastes CPU when threaded doesn't

2006-10-29 Thread Nick Vatamaniuc
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 create a lobby game server

Open Source?

2006-10-29 Thread Nick Vatamaniuc
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

Re: Everything is a distributed object

2006-10-10 Thread Nick Vatamaniuc
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

Re: Python component model

2006-10-10 Thread Nick Vatamaniuc
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 encouraged by those

Re: Python component model

2006-10-10 Thread Nick Vatamaniuc
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 component model or a RAD IDE tool is to avoid writing a lot

Re: switch user

2006-10-03 Thread Nick Vatamaniuc
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 rest of the script

Re: Generating unique row ID ints.

2006-10-01 Thread Nick Vatamaniuc
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 occur, but it is still good to be aware of them... Hope this helps, -Nick Vatamaniuc

Re: analyzing removable media

2006-09-29 Thread Nick Vatamaniuc
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 one of

Re: wxPython and threading issue

2006-09-29 Thread Nick Vatamaniuc
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

Re: vector and particle effects

2006-09-29 Thread Nick Vatamaniuc
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 vector

Re: How to query a function and get a list of expected parameters?

2006-09-29 Thread Nick Vatamaniuc
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 that this function expects. How

Re: DAT file compilation

2006-09-29 Thread Nick Vatamaniuc
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? If so, how? And how

Re: Block Diagram / digraph Editor

2006-09-29 Thread Nick Vatamaniuc
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 available under Windows. I

Re: Query regarding grep!!

2006-09-26 Thread Nick Vatamaniuc
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

Re: Logfile analysing with pyparsing

2006-09-26 Thread Nick Vatamaniuc
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. Some messages were not delivered and we wanted to know why. But looking through the logfile

Re: Difficulty with maxsplit default value for str.split

2006-09-24 Thread Nick Vatamaniuc
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 acts as a wrapper to split, something like

How about assignment to True and False...

2006-09-23 Thread Nick Vatamaniuc
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:

Re: grabbing random words

2006-09-23 Thread Nick Vatamaniuc
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

Re: best split tokens?

2006-09-09 Thread Nick Vatamaniuc
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

Re: Building Python Based Web Application

2006-09-09 Thread Nick Vatamaniuc
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.

Re: Is there an obvious way to do this in python?

2006-08-03 Thread Nick Vatamaniuc
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 based. | | I want to split the GUI front end data entry away from the file handling

Re: Is there an obvious way to do this in python?

2006-08-03 Thread Nick Vatamaniuc
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 GUI language/library goes: | |Some people suggested HTML, but I think HTML is a very awkward

Re: Is there an obvious way to do this in python?

2006-08-02 Thread Nick Vatamaniuc
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 it seems almost trivially easy using the sockets module

Re: Convert string to mathematical function

2006-08-01 Thread Nick Vatamaniuc
) ans 1.5013093754529656e+68 -- Look up weave for Python (it is a part of scipy) for more examples... Hope this helps, Nick Vatamaniuc jeremito wrote: I am extending python with C++ and need some help. I would like

Re: Programming newbie coming from Ruby: a few Python questions

2006-08-01 Thread Nick Vatamaniuc
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

Re: Comma is not always OK in the argument list?!

2006-07-29 Thread Nick Vatamaniuc
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 wrote

Re: Comma is not always OK in the argument list?!

2006-07-29 Thread Nick Vatamaniuc
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, Nick Vatamaniuc [EMAIL PROTECTED] declaimed the following in comp.lang.python

Re: War chest for writing web apps in Python?

2006-07-29 Thread Nick Vatamaniuc
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 or apt-get. I use SPE myself daily on Ubuntu and wrote this howto install

Re: War chest for writing web apps in Python?

2006-07-28 Thread Nick Vatamaniuc
, 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 Vincent

Re: Comma is not always OK in the argument list?!

2006-07-28 Thread Nick Vatamaniuc
of GvR... ;-) Nick Vatamaniuc Roman Susi wrote: Hi! it is interesting that I found this syntax error: a = {} str('sdfd', **a,) File stdin, line 1 str('sdfd', **a,) ^ SyntaxError: invalid syntax I just wonder is it intentional or by-product (bug or feature

Re: Newbie..Needs Help

2006-07-28 Thread Nick Vatamaniuc
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

Re: Comma is not always OK in the argument list?!

2006-07-28 Thread Nick Vatamaniuc
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 (http://docs.python.org/ref/calls.html

Re: Newbie..Needs Help

2006-07-28 Thread Nick Vatamaniuc
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

Re: Newbie..Needs Help

2006-07-28 Thread Nick Vatamaniuc
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. --- table border=0 width=100% cellpadding=0 cellspacing=0 tr

Re: War chest for writing web apps in Python?

2006-07-28 Thread Nick Vatamaniuc
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

Re: how best to check a value? (if/else or try/except?)

2006-07-27 Thread Nick Vatamaniuc
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 focus would be on the OnStart method. I want to make sure that a positive integer

Re: Fastest Way To Loop Through Every Pixel

2006-07-27 Thread Nick Vatamaniuc
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

Re: Threads vs Processes

2006-07-27 Thread Nick Vatamaniuc
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

Re: dicts vs classes

2006-07-25 Thread Nick Vatamaniuc
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

Re: Missing rotor module

2006-07-25 Thread Nick Vatamaniuc
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:

Re: BeautifulSoup to get string inner 'p' and 'a' tags

2006-07-24 Thread Nick Vatamaniuc
Quick-n-dirty way: After you get your whole p string: p class=contentBodyFOO a name=f/a /p Remove any tags delimited by '' and '' with a regex. In your short example you _don't_ show that there might be something between the a and /a tags so I assume there won't be anything or if there would be

Re: using names before they're defined

2006-07-22 Thread Nick Vatamaniuc
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

Re: How to test if object is sequence, or iterable?

2006-07-22 Thread Nick Vatamaniuc
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 like issequence() or isiterable(). Does something like

Re: httplib, threading, wx app freezing after 4 hours

2006-07-22 Thread Nick Vatamaniuc
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 Mark

Re: using names before they're defined

2006-07-20 Thread Nick Vatamaniuc
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()

Re: Warning when new attributes are added to classes at run time

2006-07-20 Thread Nick Vatamaniuc
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

Re: Using python code from Java?

2006-07-20 Thread Nick Vatamaniuc
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

Re: using names before they're defined

2006-07-19 Thread Nick Vatamaniuc
(...) #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 number

Re: Capturing instant messages

2006-07-18 Thread Nick Vatamaniuc
indexed by user id, timestamp, IP etc. Because of buffering issues you will probably not get a very accurate real-time monitoring system with this setup. Hope this helps, Nick Vatamaniuc Ed Leafe wrote: I've been approached by a local business that has been advised that they need to start

Re: question about what lamda does

2006-07-18 Thread Nick Vatamaniuc
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

Re: Dictionary question

2006-07-18 Thread Nick Vatamaniuc
] then if will compare l[-1][a+c] to x+e. Also for clarity you might actually want to assign some variables to a+c and x+e since you repeat them so often. That actually might speed up your code a little too, but don't do it just for a minor speedup do it for clarity and simplicity most of all! Good luck, Nick

Re: Cyclic class definations

2006-07-18 Thread Nick Vatamaniuc
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

Re: Dispatch with multiple inheritance

2006-07-18 Thread Nick Vatamaniuc
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

Re: Capturing instant messages

2006-07-18 Thread Nick Vatamaniuc
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

Re: No need to close file?

2006-07-18 Thread Nick Vatamaniuc
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

Re: Should this be added to MySQLdb FAQ?

2006-07-18 Thread Nick Vatamaniuc
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

Re: Authentication

2006-07-18 Thread Nick Vatamaniuc
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 Vatamaniuc bigodines wrote: Hello guys, I'm trying to learn python by making some

Re: reading specific lines of a file

2006-07-15 Thread Nick Vatamaniuc
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 so it is hard to say. Hope this helps, Nick Vatamaniuc Yi Xing wrote: Hi All, I want to read specific lines

  1   2   >