ANN: SUMMON 1.8.8 Released: 2D Visualization prototyping and scripting

2009-07-08 Thread rasmus
SUMMON 1.8.8 SUMMON is a python extension module that provides rapid prototyping of 2D visualizations. By heavily relying on the python scripting language, SUMMON allows the user to rapidly prototype a custom visualization for their data, without the overhead of a designing a graphical user

ANN: KeepNote 0.5.3 - Note taking and organization

2009-07-08 Thread rasmus
KeepNote is a simple cross-platform note taking program implemented in Python. I have been using it for my research and class notes, but it should be applicable to many note taking situations. KeepNote is ideal for storing your class notes, TODO lists, research notes, journal entries, paper

Re: tough-to-explain Python

2009-07-08 Thread Steven D'Aprano
On Tue, 07 Jul 2009 20:04:46 +, kj wrote: I'm having a hard time coming up with a reasonable way to explain certain things to programming novices. [...] Or consider this one: ham = [1, 2, 3, 4] spam = (ham,) spam ([1, 2, 3, 4],) spam[0] is ham True spam[0] += [5] Traceback

count

2009-07-08 Thread Dhananjay
Dear all, I have file as follows,however, tab seperated (not shown in following file): 6 3 4.309726 7 65 93.377388 8 47 50.111952 9 270 253.045923 10 184182.684670 11 76 121.853455 12 85 136.283470

Re: SSH utility

2009-07-08 Thread romeoamp
Please look at on : http://www.lag.net/paramiko/ http://www.lag.net/paramiko/ Sample Code: Find Attachment Thanks, S.V.RAJKUMAR, XOU Solutions India Private Limited No. 37, PM Towers, Greams Road, Thousand Lights, Chennai - 6 . Mobile No : +91 - 9940632275. half.italian wrote: On

Re: finding most common elements between thousands of multiple arrays.

2009-07-08 Thread Raymond Hettinger
[Scott David Daniels] def most_frequent(arr, N):      '''Return the top N (freq, val) elements in arr'''      counted = frequency(arr) # get an iterator for freq-val pairs      heap = []      # First, just fill up the array with the first N distinct      for i in range(N):          try:    

Re: How to use Python to interface with Web pages?

2009-07-08 Thread alex23
On Jul 8, 1:18 pm, Peter peter.milli...@gmail.com wrote: I can see the web-page source - it looks to be javascript (to my untutored eye :-)). But how do I enter data and simulated mouse presses on a web-page that I have accessed via a Python program? [...] I have (in the past) written some

Re: tough-to-explain Python

2009-07-08 Thread Francesco Bochicchio
On Jul 7, 10:04 pm, kj no.em...@please.post wrote: I'm having a hard time coming up with a reasonable way to explain certain things to programming novices. Consider the following interaction sequence: def eggs(some_int, some_list, some_tuple): ...     some_int += 2 ...     some_list +=

Re: Check file is locked?

2009-07-08 Thread Tim Golden
Rajat wrote: On Jul 8, 4:57 am, Lawrence D'Oliveiro l...@geek- central.gen.new_zealand wrote: In message mailman.2795.1246997268.8015.python-l...@python.org, Christian Heimes wrote: By the way most operating systems don't lock a file when it's opened for reading or writing or even executed.

Remoting over SSH

2009-07-08 Thread Hussein B
Hey, I want to perform commands on a remote server over SSH. What do I need? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: IP Address Function

2009-07-08 Thread Fred Atkinson
On Tue, 07 Jul 2009 22:54:03 -0300, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Tue, 07 Jul 2009 22:45:24 -0300, Fred Atkinson fatkin...@mishmash.com escribió: Is there a Python function I can use to get the user's IP address so I can display it on his browser? There is a long

Re: tough-to-explain Python

2009-07-08 Thread Gabriel Genellina
En Wed, 08 Jul 2009 04:32:07 -0300, Francesco Bochicchio bieff...@gmail.com escribió: I would go with something like this: In object oriented programming, the same function or operator can be used to represent different things. This is called overloading. To understand what the

Re: tough-to-explain Python

