xlutils 1.4.0 released!

2009-08-19 Thread Chris Withers
Hi All, I'm pleased to announce a new release of xlutils. This is a small collection of utilities that make use of both xlrd and xlwt to process Microsoft Excel files. The changes for this release are as follows: - Add sheet density information and onesheet option to xlutils.margins. -

[ANN] Pyjamas 0.6 Web Widget Set and python-to-javascript Compiler released

2009-08-19 Thread Luke Kenneth Casson Leighton
Pyjamas 0.6 is finally out: many thanks to everyone who has contributed. Special thanks to Kees Bos; Bernd, Bernd and Jurgen from LovelySystems.com; the people who showed an interest in Pyjamas at EuroPython 2009; and especially to everyone who has helped during the pre-releases, with testing and

Re: difference between 2 arrays

2009-08-19 Thread Michel Claveau - MVP
Re ! Juste pour signaler qu'il existe un newsgroup en français sur Python, qui permet de recevoir des réponses en français (donc plus complètes/détaillées). @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

can't retrieve data from pyxml

2009-08-19 Thread Sakib
well, i need to retrive data from the following line of xml. xs:element name=tblTreacherCollins.Microtia msdata:Caption=Microtia type=xs:string minOccurs=0 / i need the Caption and the type data. is any one out there help me doing that? thanks, Sakib --

Re: Using a Callback Function - ftplib

2009-08-19 Thread seldan24
On Aug 18, 6:02 am, Nitebirdz nitebi...@sacredchaos.com wrote: On Mon, Aug 17, 2009 at 11:10:25AM -0700, seldan24 wrote: I didn't even notice the higher level methods.  I changed the retrieval line to: ftp.nlst(testfile*.txt) This works great.  The result is even captured in an array.  

Re: can't retrieve data from pyxml

2009-08-19 Thread Diez B. Roggisch
Sakib schrieb: well, i need to retrive data from the following line of xml. xs:element name=tblTreacherCollins.Microtia msdata:Caption=Microtia type=xs:string minOccurs=0 / i need the Caption and the type data. is any one out there help me doing that? That's not XML. It lacks

Re: Code formatting question: conditional expression

2009-08-19 Thread Diez B. Roggisch
BTW, from the (admittedly few) responses to my original post, it seems there's some sentiment that conditional expressions are a non-Pythonic misfeature. Interesting ... No. I love them. But not if they are so large that they stretch over several lines (or to many columns). foo = bar if cond

Re: Need cleanup advice for multiline string

2009-08-19 Thread Ben Finney
Simon Forman sajmik...@gmail.com writes: On Tue, Aug 18, 2009 at 8:42 PM, Ben Finneyben+pyt...@benfinney.id.au wrote: We're all unified by our humanity. Bringing any god into the picture is surely counter to any goals of unity. Unity in humanity is, to my way of thinking, the same as Unity

Re: Code formatting question: conditional expression

2009-08-19 Thread Bruno Desthuilliers
Richard Brodie a écrit : John Posner jjpos...@optimum.net wrote in message news:mailman.26.1250604346.2854.python-l...@python.org... if total P.BASE: excessblk = Block(total - P.BASE, srccol, carry_button_suppress=True) else: excessblk = None I wonder if it is appropriate to

NOOB: Developing using python on two different computers

2009-08-19 Thread Smeagol
Hi there, Occasionally I have to develop on two different computers, and I was wondering if there was a way to copy the python environment from one to the other? Access to the data is trivial (networked database) but various packages etc exist on one computer, and I want to ensure I have

Re: How to create functors?

2009-08-19 Thread Bruno Desthuilliers
Terry Reedy a écrit : Robert Dailey wrote: I'm using Python 2.6. And using the legacy syntax in the lambda does not work either. I want to avoid using a def if possible. Thanks. In Python, writing name = lambda arg: expr instead of def name(arg): return expr is all negative and no

Re: difference between 2 arrays

2009-08-19 Thread John Machin
On Aug 19, 6:56 pm, Michel Claveau - MVPenleverlesx_xx...@xmclavxeaux.com wrote: See the module sets See especially the notice at the front of the current sets doc which says deprecated since 2.6 and the comparison down the end which explains why the built-in set() and frozenset() are better

Re: Help with libxml2dom

2009-08-19 Thread Paul Boddie
On 19 Aug, 13:55, Nuno Santos nuno.hespan...@gmail.com wrote: I have just started using libxml2dom to read html files and I have some questions I hope you guys can answer me. [...]   table = body.firstChild   table.nodeName u'text' #?! Why!? Shouldn't it be a table? (1) You answer this