2009-07-08 Thread Piet van Oostrum
Simon Forman sajmik...@gmail.com (SF) wrote: SF Why would you even tell the poor bastards about += before they were SF comfortable with (python's style of) function calls, immutable SF integers, mutable lists and immutable tuples? SF Let them use x = x + y until they have enough knowledge to SF

PyQt GUI

2009-07-08 Thread Helvin
Hi experts! I'm developing a GUI for a software using PyQT, and need 3D visualization. Should I use PyOpenGL or VTK? I understand that the PyQt package comes with a opengl module. What else would I need? I think I need to download opengl. but how? where? I have VTK and pyVTK installed, but I

Re: count

2009-07-08 Thread Vilya Harvey
2009/7/8 Dhananjay dhananjay.c.jo...@gmail.com: I wanted to sort column 2 in assending order  and I read whole file in array data and did the following: data.sort(key = lambda fields:(fields[2])) I have sorted column 2, however I want to count the numbers in the column 2. i.e. I want to

Re: PyQt GUI

2009-07-08 Thread Diez B. Roggisch
Helvin wrote: Hi experts! I'm developing a GUI for a software using PyQT, and need 3D visualization. Should I use PyOpenGL or VTK? I understand that the PyQt package comes with a opengl module. What else would I need? I think I need to download opengl. but how? where? I have VTK and pyVTK

Re: PyQt GUI

2009-07-08 Thread Phil Thompson
On Wed, 08 Jul 2009 11:11:51 +0200, Diez B. Roggisch de...@nospam.web.de wrote: Helvin wrote: Hi experts! I'm developing a GUI for a software using PyQT, and need 3D visualization. Should I use PyOpenGL or VTK? I understand that the PyQt package comes with a opengl module. What else

Fractions as result from divisions (was: Re: tough-to-explain Python)

2009-07-08 Thread Ulrich Eckhardt
Bearophile wrote: For example a novice wants to see 124 / 38 to return the 62/19 fraction and not 3 or 3.263157894736842 :-) Python has adopted the latter of the three for operator / and the the second one for operator //. I wonder if it was considered to just return a fraction from that

Re: Python Error from Apress book

2009-07-08 Thread Dave Angel
Gabriel Genellina wrote: div class=moz-text-flowed style=font-family: -moz-fixedEn Tue, 07 Jul 2009 09:55:13 -0300, Dave Angel da...@ieee.org escribió: Gabriel Genellina wrote: En Mon, 06 Jul 2009 19:56:40 -0300, matt0177 matt0...@gmail.com escribió: When I try to run the command as

Re: PyQt GUI

2009-07-08 Thread Diez B. Roggisch
Phil Thompson wrote: On Wed, 08 Jul 2009 11:11:51 +0200, Diez B. Roggisch de...@nospam.web.de wrote: Helvin wrote: Hi experts! I'm developing a GUI for a software using PyQT, and need 3D visualization. Should I use PyOpenGL or VTK? I understand that the PyQt package comes with a

Re: count

2009-07-08 Thread Tim Chase
I wanted to sort column 2 in assending order and I read whole file in array data and did the following: data.sort(key = lambda fields:(fields[2])) I have sorted column 2, however I want to count the numbers in the column 2. i.e. I want to know, for example, how many repeates of say '3' (first

Re: Re: Check file is locked?

2009-07-08 Thread Dave Angel
Rajat wrote: On Jul 8, 4:57 am, Lawrence D'Oliveiro l...@geek- central.gen.new_zealand wrote: In message mailman.2795.1246997268.8015.python-l...@python.org, Christian Heimes wrote: By the way most operating systems don't lock a file when it's opened for reading or writing or even

Re: DBI module deprecated at Python 2.5--what to use in its place?

2009-07-08 Thread dana
On Jul 8, 12:30 am, John Machin sjmac...@lexicon.net wrote: Deprecated certainly doesn't mean removed. For a start, none of (DBI, ODBC, dbi, odbc) are standard Python- supplied modules. Perhaps you are referring to the odbc (and dbi) from the pywin32 package? Where did you get them from? If

Re: Catching control-C

2009-07-08 Thread Nick Craig-Wood
Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Mon, 06 Jul 2009 15:02:26 -0700, Michael Mossey wrote: On Jul 6, 2:47 pm, Philip Semanchuk phi...@semanchuk.com wrote: On Jul 6, 2009, at 5:37 PM, Michael Mossey wrote: What is required in a python program to make sure it

Re: IP Address Function

2009-07-08 Thread Piet van Oostrum
Fred Atkinson fatkin...@mishmash.com (FA) wrote: FA On Tue, 07 Jul 2009 22:54:03 -0300, Gabriel Genellina FA gagsl-...@yahoo.com.ar wrote: En Tue, 07 Jul 2009 22:45:24 -0300, Fred Atkinson fatkin...@mishmash.com escribió: Is there a Python function I can use to get the user's IP address

Re: count

2009-07-08 Thread Bearophile
Vilya Harvey: from itertools import groupby for x, g in groupby([fields[1] for fields in data]):     print x, len(tuple(g)) Avoid that len(tuple(g)), use something like the following, it's lazy and saves some memory. def leniter(iterator): leniter(iterator): return the length of a given

Re: Fractions as result from divisions (was: Re: tough-to-explain Python)

2009-07-08 Thread kj
In c75ei6-e0i@satorlaser.homedns.org Ulrich Eckhardt eckha...@satorlaser.com writes: Bearophile wrote: For example a novice wants to see 124 / 38 to return the 62/19 fraction and not 3 or 3.263157894736842 :-) Python has adopted the latter of the three for operator / and the the second