Re: Parallelization in Python 2.6

2009-08-19 Thread Grant Edwards
On 2009-08-19, Stefan Behnel stefan...@behnel.de wrote: Dennis Lee Bieber wrote: If they are number crunchers (CPU-bound) and don't make use of binary extension libraries that release the GIL (for the most common Python implementation), they'll run faster being called in sequence since

Re: difference between 2 arrays

2009-08-19 Thread baalu aanand
On Aug 19, 1:48 pm, Pierre pierre.gaill...@gmail.com wrote: Hello, I would like to know how to find the difference (set operation) between 2 arrays : a = array([1,2, 3,2,5,2]) b = array([1,2]) I want a - b = [3,5] Well, the equivalence of setdiff in matlab... I thought a.difference(b)

Re: difference between 2 arrays

2009-08-19 Thread baalu aanand
On Aug 19, 1:48 pm, Pierre pierre.gaill...@gmail.com wrote: Hello, I would like to know how to find the difference (set operation) between 2 arrays : a = array([1,2, 3,2,5,2]) b = array([1,2]) I want a - b = [3,5] Well, the equivalence of setdiff in matlab... I thought a.difference(b)

Re: difference between 2 arrays

2009-08-19 Thread Matthias Huening
Pierre (19.08.2009 10:48): Hello, I would like to know how to find the difference (set operation) between 2 arrays : a = array([1,2, 3,2,5,2]) b = array([1,2]) I want a - b = [3,5] What about set()? a = set([1,2, 3,2,5,2]) b = set([1,2]) a.difference(b) set([3, 5]) Matthias --

New message

2009-08-19 Thread La Vie Spirituelle
Test -- http://mail.python.org/mailman/listinfo/python-list

Re: difference between 2 arrays

2009-08-19 Thread David Robinow
On Wed, Aug 19, 2009 at 4:48 AM, Pierrepierre.gaill...@gmail.com wrote: Hello, I would like to know how to find the difference (set operation) between 2 arrays : a = array([1,2, 3,2,5,2]) b = array([1,2]) I want a - b = [3,5] Well, the equivalence of setdiff in matlab... I thought

Re: Read C++ enum in python

2009-08-19 Thread Ludo
Neil Hodgson a écrit : For some headers I tried it didn't work until the .* was changed to a non-greedy .*? to avoid removing from the start of the first comment to the end of the last comment. file_data = ' '.join(re.split(r'\/\*.*?\*\/', file_data)) Thank you ! I adopt it ! Cheers. --

Re: difference between 2 arrays

2009-08-19 Thread Diez B. Roggisch
baalu aanand wrote: On Aug 19, 1:48 pm, Pierre pierre.gaill...@gmail.com wrote: Hello, I would like to know how to find the difference (set operation) between 2 arrays : a = array([1,2, 3,2,5,2]) b = array([1,2]) I want a - b = [3,5] Well, the equivalence of setdiff in matlab... I

Re: difference between 2 arrays

2009-08-19 Thread Robert Kern
On 2009-08-19 01:48 AM, Pierre wrote: Hello, I would like to know how to find the difference (set operation) between 2 arrays : a = array([1,2, 3,2,5,2]) b = array([1,2]) I want a - b = [3,5] Well, the equivalence of setdiff in matlab... You will want to ask numpy questions on the numpy

Re: How do I convert an iterator over bytes into a str?

2009-08-19 Thread markscottwright
On Aug 18, 6:52 pm, Jan Kaliszewski z...@chopin.edu.pl wrote: 19-08-2009 o 00:24:20 markscottwright markscottwri...@gmail.com wrote: What's the correct way to turn an iterator over bytes into a string? This works, but, ewww:     In [8]: .join(iter(four score and seven years ago))    

Re: Need cleanup advice for multiline string

2009-08-19 Thread Aahz
In article mailman.18.1250595423.2854.python-l...@python.org, Jean-Michel Pichavant jeanmic...@sequans.com wrote: MRAB wrote: Carl Banks wrote: On Aug 17, 10:03 am, Jean-Michel Pichavant jeanmic...@sequans.com wrote: I'm no English native, but I already heard women/men referring to a group

Re: difference between 2 arrays