Re: Remoting over SSH

2009-07-08 Thread Lucas Carvalho
Hussein B wrote: Hey, I want to perform commands on a remote server over SSH. What do I need? Thanks. Hi, If you want to use the SSH2 protocol into a python code, you should take a look at this module: paramiko [1]. [1] http://www.lag.net/paramiko/ Regards, Lucas. --

Re: tough-to-explain Python

2009-07-08 Thread kj
In 5f0a2722-45eb-468c-b6b2-b7bb80ae5...@q11g2000yqi.googlegroups.com Simon Forman sajmik...@gmail.com writes: Frankly, I'm of the impression that it's a mistake not to start teaching programming with /the bit/ and work your way up from there. I'm not kidding. I wrote a (draft) article about

Re: Remoting over SSH

2009-07-08 Thread Hendrik van Rooyen
Hussein B hubaghd...@gmail.com wrote: Hey, I want to perform commands on a remote server over SSH. What do I need? Thanks. Access privileges for the remote machine. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: DBI module deprecated at Python 2.5--what to use in its place?

2009-07-08 Thread Paul Moore
2009/7/8 dana dana_at_w...@yahoo.com: On Jul 8, 12:30 am, John Machin sjmac...@lexicon.net wrote: Deprecated certainly doesn't mean removed. For a start, none of (DBI, ODBC, dbi, odbc) are standard Python- supplied modules. Perhaps you are referring to the odbc (and dbi) from the pywin32

Re: Fractions as result from divisions (was: Re: tough-to-explain Python)

2009-07-08 Thread Steven D'Aprano
On Wed, 08 Jul 2009 11:24:28 +0200, Ulrich Eckhardt wrote: Bearophile wrote: For example a novice wants to see 124 / 38 to return the 62/19 fraction and not 3 or 3.263157894736842 :-) Python has adopted the latter of the three for operator / and the the second one for operator //. Up

Re: Check file is locked?

2009-07-08 Thread Steven D'Aprano
On Wed, 08 Jul 2009 00:06:11 -0700, Dennis Lee Bieber wrote: Also, some applications may still have the file open, but Windows allows one to make copies of that file... Not always though... some applications open files for exclusive read access. -- Steven --

Re: Fractions as result from divisions

2009-07-08 Thread Hans Nowak
Ulrich Eckhardt wrote: Bearophile wrote: For example a novice wants to see 124 / 38 to return the 62/19 fraction and not 3 or 3.263157894736842 :-) Python has adopted the latter of the three for operator / and the the second one for operator //. I wonder if it was considered to just return a

Re: tough-to-explain Python

2009-07-08 Thread Steven D'Aprano
On Wed, 08 Jul 2009 12:23:50 +, kj wrote: In 5f0a2722-45eb-468c-b6b2-b7bb80ae5...@q11g2000yqi.googlegroups.com Simon Forman sajmik...@gmail.com writes: Frankly, I'm of the impression that it's a mistake not to start teaching programming with /the bit/ and work your way up from there. I'm

Re: library search path when compiling python

2009-07-08 Thread nn
On Jul 7, 4:06 pm, Christian Heimes li...@cheimes.de wrote: nn wrote: I am trying to compile python with ssl support but the libraries are not in /usr/lib but in /opt/freeware/lib. How do I add that folder to the default library search path? It looks like configure --libdir=DIR might do

Re: tough-to-explain Python

2009-07-08 Thread kj
In 5f0a2722-45eb-468c-b6b2-b7bb80ae5...@q11g2000yqi.googlegroups.com Simon Forman sajmik...@gmail.com writes: I'm not kidding. I wrote a (draft) article about this: Computer Curriculum http://docs.google.com/View?id=dgwr777r_31g4572gp4 Very cool. kj --

Re: Newbie needs help

2009-07-08 Thread Aahz
In article mailman.2781.1246979580.8015.python-l...@python.org, Pablo Torres N. tn.pa...@gmail.com wrote: Give this one a try too: http://www.mikeash.com/getting_answers.html It doesn't talk down to you...as much :P Nice! I'll try remembering that one. -- Aahz (a...@pythoncraft.com)

Re: tough-to-explain Python

2009-07-08 Thread Paul Moore
2009/7/8 kj no.em...@please.post: There is this persistent idea out there that programming is a very accessible skill, like cooking or gardening, anyone can do it, and even profit from it, monetarily or otherwise, etc., and to some extent I am actively contributing to this perception by

Re: tough-to-explain Python

2009-07-08 Thread nn
On Jul 7, 5:18 pm, kj no.em...@please.post wrote: In mailman.2796.1246997332.8015.python-l...@python.org Chris Rebert c...@rebertia.com writes: You might find the following helpful (partially): http://effbot.org/zone/call-by-object.htm Extremely helpful.  Thanks!  (I learned more from it

The meaning of = (Was: tough-to-explain Python)

2009-07-08 Thread kj
In h30e3t$g5...@reader1.panix.com kj no.em...@please.post writes: I had not realized how *profoundly* different the meaning of the = in Python's spam = ham is from the = in its spam[3] = ham[3] To clarify, this comes from my reading of Fredrik Lundh's pages Python Objects

Re: Clarity vs. code reuse/generality

2009-07-08 Thread pdpi
On Jul 8, 2:24 am, Paul Rubin http://phr...@nospam.invalid wrote: pdpi pdpinhe...@gmail.com writes:     while abs(func(guess) - target) epsilon:         guess = (lo + hi) / 2.         if sense * func(guess) sense * target:             hi = guess         elif sense * func(guess) sense

[0, 0, 0, 1, 1, 1, 0] ... remove all 0 values

2009-07-08 Thread Daniel Austria
Hi python - hackers, just one question. How can i remove all 0 values in a list? Sure - i can loop over it, but that s not a neat style. list.remove() will only remove the first occurence. Doing that while no exception is raised is also uncool, right? Some suggestions? Best, Dan --

Re: [0, 0, 0, 1, 1, 1, 0] ... remove all 0 values

2009-07-08 Thread ma
filter(lambda x: x, your_list) On Wed, Jul 8, 2009 at 10:44 AM, Daniel Austria futureb...@gmx.at wrote: Hi python - hackers, just one question. How can i remove all 0 values in a list? Sure - i can loop over it, but that s not a neat style. list.remove() will only remove the first

Re: The meaning of = (Was: tough-to-explain Python)

2009-07-08 Thread Paul Boddie
On 8 Jul, 16:04, kj no.em...@please.post wrote:   identifier = expression and not to those like, for example,   identifier[expression] = expression or   identifier.identifier = expression The former are syntatic sugar for certain namespace modifications that leave objects unchanged.  

Re: Remoting over SSH

2009-07-08 Thread Djames Suhanko
Hello! I wrote a litle program that send commands to many cluster nodes: #!/usr/bin/env python #By: Djames Suhanko #servers list sincroniza =[server1.domain,server2.domain, server3.domain] import pexpect import sys from threading import Thread #the user and pass can be in ini file. #Test

Re: [0, 0, 0, 1, 1, 1, 0] ... remove all 0 values

2009-07-08 Thread Bruno Desthuilliers
Daniel Austria a écrit : Hi python - hackers, just one question. How can i remove all 0 values in a list? Sure - i can loop over it, but that s not a neat style. list.remove() will only remove the first occurence. Doing that while no exception is raised is also uncool, right? Some

Re: [0, 0, 0, 1, 1, 1, 0] ... remove all 0 values

2009-07-08 Thread Charles Yeomans
On Jul 8, 2009, at 10:54 AM, ma wrote: filter(lambda x: x, your_list) On Wed, Jul 8, 2009 at 10:44 AM, Daniel Austria futureb...@gmx.at wrote: Hi python - hackers, just one question. How can i remove all 0 values in a list? Sure - i can loop over it, but that s not a neat style.

Re: [0, 0, 0, 1, 1, 1, 0] ... remove all 0 values

2009-07-08 Thread D'Arcy J.M. Cain
On Wed, 8 Jul 2009 10:54:09 -0400 ma mabdelka...@gmail.com wrote: filter(lambda x: x, your_list) Or... [x for x in your_list if x] I'm not sure which one is more efficient but I like the syntax of the latter. A smart person could probably figure it out even without knowing Python syntax.

Re: [0, 0, 0, 1, 1, 1, 0] ... remove all 0 values