2009-08-19 Thread sturlamolden
On 19 Aug, 01:48, Pierre pierre.gaill...@gmail.com wrote: Well, the equivalence of setdiff in matlab... That would be numpy.setdiff1d. -- http://mail.python.org/mailman/listinfo/python-list

Re: recording input from USB port and write to text file

2009-08-19 Thread Simon Forman
On Aug 18, 7:33 pm, Allan af2...@gmail.com wrote: Hi! I'm fairly new to Python.  I understand the basics basics but I'm been trying to write a simple python code that will let me read input data (such as mouse movement) from my USB port and write it in a text file and I am so lost.  Can anyone

Re: Database query execution times in Python?

2009-08-19 Thread Aahz
In article mailman.108.1250247672.2903.python-l...@python.org, pwnedd keith.hugh...@gmail.com wrote: Look up EXPLAIN Thanks for the suggestion. I don't see any option to have EXPLAIN display the query time though? My suggestion was partly a gentle push toward a database forum to get more

Re: Need cleanup advice for multiline string

2009-08-19 Thread Simon Forman
On Aug 19, 12:05 am, Ben Finney ben+pyt...@benfinney.id.au wrote: Simon Forman sajmik...@gmail.com writes: On Tue, Aug 18, 2009 at 8:42 PM, Ben Finneyben+pyt...@benfinney.id.au wrote: We're all unified by our humanity. Bringing any god into the picture is surely counter to any goals of