2009-07-08 Thread Friðrik Már Jónsson
ma wrote: filter(lambda x: x, your_list) Good call! Equivalent but more efficient: filter(None, your_list) Regards, Friðrik Már -- http://mail.python.org/mailman/listinfo/python-list

Re: [0, 0, 0, 1, 1, 1, 0] ... remove all 0 values

2009-07-08 Thread Diez B. Roggisch
Daniel Austria wrote: Hi python - hackers, just one question. How can i remove all 0 values in a list? Sure - i can loop over it, but that s not a neat style. Why not? If you need to potentially look at *all* elements of a list, nothing but a loop will take you there. OTOH, your proposed

Re: Remoting over SSH

2009-07-08 Thread Raúl Gómez C .
You also could use TwistedConchhttp://twistedmatrix.com/trac/wiki/TwistedConch, which is an implementation of the SSH2 protocol for Python. I've done something with it, you can read my first questions on the TwistedConch list

Re: The meaning of = (Was: tough-to-explain Python)

2009-07-08 Thread kj
In 0778f257-d36c-4e13-93ea-bf8d448c8...@b15g2000yqd.googlegroups.com Paul Boddie p...@boddie.org.uk writes: On 8 Jul, 16:04, kj no.em...@please.post wrote: =A0 identifier =3D expression and not to those like, for example, =A0 identifier[expression] =3D expression or =A0

Re: The meaning of = (Was: tough-to-explain Python)

2009-07-08 Thread Aahz
In article 0778f257-d36c-4e13-93ea-bf8d448c8...@b15g2000yqd.googlegroups.com, Paul Boddie p...@boddie.org.uk wrote: Almost. The latter can modify namespaces - the objects themselves - but through properties or dynamic attribute access, they may choose not to modify such a namespace. Really, we

Re: Python Error from Apress book

2009-07-08 Thread Matthew Edmondson
I'm running XP SP3. The program now works great from either of the directories, as long as include 'python' before it. As far as looking at the error with stack trace, I really don't know enough yet to know how to do that. I'm running the file from command line, because I'm not sure how to run it

Re: tough-to-explain Python

2009-07-08 Thread Dave Angel
kj wrote: In 5f0a2722-45eb-468c-b6b2-b7bb80ae5...@q11g2000yqi.googlegroups.com Simon Forman sajmik...@gmail.com writes: Frankly, I'm of the impression that it's a mistake not to start teaching programming with /the bit/ and work your way up from there. I'm not kidding. I wrote a (draft)

Re: The meaning of = (Was: tough-to-explain Python)

2009-07-08 Thread Aahz
In article h32eoh$ql...@reader1.panix.com, kj no.em...@please.post wrote: OK, so, scratching from my original post the case identifier.identifier = expression (as being a special case of identifier = expression), still, to the extent that I understand your post, the = in x = 1 means

OT: unix to Windows technology

2009-07-08 Thread Xah Lee
Dear unixers lispers, i've been using Mac for the past 19 years, and been a professional sys admin or web app developers on the unix platform, since 1998 (maily Solaris, Apache, Perl, Java, SQL, PHP). In june, i bought a PC (not for the first time though), and made a switch to Windows, for the

Re: [0, 0, 0, 1, 1, 1, 0] ... remove all 0 values

2009-07-08 Thread J Kenneth King
Friðrik Már Jónsson frid...@pyth.net writes: ma wrote: filter(lambda x: x, your_list) Good call! Equivalent but more efficient: filter(None, your_list) Regards, Friðrik Már I was wondering when someone would mention filter() -- http://mail.python.org/mailman/listinfo/python-list

Re: Does cProfile include IO wait time?

2009-07-08 Thread Robert Kern
On 2009-07-04 19:03, Matthew Wilson wrote: I have a command-line script that loads about 100 yaml files. It takes 2 or 3 seconds. I profiled my code and I'm using pstats to find what is the bottleneck. Here's the top 10 functions, sorted by internal time: In [5]:

Re: The meaning of = (Was: tough-to-explain Python)

2009-07-08 Thread kj
In h32fon$26...@panix3.panix.com a...@pythoncraft.com (Aahz) writes: In article h32eoh$ql...@reader1.panix.com, kj no.em...@please.post wrote: OK, so, scratching from my original post the case identifier.identifier = expression (as being a special case of identifier = expression), still, to

Re: [0, 0, 0, 1, 1, 1, 0] ... remove all 0 values

2009-07-08 Thread Friðrik Már Jónsson
J Kenneth King wrote: I was wondering when someone would mention filter() I was happy to see that too. It's clean, faster than list comprehension and in terms of clarity it's only to be expected that the developer is familiar with, or at least willing to look up, the available built-in

Re: OT: unix to Windows technology

2009-07-08 Thread Kenneth Tilton
Xah Lee wrote: Dear unixers lispers, i've been using Mac for the past 19 years, and been a professional sys admin or web app developers on the unix platform, since 1998 (maily Solaris, Apache, Perl, Java, SQL, PHP). In june, i bought a PC (not for the first time though), and made a switch to

Re: The meaning of = (Was: tough-to-explain Python)

2009-07-08 Thread Terry Reedy
kj wrote: To clarify, this comes from my reading of Fredrik Lundh's pages Python Objects (http://effbot.org/zone/python-objects.htm) and Call By Object (http://effbot.org/zone/call-by-object.htm). [snip] [END OF LENGTHY QUOTE] Therefore, extending just a bit beyond Lundh's explanation, if we

Re: Python and webcam capture delay?

2009-07-08 Thread Nobody
On Tue, 07 Jul 2009 22:49:22 -0700, Dennis Lee Bieber wrote: On Tue, 07 Jul 2009 23:37:43 +0100, Nobody nob...@nowhere.com declaimed the following in gmane.comp.python.general: AFAIK, the only real difference between USB-1 conformant and USB-2 conformant is that the latter actually passed a

Problem with list of dicts and copying

2009-07-08 Thread Cameron Pulsford
Hello all, I'm redoing a sudoku solver of mine and I ran into an issue with lists of dicts. Bear with me for a second before I get to the actual problem... I'm representing the board as a dictionary, where the keys are (x, y) positions, and the values are candidates. So my program goes along

windows command-line

2009-07-08 Thread Lucas Junqueira
Hi, I'd like to run a simple windows command-line program from within my python script and agt all the returt it generates. Is this possible? How can I do it? Thank you! Veja quais são os assuntos do

Re: windows command-line

2009-07-08 Thread Emile van Sebille
On 7/8/2009 10:07 AM Lucas Junqueira said... Hi, I'd like to run a simple windows command-line program from within my python script and agt all the returt it generates. Is this possible? How can I do it? Depending on python version, look into subprocess, commands or os.pipe and related.

Re: Python and webcam capture delay?

2009-07-08 Thread Nobody
On Tue, 07 Jul 2009 22:11:12 -0700, Tim Roberts wrote: The webcam is bound to do some encoding; most of them use USB full speed (12Mbit/sec), which isn't enough for raw 640x480x24...@30fps data. That's not true. Most of the web cams made in the last 5 years or so run at high speed, 480 Mbps.

Re: Check file is locked?

2009-07-08 Thread Nobody
On Tue, 07 Jul 2009 21:31:12 -0700, Rajat wrote: By the way most operating systems don't lock a file when it's opened for reading or writing or even executed. The general conclusion seems to be that mandatory locking is more trouble than it's worth. My OS is a windows XP sp3. All I'm

Re: OT: unix to Windows technology

2009-07-08 Thread Xah Lee
Xah Lee wrote: • Switching from Mac/Unix To PC/Windows http://xahlee.org/mswin/switch_to_windows.html Kenneth Tilton wrote: You just discovered PCs are cheaper? The funny thing is that that is Microsoft's answer to the Apple Mac-PC ads, they show people shopping for computers and just

function local namespace question

2009-07-08 Thread Paul LaFollette
Kind people, Using Python 3.1 under FreeBSD and WinXP. I've been tearing my hair out trying to solve this myself, but I need to ask for help. I want (for obscure reasons) to be able to log transactions in the namespace(s) of a script. Specifically I would like to log creation of identifiers,

Emacs Python-mode. Newbie problem.

2009-07-08 Thread Lacrima
Hello! I have just started using Emacs to write python scripts. I installed python-mode.el Then I just tried this code: print 'hello world' When I press C-c RET, new blank window is opened and emacs says: (Shell command succeeded with no output) So where is my 'hello world'? When I do C-c

Re: ... remove all 0 values

2009-07-08 Thread Simon Forman
On Jul 8, 10:44 am, Daniel Austria futureb...@gmx.at wrote: Hi python - hackers, just one question. How can i remove all 0 values in a list? Sure - i can loop over it, but that s not a neat style.  list.remove() will only remove the first occurence. Doing that while no exception is raised is

Re: ISO library ref in printed form