Re: httplib incredibly slow :-(

2009-08-19 Thread Aahz
In article mailman.133.1250270175.2903.python-l...@python.org, Chris Withers ch...@simplistix.co.uk wrote: Aahz wrote: What do you need to know for a decent example? Simple download of a file from a url with some auth headers added would do me. Well, I've hacked up some sample code from my

Re: generate keyboard/mouse event under windows

2009-08-19 Thread Ray
On Aug 19, 2:07 pm, yaka gu.yakahug...@gmail.com wrote: Read this and see if it helps: http://kvance.livejournal.com/985732.html is there a way to generate a 'true' keyboard event? (works like user pressed a key on keyboard) not send the 'send keyboard event to application' ? --

Python and PHP encryption/decryption

2009-08-19 Thread Jean-Claude Neveu
I'm looking for a recommendation about encryption/decryption packages for Python. I'm working on a project that will require me to store some values in a database in encrypted format. I'll be storing them from a PHP script and retrieving them (decrypting them) using Python. I'm currently

Re: Any way to adjust difflib algorithm?

2009-08-19 Thread Aahz
In article fmqdncomnpg-jrjxnz2dnuvz_tti4...@posted.visi, Grant Edwards inva...@invalid wrote: On 2009-08-14, Grant Edwards inva...@invalid wrote: In my particular usage, no lines have ever been inserted/deleted, so perhaps I should be running diffs on individual lines instead? If I do that,

Re: NOOB: Developing using python on two different computers

2009-08-19 Thread Jonathan Gardner
On Aug 19, 6:50 am, Smeagol mczwhin...@yahoo.com wrote: Hi there, Occasionally I have to develop on two different computers, and I was wondering if there was a way to copy the python environment from one to the other? Access to the data is trivial (networked database) but various packages

Re: Any way to adjust difflib algorithm?

2009-08-19 Thread Grant Edwards
On 2009-08-19, Aahz a...@pythoncraft.com wrote: In article fmqdncomnpg-jrjxnz2dnuvz_tti4...@posted.visi, Grant Edwards inva...@invalid wrote: On 2009-08-14, Grant Edwards inva...@invalid wrote: In my particular usage, no lines have ever been inserted/deleted, so perhaps I should be running

Re: python doc available in emacs info format?

2009-08-19 Thread A.Politz
On Aug 17, 6:43 am, Xah Lee xah...@gmail.com wrote: btw, is there still [no] info format for python doc? i feel kinda sad [...] Part of this is due to [other peoples fault] Someone started a rst2info project (google it), maybe you want to help this guy out. Though, he might be a techgeeker,

Dictionary from a list

2009-08-19 Thread iu2
Hi all, I need to create a dictionary out of a list. Given the list [1, 2, 3, 4, 5, 6] I need the dictionary: {1:2, 3:4, 5:6} I'll appreciate your help Thanks iu2 -- http://mail.python.org/mailman/listinfo/python-list

Re: Code formatting question: conditional expression

2009-08-19 Thread John Posner
Diez wrote: No. I love them. But not if they are so large that they stretch over several lines (or to many columns). foo = bar if cond else baz is more than fine for me. But foo = I_need_to_do_something_really_complicated_here() if cond else baz isn't, because one doesn't grasp as easily

Re: Dictionary from a list

2009-08-19 Thread Diez B. Roggisch
iu2 schrieb: Hi all, I need to create a dictionary out of a list. Given the list [1, 2, 3, 4, 5, 6] I need the dictionary: {1:2, 3:4, 5:6} dict(zip(l[::2], l[1::2])) Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and PHP encryption/decryption

2009-08-19 Thread Diez B. Roggisch
Jean-Claude Neveu schrieb: I'm looking for a recommendation about encryption/decryption packages for Python. I'm working on a project that will require me to store some values in a database in encrypted format. I'll be storing them from a PHP script and retrieving them (decrypting them)

Re: recording input from USB port and write to text file

2009-08-19 Thread Diez B. Roggisch
Simon Forman schrieb: On Aug 18, 7:33 pm, Allan af2...@gmail.com wrote: Hi! I'm fairly new to Python. I understand the basics basics but I'm been trying to write a simple python code that will let me read input data (such as mouse movement) from my USB port and write it in a text file and I am

Re: Dictionary from a list

2009-08-19 Thread iu2
On Aug 19, 11:39 pm, Diez B. Roggisch de...@nospam.web.de wrote: iu2 schrieb: Hi all, I need to create a dictionary out of a list. Given the list [1, 2, 3, 4, 5, 6] I need the dictionary: {1:2, 3:4, 5:6} dict(zip(l[::2], l[1::2])) Diez Wow, this is cool! thanks iu2 --

Re: recording input from USB port and write to text file

2009-08-19 Thread Diez B. Roggisch
Diez B. Roggisch schrieb: Simon Forman schrieb: On Aug 18, 7:33 pm, Allan af2...@gmail.com wrote: Hi! I'm fairly new to Python. I understand the basics basics but I'm been trying to write a simple python code that will let me read input data (such as mouse movement) from my USB port and write

What file is foo in package bar in ?

2009-08-19 Thread northof40
Hi - I think this is a pretty basic question but it's never worried me before. To improve my skills I'm reading the source code of a library written by someone else. I've come across a problem doing that. Commonly a function is called like this: thepackage.theclass.foo The problem is that

Re: How to create functors?

2009-08-19 Thread J. Cliff Dyer
On Wed, 2009-08-19 at 15:56 +0200, Bruno Desthuilliers wrote: Terry Reedy a écrit : Robert Dailey wrote: I'm using Python 2.6. And using the legacy syntax in the lambda does not work either. I want to avoid using a def if possible. Thanks. In Python, writing name = lambda arg:

Re: What file is foo in package bar in ?

2009-08-19 Thread Christian Heimes
northof40 wrote: Given an arbitary package is there some programmatic way to 'ask' what file the method/function is implemented in ? Indeed, the inspect module contains several useful functions for the job, for example http://docs.python.org/library/inspect.html#inspect.getfile Christian

#elements of seq A in seq B

2009-08-19 Thread Neal Becker
What would be a time efficient way to count the number of occurrences of elements of sequence A in sequence B? (in this particular case, these sequences are strings, if that matters). -- http://mail.python.org/mailman/listinfo/python-list

Re: difference between 2 arrays

2009-08-19 Thread Jan Kaliszewski
19-08-2009 o 10:56:20 Michel Claveau - MVPenleverLesX_XXmcX@xmclavxeaux.com wrote: (envoyé via news:\\news.wanadoo.fr\comp.lang.python) Hi! See the module sets No, see the builtin set type. Module sets is deprecated (removed in Py 3.x) -- Jan Kaliszewski (zuo) z...@chopin.edu.pl --

Re: What file is foo in package bar in ?

2009-08-19 Thread northof40
On Aug 20, 11:06 am, Christian Heimes li...@cheimes.de wrote: northof40 wrote: Given an arbitary package is there some programmatic way to 'ask' what file the method/function is implemented in ? Indeed, the inspect module contains several useful functions for the job, for

Re: Barcodes

2009-08-19 Thread Ronn Ross
On Wed, Aug 19, 2009 at 9:19 AM, Ronn Ross ronn.r...@gmail.com wrote: I was hoping that python would have a library to help me print my own bar codes? We will need labels in all sizes and most label printer just work with 1 or 2 sizes. I would like to just print a grid of different sizes on

Re: Dictionary from a list

2009-08-19 Thread Jan Kaliszewski
19-08-2009 o 22:52:54 iu2 isra...@elbit.co.il wrote: On Aug 19, 11:39 pm, Diez B. Roggisch de...@nospam.web.de wrote: iu2 schrieb: Hi all, I need to create a dictionary out of a list. Given the list [1, 2, 3, 4, 5, 6] I need the dictionary: {1:2, 3:4, 5:6} dict(zip(l[::2], l[1::2]))

Re: #elements of seq A in seq B

2009-08-19 Thread Jan Kaliszewski
20-08-2009 o 01:19:24 Neal Becker ndbeck...@gmail.com wrote: What would be a time efficient way to count the number of occurrences of elements of sequence A in sequence B? (in this particular case, these sequences are strings, if that matters). If you mean: to count occurences of each

Re: Dictionary from a list

2009-08-19 Thread Jan Kaliszewski
20-08-2009 o 02:05:57 Jan Kaliszewski z...@chopin.edu.pl wrote: Or probably better: from itertools import islice, izip dict(izip(islice(li, 0, None, 2), islice(li, 1, None, 2))) Or similarly, perhaps more readable: iterator = iter(li) dict((iterator.next(),

Re: Identifying a class type - bad practice?

2009-08-19 Thread greg
James Harris wrote: I don't know yet whether it will be easier to modify the tree or to create a new one for each phase. You can create a new tree using this style as well. Just have each method create and return a new node instead of modifying the existing one. -- Greg --

Re: python doc available in emacs info format?

2009-08-19 Thread Nathan Keel
A.Politz wrote: On Aug 17, 6:43 am, Xah Lee xah...@gmail.com wrote: btw, is there still [no] info format for python doc? i feel kinda sad [...] Part of this is due to [other peoples fault] Someone started a rst2info project (google it), maybe you want to help this guy out. Though, he

Re: How to create functors?

2009-08-19 Thread Paul Rubin
Robert Dailey rcdai...@gmail.com writes: I want to simply wrap a function up into an object so it can be called with no parameters. Nitpick: what you are asking for is called a closure. Functor means something completely different. As a few other people have explained, print in python 2.x is

Re: Python and PHP encryption/decryption

2009-08-19 Thread Paul Rubin
Jean-Claude Neveu jcn-france1...@pobox.com writes: I'm working on a project that will require me to store some values in a database in encrypted format. I'll be storing them from a PHP script and retrieving them (decrypting them) using Python. I'm currently using PHP's mcrypt package to

Re: #elements of seq A in seq B

2009-08-19 Thread Simon Forman
On Aug 19, 8:17 pm, Jan Kaliszewski z...@chopin.edu.pl wrote: 20-08-2009 o 01:19:24 Neal Becker ndbeck...@gmail.com wrote: What would be a time efficient way to count the number of occurrences of elements of sequence A in sequence B?  (in this particular case, these sequences are strings,

Re: How do I convert an iterator over bytes into a str?

2009-08-19 Thread alex23
markscottwright markscottwri...@gmail.com wrote: Thanks Jan (and all other responders).  I suppose I shouldn't be surprised - it's a known wart (http://wiki.python.org/moin/ PythonWarts), but it just looks so darn wrong. Don't forget that it's exceptionally easy to create your own mechanism

Re: #elements of seq A in seq B

2009-08-19 Thread Tomasz Rola
On Wed, 19 Aug 2009, Neal Becker wrote: What would be a time efficient way to count the number of occurrences of elements of sequence A in sequence B? (in this particular case, these sequences are strings, if that matters). If A and B are rather lengthy, then maybe build a tree from

IDLE is not as interactive as Maple

2009-08-19 Thread laser
In the future, will Python provide programe enviroment like Maple does? In Maple, you can remove anything unneeded in the editor. And the code execution order are not necessary in one direction. You can run any command line on the screen by push Enter key. These functions gave a lot of flaxibility

Re: #elements of seq A in seq B

2009-08-19 Thread John Machin
On Aug 20, 12:12 pm, Simon Forman sajmik...@gmail.com wrote: On Aug 19, 8:17 pm, Jan Kaliszewski z...@chopin.edu.pl wrote: If you mean: to count non overlaping occurences of string A in B -- simply:    B.count(A) You don't want to use count() in a case like this because it iterates

Re: Read C++ enum in python

2009-08-19 Thread Mark Tolonen
Mark Tolonen metolone+gm...@gmail.com wrote in message news:h6g9ig$vh...@ger.gmane.org... [snip] This is what 3rd party library pyparsing is great for: begin code-- from pyparsing import * # sample string with enums and other stuff sample = ''' stuff before enum

Re: basic thread question

2009-08-19 Thread Sean DiZazzo
On Aug 18, 4:58 pm, birdsong david.birds...@gmail.com wrote: On Aug 18, 3:18 pm, Derek Martin c...@pizzashack.org wrote: On Tue, Aug 18, 2009 at 03:10:15PM -0500, Derek Martin wrote: I have some simple threaded code...  If I run this with an arg of 1 (start one thread), it pegs one

Re: Read C++ enum in python

2009-08-19 Thread Brian
pygccxml http://www.language-binding.net/pygccxml/pygccxml.html It uses gccxml to compile your source code into xml, and then makes all of your source code available to you via a high level and convenient query interface in python. On Tue, Aug 18, 2009 at 5:03 PM, Ludo

Re: How to create functors?

2009-08-19 Thread Steven D'Aprano
On Wed, 19 Aug 2009 18:42:32 -0700, Paul Rubin wrote: Robert Dailey rcdai...@gmail.com writes: I want to simply wrap a function up into an object so it can be called with no parameters. Nitpick: what you are asking for is called a closure. Functor means something completely different.

starting selenium rc server from python code

2009-08-19 Thread jo
Hi, Is there anyway to start the selenium rc server within python code? Thank you Jo -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I convert an iterator over bytes into a str?

2009-08-19 Thread Steven D'Aprano
On Wed, 19 Aug 2009 20:04:12 -0700, alex23 wrote: markscottwright markscottwri...@gmail.com wrote: Thanks Jan (and all other responders).  I suppose I shouldn't be surprised - it's a known wart (http://wiki.python.org/moin/ PythonWarts), but it just looks so darn wrong. Don't forget that

Re: Converting DD MM YYYY into YYYY-MM-DD?

2009-08-19 Thread Mark Tolonen
Gilles Ganault nos...@nospam.com wrote in message news:rtqk859vm3rkdfor0gd2u2pq5sftl8m...@4ax.com... I find it odd that the regex library can't handle European characters It can. Read the documentation about the re.LOCALE flag. -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: starting selenium rc server from python code

2009-08-19 Thread Steven D'Aprano
On Wed, 19 Aug 2009 21:34:22 -0700, jo wrote: Hi, Is there anyway to start the selenium rc server within python code? How would you start the selenium rc server outside of Python code? -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: #elements of seq A in seq B

2009-08-19 Thread Simon Forman
On Aug 19, 11:34 pm, John Machin sjmac...@lexicon.net wrote: On Aug 20, 12:12 pm, Simon Forman sajmik...@gmail.com wrote: On Aug 19, 8:17 pm, Jan Kaliszewski z...@chopin.edu.pl wrote: If you mean: to count non overlaping occurences of string A in B -- simply:    B.count(A) You

Re: Setuptools - help!

2009-08-19 Thread ryles
On Aug 7, 3:04 pm, Peter Chant rempete...@petezilla.co.uk wrote: Robert Kern wrote: You need to put main.py into the pphoto package. $ mkdir pphoto/ $ mv main.py pphoto/ $ touch pphoto/__init__.py Thanks, it worked.  Any ideas how to run the resulting scripts without installing or

Re: Changing Python Opcodes

2009-08-19 Thread greg
Sreejith K wrote: I know this is not the best way to do it. But I have to do it at least to make it *hard* to decompile the python bytecode. So I compiled Python from source changing some opcode values It probably wouldn't be all that hard for someone to figure this out. A possible avenue of

Re: define class over 2 files

2009-08-19 Thread greg
naveen wrote: Is it possible to split up a class definition over multiple files? Not exactly, but you can do variations of this: ... [subclass a class] Multiple inheritance can also be useful: # A_Part1.py class A_Part1: ... # A_Part2.py class A_Part2: ... # A.py from A_Part1

Re: Read C++ enum in python

2009-08-19 Thread AggieDan04
On Aug 18, 6:03 pm, Ludo olivier.anospamrnospamnnospamanospamenosp...@affaires.net wrote: Hello, I work in a very large project where we have C++ packages and pieces of python code. I've been googleing for days but what I find seems really too complicated for what I want to do. My

Re: Diversity in Python

2009-08-19 Thread Hendrik van Rooyen
On Tuesday 18 August 2009 12:38:36 Ben Finney wrote: Hendrik van Rooyen hend...@microcorp.co.za writes: On Tuesday 18 August 2009 06:45:39 Aahz wrote: Mainly an opportunity to flog the new diversity list. Here my English fails me - flog as in whip, or flog as in sell? Yes :-) Thank

Re: recording input from USB port and write to text file

2009-08-19 Thread Diez B. Roggisch
Allan schrieb: Hi! I'm fairly new to Python. I understand the basics basics but I'm been trying to write a simple python code that will let me read input data (such as mouse movement) from my USB port and write it in a text file and I am so lost. Can anyone help or direct me to some resources?

Re: Parallelization in Python 2.6

2009-08-19 Thread Stefan Behnel
Dennis Lee Bieber wrote: On Tue, 18 Aug 2009 13:45:38 -0700 (PDT), Robert Dailey wrote: Really, all I'm trying to do is the most trivial type of parallelization. Take two functions, execute them in parallel. This type of parallelization is called embarrassingly parallel, and is the simplest

Re: Inheriting dictionary

2009-08-19 Thread Hendrik van Rooyen
On Tuesday 18 August 2009 21:44:55 Pavel Panchekha wrote: I want a dictionary that will transparently inherit from a parent dictionary. So, for example: a = InheritDict({1: one, 2: two, 4: four}) b = InheritDict({3: three, 4: foobar}, inherit_from=a) a[1] # one a[4] # four b[1] # one

Re: Parallelization in Python 2.6

2009-08-19 Thread Hendrik van Rooyen
On Tuesday 18 August 2009 22:45:38 Robert Dailey wrote: Really, all I'm trying to do is the most trivial type of parallelization. Take two functions, execute them in parallel. This type of parallelization is called embarrassingly parallel, and is the simplest form. There are no dependencies

Re: Read C++ enum in python

2009-08-19 Thread Mark Tolonen
MRAB pyt...@mrabarnett.plus.com wrote in message news:4a8b3e2d.7040...@mrabarnett.plus.com... Ludo wrote: Hello, I work in a very large project where we have C++ packages and pieces of python code. I've been googleing for days but what I find seems really too complicated for what I want

socket bug or not?

2009-08-19 Thread Gabriel Rossetti
Hello everyone, I found what was not working in my code (see Twisted mailing list topics self.socket.accept() in doRead() in tcp.py has (11, 'Resource temporarily unavailable') error, Twisted, PushProducer, Words big msgs, any limit? and Python mailing list topic socket.send : (11,

expandtabs acts unexpectedly

2009-08-19 Thread digisat...@gmail.com
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] on linux2 Type help, copyright, credits or license for more information. ' test\ttest'.expandtabs(4) ' test test' 'test \ttest'.expandtabs(4) 'testtest' 1st example: expect returning 4 spaces between 'test', 3 spaces

Re: expandtabs acts unexpectedly

2009-08-19 Thread Xavier Ho
On Wed, Aug 19, 2009 at 5:57 PM, digisat...@gmail.com digisat...@gmail.comwrote: Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] on linux2 Type help, copyright, credits or license for more information. ' test\ttest'.expandtabs(4) ' test test' 'test

Re: Parallelization in Python 2.6

2009-08-19 Thread Paul Rubin
Hendrik van Rooyen hend...@microcorp.co.za writes: Just use thread then and thread.start_new_thread. It just works. The GIL doesn't apply to threads made like that?! -- http://mail.python.org/mailman/listinfo/python-list

Re: Read C++ enum in python

2009-08-19 Thread Neil Hodgson
AggieDan04: file_data = open(filename).read() # Remove comments and preprocessor directives file_data = ' '.join(line.split('//')[0].split('#')[0] for line in file_data.splitlines()) file_data = ' '.join(re.split(r'\/\*.*\*\/', file_data)) For some headers I tried it didn't work until

Re: expandtabs acts unexpectedly

2009-08-19 Thread Peter Brett
digisat...@gmail.com digisat...@gmail.com writes: Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] on linux2 Type help, copyright, credits or license for more information. ' test\ttest'.expandtabs(4) ' test test' 'test \ttest'.expandtabs(4) 'testtest' 1st example:

reading a text file

2009-08-19 Thread superpollo
hi clp what's the difference between: while True: input_line = sys.stdin.readline() if input_line: sys.stdout.write(input_line.upper()) else: break and: while True: try: sys.stdout.write(sys.stdin.next().upper()) except

Re: reading a text file

2009-08-19 Thread Paul Rubin
superpollo u...@example.net writes: while True: try: sys.stdout.write(sys.stdin.next().upper()) except StopIteration: break Maybe there is some subtle difference, but it looks like you really mean for line in sys.stdin: sys.stdout.write(line.upper()) --

difference between 2 arrays

2009-08-19 Thread Pierre
Hello, I would like to know how to find the difference (set operation) between 2 arrays : a = array([1,2, 3,2,5,2]) b = array([1,2]) I want a - b = [3,5] Well, the equivalence of setdiff in matlab... I thought a.difference(b) could work, but no : AttributeError: 'numpy.ndarray' object has no

Re: Identifying a class type - bad practice?

2009-08-19 Thread James Harris
On 18 Aug, 21:50, Chris Rebert c...@rebertia.com wrote: On Tue, Aug 18, 2009 at 10:09 AM, James Harrisjames.harri...@googlemail.com wrote: I am writing some code to form a tree of nodes of different types. The idea is to define one class per node type such as class node_type_1(node):  

Re: difference between 2 arrays

2009-08-19 Thread Diez B. Roggisch
Pierre wrote: Hello, I would like to know how to find the difference (set operation) between 2 arrays : a = array([1,2, 3,2,5,2]) b = array([1,2]) I want a - b = [3,5] Well, the equivalence of setdiff in matlab... I thought a.difference(b) could work, but no : AttributeError:

Re: difference between 2 arrays

2009-08-19 Thread Michel Claveau - MVP
(envoyé via news:\\news.wanadoo.fr\comp.lang.python) Hi! See the module sets @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: reading a text file

2009-08-19 Thread Peter Otten
superpollo wrote: hi clp what's the difference between: while True: input_line = sys.stdin.readline() if input_line: sys.stdout.write(input_line.upper()) else: break and: while True: try:

Re: Scope and classes

2009-08-19 Thread Bruno Desthuilliers
Chris Rebert a écrit : (snip) To access class-level variables from within instance methods of the class, you have 2 options: A. Use the class name, i.e. Abc.message B. Reference the class indirectly, i.e. self.__class__.message Or even simpler - *if* there's no synonym instance attribute: =

How to create ones own lib

2009-08-19 Thread Horst Jäger
Hi, I would like to create my own lib hotte.py which I can import like import string,hotte . How do I do that? I'm working on MacOS 10.5.6 . Thanks in advance -- http://mail.python.org/mailman/listinfo/python-list

Re: How to create ones own lib

2009-08-19 Thread Xavier Ho
On Wed, Aug 19, 2009 at 7:00 PM, Horst Jäger h.jae...@medienkonzepte.dewrote: Hi, I would like to create my own lib hotte.py which I can import like import string,hotte . How do I do that? 1) Have the hotte.py in the same directory of any of your other Python code that imports

Re: How to create ones own lib

2009-08-19 Thread Francesco Bochicchio
On 19 Ago, 11:00, Horst Jäger h.jae...@medienkonzepte.de wrote: Hi, I would like to create my own lib hotte.py which I can import like         import string,hotte . How do I do that? I'm working on MacOS 10.5.6 . Thanks in advance Just create the file 'hotte.py' and place it somewhere

Re: Scope and classes

2009-08-19 Thread Bruno Desthuilliers
David a écrit : (snip) Out of 'Abc.message' and 'self.message', which is the favoured convention? It would be very easy to accidentally override 'self.messages' with an instance attribute! Only use 'Abc.message' if you want to make sure you get the Abc class 'message' attribute - that is, if

Re: Read C++ enum in python

2009-08-19 Thread Bill Davy
Mark Tolonen metolone+gm...@gmail.com wrote in message news:mailman.89.1250666942.2854.python-l...@python.org... MRAB pyt...@mrabarnett.plus.com wrote in message news:4a8b3e2d.7040...@mrabarnett.plus.com... Ludo wrote: Hello, I work in a very large project where we have C++ packages and

Re: Need cleanup advice for multiline string

2009-08-19 Thread Jean-Michel Pichavant
Grant Edwards wrote: On 2009-08-18, Simon Forman sajmik...@gmail.com wrote: Sexism, racism, homophobia, religious intolerance, etc., all stem from a fundamental forgetfulness of our Unity in God (as I would put it) and this is perhaps the single greatest cause of human misery. You

  1   2   >