2009-07-08 Thread kj
In m2r5wsb55n@cs.uu.nl Piet van Oostrum p...@cs.uu.nl writes: kj no.em...@please.post (kj) wrote: kj Does anyone know where I can buy the Python library reference in kj printed form? (I'd rather not print the whole 1200+-page tome kj myself.) I'm interested in both/either 2.6 and 3.0.

Re: [0, 0, 0, 1, 1, 1, 0] ... remove all 0 values

2009-07-08 Thread Paul Rubin
Daniel Austria futureb...@gmx.at writes: just one question. How can i remove all 0 values in a list? I prefer: newlist = list(x for x in oldlist if x != 0) to the square bracket list comprehension that a few people have suggested. This is because in python 2.x, the listcomp leaks its

Re: A Bug By Any Other Name ...

2009-07-08 Thread Daniel Fetchinson
But this academic discussion is honestly a little pointless. The OP was referring to a expectation, coming from C, that is not fulfilled in python. What's wrong with mentioning it somewhere for the sake of helping C programmers? And where does one stop? After all, my primary work

Re: ISO library ref in printed form

2009-07-08 Thread João Valverde
kj wrote: Does anyone know where I can buy the Python library reference in printed form? (I'd rather not print the whole 1200+-page tome myself.) I'm interested in both/either 2.6 and 3.0. TIA! kj Why not download the documentation, take it to a local copy shop and have it printed and

Re: count

2009-07-08 Thread Aahz
In article 050094ea-faf4-4e03-875d-9c2c63090...@y17g2000yqn.googlegroups.com, Bearophile bearophileh...@lycos.com wrote: Vilya Harvey: from itertools import groupby for x, g in groupby([fields[1] for fields in data]): =A0 =A0 print x, len(tuple(g)) Avoid that len(tuple(g)), use something

Re: Emacs Python-mode. Newbie problem.

2009-07-08 Thread Piet van Oostrum
Lacrima lacrima.ma...@gmail.com (L) wrote: L Hello! L I have just started using Emacs to write python scripts. L I installed python-mode.el L Then I just tried this code: L print 'hello world' L When I press C-c RET, new blank window is opened and emacs says: L (Shell command succeeded with

Re: ISO library ref in printed form

2009-07-08 Thread Piet van Oostrum
kj no.em...@please.post (k) wrote: k In m2r5wsb55n@cs.uu.nl Piet van Oostrum p...@cs.uu.nl writes: kj no.em...@please.post (kj) wrote: kj Does anyone know where I can buy the Python library reference in kj printed form? (I'd rather not print the whole 1200+-page tome kj myself.) I'm

Re: count

2009-07-08 Thread Paul Rubin
Bearophile bearophileh...@lycos.com writes:     print x, len(tuple(g)) Avoid that len(tuple(g)), use something like the following print x, sum(1 for _ in g) -- http://mail.python.org/mailman/listinfo/python-list

Re: function local namespace question

2009-07-08 Thread Miles Kaufmann
On Jul 8, 2009, at 1:35 PM, Paul LaFollette wrote: I cannot figure out any way to get a hook into the local namespace of a user defined function. I have tried making a wrapper class that grabs the function call and then uses exec to invoke myfunction.__code__ with my own dictionaries. This

Re: count

2009-07-08 Thread Paul Rubin
a...@pythoncraft.com (Aahz) writes: Avoid that len(tuple(g)), use something like the following, it's lazy and saves some memory. The question is whether it saves time, have you tested it? len(tuple(xrange(1))) ... hmm. -- http://mail.python.org/mailman/listinfo/python-list

regex help

2009-07-08 Thread David
Hi I have a few regexs I need to do, but im struggling to come up with a nice way of doing them, and more than anything am here to learn some tricks and some neat code rather than getting an answer - although thats obviously what i would like to get to. Problem 1 - span class=chg

Re: count

2009-07-08 Thread Aahz
In article 7xbpnuzw4u@ruckus.brouhaha.com, Paul Rubin http://phr...@nospam.invalid wrote: a...@pythoncraft.com (Aahz) writes: Paul Rubin deleted an attribution: Avoid that len(tuple(g)), use something like the following, it's lazy and saves some memory. The question is whether it saves

Re: Clarity vs. code reuse/generality

2009-07-08 Thread Tim Rowe
2009/7/7 Steven D'Aprano st...@remove-this-cybersource.com.au: Maybe the reason for so much buggy software is that people inappropriately use assert, thus changing the behaviour of code depending on whether it is run with the -O flag or not. I've done my share of code review and process

Re: regex help

2009-07-08 Thread Chris Rebert
On Wed, Jul 8, 2009 at 3:06 PM, Daviddavid.bra...@googlemail.com wrote: Hi I have a few regexs I need to do, but im struggling to come up with a nice way of doing them, and more than anything am here to learn some tricks and some neat code rather than getting an answer - although thats

Re: Cleaning up after failing to contructing objects

2009-07-08 Thread Mattias Brändström
On Jul 6, 11:15 pm, Scott David Daniels scott.dani...@acm.org wrote: brasse wrote: I have been thinking about how write exception safe constructors in Python. By exception safe I mean a constructor that does not leak resources when an exception is raised within it. ...   As you can see

Re: regex help

2009-07-08 Thread Tim Harig
On 2009-07-08, Chris Rebert c...@rebertia.com wrote: On Wed, Jul 8, 2009 at 3:06 PM, Daviddavid.bra...@googlemail.com wrote: I want to extract the open, mkt cap and P/E values - but apart from doing loads of indivdual REs which I think would look messy, I can't think of a better and neater

Pydev 1.4.7 Released

2009-07-08 Thread Fabio Zadrozny
Hi All, Pydev and Pydev Extensions 1.4.7 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development: http://pydev.blogspot.com Release Highlights in Pydev Extensions:

Re: PyQt GUI

2009-07-08 Thread Helvin
On Jul 8, 9:23 pm, Phil Thompson p...@riverbankcomputing.com wrote: On Wed, 08 Jul 2009 11:11:51 +0200, Diez B. Roggisch de...@nospam.web.de wrote: Helvin wrote: Hi experts! I'm developing a GUI for a software using PyQT, and need 3D visualization. Should I use PyOpenGL or VTK?

tkinter problem

2009-07-08 Thread Paul Simon
I have the tkinter problem and need some assistance to straighten it out. From the web page http://wiki.python.org/moin/TkInter; I tested as in step 1 and cannot import _tkinter. I do not have that file on my computer, but do have tkinter.py in /usr/local/lib/python2.6/lib-tk. as well as the

Re: regex help

2009-07-08 Thread Rhodri James
On Wed, 08 Jul 2009 23:06:22 +0100, David david.bra...@googlemail.com wrote: Hi I have a few regexs I need to do, but im struggling to come up with a nice way of doing them, and more than anything am here to learn some tricks and some neat code rather than getting an answer - although thats

Re: tkinter problem

2009-07-08 Thread Chris Rebert
On Wed, Jul 8, 2009 at 4:18 PM, Paul Simonpsi...@sonic.net wrote: I have the tkinter problem and need some assistance to straighten it out. From the web page http://wiki.python.org/moin/TkInter; I tested as in step 1 and cannot import _tkinter. I do not have that file on my computer, but do

Re: PyQt GUI

2009-07-08 Thread Robert Kern
On 2009-07-08 18:10, Helvin wrote: Thanks for the fast replies! I will look into how to use VTK now. Where would I find VTK's explicit support for PyQt? Wrapping/Python/vtk/qt4/ in the VTK sources. Because I have installed VTK (using its installer) and pyVTK (using its setup.py file), but

Re: walking a directory with very many files

2009-07-08 Thread Lawrence D'Oliveiro
In message kck0m.406$ze1@news-server.bigpond.net.au, Lie Ryan wrote: Lawrence D'Oliveiro wrote: ... certainly it is characteristic of GUIs to show you all 400,000 files in a directory, or at least try to do so, and either hang for half an hour or run out of memory and crash, rather than

Re: ANN: GMPY 1.10 alpha with support for Python 3

2009-07-08 Thread Mensanator
On Jul 7, 12:47 am, Mensanator mensana...@aol.com wrote: On Jul 7, 12:16 am, casevh cas...@gmail.com wrote: I discovered a serious bug with comparisons and have posted alpha2 which fixes that bug and adds Unicode support for Python 2.x casevh Damn! I was just congatulating myself for

Re: tkinter problem

2009-07-08 Thread Paul Simon
Chris Rebert c...@rebertia.com wrote in message news:mailman.2863.1247095339.8015.python-l...@python.org... On Wed, Jul 8, 2009 at 4:18 PM, Paul Simonpsi...@sonic.net wrote: I have the tkinter problem and need some assistance to straighten it out. From the web page

Re: ANN: GMPY 1.10 alpha with support for Python 3

2009-07-08 Thread casevh
On Jul 8, 5:03 pm, Mensanator mensana...@aol.com wrote: On Jul 7, 12:47 am, Mensanator mensana...@aol.com wrote: On Jul 7, 12:16 am, casevh cas...@gmail.com wrote: I discovered a serious bug with comparisons and have posted alpha2 which fixes that bug and adds Unicode support for

  1   2   >