Re: Announcing PythonTurtle

2009-08-03 Thread r
On Aug 3, 8:53 pm, Asun Friere wrote: > On Aug 4, 6:35 am, r wrote: > > [snip] > > > > > I can remember the first time i used turtle (in python stdlib) and i > > kept saying to myself... > > >     "Were the heck is this damn turtle?!?!

Re: no-clobber dicts?

2009-08-03 Thread r
On Aug 3, 5:00 pm, Chris Rebert wrote: > On Mon, Aug 3, 2009 at 2:47 PM, r wrote: [snip] > > Not sure if something like this already exists, but it would be > > trivial to implement by overriding dict.__setitem__() > > That is, if you don't care about .update() not

Re: Announcing PythonTurtle

2009-08-03 Thread r
On Aug 3, 5:03 pm, cool-RR wrote: [snip] > Thanks for the compliments; The things you mentioned you liked are all > things that I was specifically thinking about when I decided to make > PythonTurtle. Well, maybe minus the screenshot :) I *may* get roasted for this comment, but i think a turtle m

Re: no-clobber dicts?

2009-08-03 Thread r
On Aug 3, 4:07 pm, kj wrote: > I use the term "no-clobber dict" to refer to a dictionary D with > the especial property that if K is in D, then > >   D[K] = V > > will raise an exception unless V == D[K].  In other words, D[K] > can be set if K doesn't exist already among D's keys, or if the > ass

Re: Announcing PythonTurtle

2009-08-03 Thread r
Hello, I wanted to announce that I have just released my little side project, PythonTurtle. [snip] I think it looks great --haven't download the source yet-- but i really like the screenshot. This will be more "inviting" to the new, inexperianced users. I like the idea of packaging up the command

Re: Printing with colors in a portable way

2009-08-03 Thread r
On Aug 2, 9:52 pm, a...@pythoncraft.com (Aahz) wrote: [snip] > Much as I hate to say, use a cross-platform GUI -- Tkinter comes with > Python, [snip] Why is Tkinter such a whipping boy of the Python community? I know it's very simple and does not have all the bells and whistles of wx, but i think

Re: possible to round number and convert to string?

2009-08-01 Thread r
On Jul 31, 7:42 pm, "Dr. Phillip M. Feldman" wrote: > This was very close to what I wanted.  Thanks!  My final code looks like > this: > > def num2str(x,f=4): >    """Convert x (int or float) to a string with f digits to right of >    the decimal point.  f may be zero or negative, in which case th

Re: Python docs disappointing

2009-07-31 Thread r
On Jul 31, 4:53 pm, Mark Lawrence wrote: > r wrote: > > On Jul 31, 4:16 pm, Carl Banks wrote: > >> On Jul 31, 1:10 pm, kj wrote: > > >>> I'm pretty new to Python, and I like a lot overall, but I find the > >>> documentation for Python rather

Re: Python docs disappointing

2009-07-31 Thread r
On Jul 31, 4:16 pm, Carl Banks wrote: > On Jul 31, 1:10 pm, kj wrote: > > > I'm pretty new to Python, and I like a lot overall, but I find the > > documentation for Python rather poor, overall. > > > I'm sure that Python experts don't have this problem: they have > > internalized some good ways t

Re: Python docs disappointing

2009-07-31 Thread r
On Jul 31, 3:10 pm, kj wrote: > I'm pretty new to Python, and I like a lot overall, but I find the > documentation for Python rather poor, overall. [snip] If you mean the built-in docs i *highly agree* with you. if you mean docs/tutorials available across the WWW i *highly disagree* with you, and

Re: Confessions of a Python fanboy

2009-07-30 Thread r
On Jul 30, 4:57 pm, Luis Zarrabeitia wrote: [snip] > I'd like to ask, what "container.each" is, exactly? It looks like a function > call (as I've learned a few posts ago), but, what are its arguments? How the > looping "works"? Does it receive a "code" object that it has to execute? > Is .each som

Re: Confessions of a Python fanboy

2009-07-30 Thread r
On Jul 30, 4:29 pm, Emmanuel Surleau wrote: > > 1.) No need to use "()" to call a function with no arguments. > > Python --> "obj.m2().m3()" --ugly > >   Ruby --> "obj.m1.m2.m3"  -- sweeet! > > Man, i must admit i really like this, and your code will look so much > > cleaner. > > It has benefits -

Re: Confessions of a Python fanboy

2009-07-30 Thread r
On Jul 30, 3:55 pm, Terry Reedy wrote: > superpollo wrote: > > r wrote: > > how to reverse a string in python? must i usa a temp? like: [snip] > Terry Jan Reedy No "r" never wrote anything like that. reversing a string is RTFM material, this is basic stuff here! Stop

Re: class or thread id count

2009-07-30 Thread r
On Jul 30, 1:13 pm, NighterNet wrote: > Need some help on doing some bit simple id count. It like every time > it create a class or thread there is id++. Python 3.1 > > example: > class ClientThread (threading.Thread): >    def __init__(self,clientSocket): >       threading.Thread.__init__(self) >

Re: calling obect method

2009-07-30 Thread r
>>> import math >>> getattr(math, 'hypot')(3,4) 5.0 -- http://mail.python.org/mailman/listinfo/python-list

Re: Confessions of a Python fanboy

2009-07-30 Thread r
On Jul 30, 12:37 pm, Jean-Michel Pichavant wrote: > r wrote: > > On Jul 30, 11:31 am, Falcolas wrote: > > >> On Jul 29, 9:06 pm, r wrote: > > >>> 1.) No need to use "()" to call a function with no arguments. > >>> Python --> &quo

Re: Confessions of a Python fanboy

2009-07-30 Thread r
Traceback (most recent post last): File "", lines (13,14), in vector.reverse --> in-place vector.reversed --> in-place DumbMistakeError: Of course in python you would do... vector.reverse --> in-place vector.reversed --> new vector -- http://mail.python.org/mailman/listinfo/python-

Re: Confessions of a Python fanboy

2009-07-30 Thread r
On Jul 30, 12:15 pm, Masklinn wrote: [snip] > Furthermore Ruby has a pretty nice convention (sadly not used enough I   > think) taken from Scheme where it's possible to postfix a method name   > with "!" (note: the "!" is part of the name, there's no magic) to   > indicate that this method modifie

Re: Confessions of a Python fanboy

2009-07-30 Thread r
On Jul 30, 11:31 am, Falcolas wrote: > On Jul 29, 9:06 pm, r wrote: > > > 1.) No need to use "()" to call a function with no arguments. > > Python --> "obj.m2().m3()" --ugly > >   Ruby --> "obj.m1.m2.m3"  -- sweeet! > > Man

Re: IDLE Config Problems

2009-07-29 Thread r
On Jul 29, 3:55 pm, "Russ Davis" wrote: > I am just getting started with Python and have installed v. 2.5.4  Idle > version 1.2.4  I can't seem to get the idle to display text.  It seems as if > the install went fine.  I start up the idle and the screen is blank.  No > text.  It seems as if I c

Confessions of a Python fanboy

2009-07-29 Thread r
Hello fellow Pythonista's it's nice to be back after such a long hiatus. I have recently realized my blind love affair with Python was just that. I must admit there are better ways to program. Like your first lay, your first programing language can leave an indelible mark on you, but like all you

I am trying to compile python 2.6.2 on my Mac

2009-07-26 Thread Jessica R Smith
Hello, I am trying to compile Python 2.6.2 on my Mac which has os/x 10.5.7 I downloaded python 2.6.2 from here: - http://www.python.org/ftp/python/2.6.2/Python-2.6.2.tar.bz2 I unpacked it. I ran these shell commands: - ./configure --prefix=/pt/p - make Near the end of the make output I se

Re: MySQLdb + SSH Tunnel

2009-07-14 Thread R C
Got it working. Thanks for your help 1) login to B 2) setup a tunnel in the shell machine-B> ssh -L B_ip_address:B_port:C_ip_address:C_port u...@c_ip_address for example: machine-B has ip 1.1.1.1 machine-C has ip 2.2.2.2 then I would type: machine-B> ssh -L 1.1.1.1:3307:2.2

Re: zipfile doesn't compress very good, are there other solutions?

2009-06-12 Thread R. David Murray
Chris Rebert wrote: > On Thu, Jun 11, 2009 at 1:41 PM, Stef Mientki wrote: > > Peter Otten wrote: > >> Stef Mientki wrote: > >>> Peter Otten wrote: > Stef Mientki wrote: > > I packed all sources with zipfile, > > but the compression doesn't seem to be very good. > > > >

Am I doing this the python way? (list of lists + file io)

2009-06-08 Thread R. David Murray
your description, I don't see any reason to prefer any alternate data structure. 1000 small CSV files should fit in a modern computer's memory with no problem...and if it does become an issue, worry about it then. One thought, though: you might want to create a list subclass to hold y

Re: pylint naming conventions?

2009-06-08 Thread R. David Murray
; I'm going to go back and re-read PEP 8 and see if I perhaps don't > recall the right guidelines since no one else here seems to have had > the same observation. Well, I for one looked at that long pylint output when I first tried it, and switched to another tool :) (pyflake

problems while using pexpect: pexcept.TIMEOUT always

2009-06-08 Thread R. David Murray
a simple thing as ssh to my localhost.? I would suggest using the 'setlog' method of child to get more debugging information from pexpect. I've found that the best way to diagnose the source of a timeout. -- R. David Murray http://www.bitdance.com IT Consultin

Python preprosessor

2009-06-07 Thread R. David Murray
of Code project to create a 3to2 processor. That would let you maintain the code in 3.x, and have it automatically translated on demand so that it will run under 2.x (where x goes back to at least 5, I think, but I'm not sure). Of course, it isn't finished yet, so it won't do you any

Re: how to transfer my utf8 code saved in a file to gbk code

2009-06-07 Thread R. David Murray
John Machin wrote: > On Jun 8, 12:13 am, "R. David Murray" wrote: > > higer wrote: > > > My file contains such strings : > > > \xe6\x97\xa5\xe6\x9c\x9f\xef\xbc\x9a > > > > If those bytes are what is in the file (and it sounds like they ar

how to transfer my utf8 code saved in a file to gbk code

2009-06-07 Thread R. David Murray
ontent of this file and transfer it to the > corresponding gbk code,a kind of Chinese character encode style. You'll have to convert it from hex-escape into UTF8 first, then. Perhaps better would be to write the original input files in UTF8, since it sounds like that is what you were inten

Re: 4 hundred quadrillonth?

2009-05-21 Thread R. David Murray
Gary Herron wrote: > MRAB wrote: > > Grant Edwards wrote: > >> On 2009-05-21, Christian Heimes wrote: > >>> seanm...@gmail.com schrieb: > The explaination in my introductory Python book is not very > satisfying, and I am hoping someone can explain the following to me: > > >>> 4

idea

2009-05-07 Thread r-w
Redirect sys.stderr to the log file in ANUGA logging. This might catch unexpected exceptions. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why bool( object )?

2009-04-29 Thread r
On Apr 28, 7:22 am, "Colin J. Williams" wrote: > Lie Ryan wrote: > > I'm puzzled by the last sentence: > > *** Python 2.6.2 (r262:71605, Apr 14 > 2009, 22:40:02) [MSC v.1500 32 bit > (Intel)] on win32. *** > > >>> bool(0) > False > >>> bool(-1) > True > >>> bool(-100) > True > > Colin W. What's w

Re: Screenshot of a web page

2009-04-29 Thread r
On Apr 29, 3:49 am, mattia wrote: > Are you aware of any python module that automatically gives you a > screenshot of a web page? PIL comes to mind -- http://mail.python.org/mailman/listinfo/python-list

Re: Pythonic emptiness checking

2009-04-29 Thread r
On Apr 29, 8:37 am, Filip Gruszczyński wrote: > One of the Python Zen rules is Explicit is better implicit. And yet > it's ok to do: > > if x: >    do_sth > > when x is string or list. Since it's very comfy, I've got nothing > against though. I am just curious, why is it so? It also works for num

Re: getting linux distro used...

2009-04-27 Thread r-w
deostroll wrote: Hi, I just found that you could use platform.system() to get the underlying os used. But is there a way to get the distro used...? --deostroll platform.dist() returns ('debian', 'lenny/sid', '') on my Ubuntu box. Ross -- http://mail.python.org/mailman/listinfo/python-list

Re: Supply a plugin interface

2009-04-23 Thread R. David Murray
a variable with the module name (excluding the .py), you can't > use 'import' as it is. Instead, use the __import__ functio (I wonder if > there is anything more elegant) which returns the plugin. In 2.7 and 3.1 there will be: from importlib import import_module myna

http://wwwx.cs.unc.edu/~gb/wp/blog/2007/02/04/python-opencv-wrapper-using-ctypes/

2009-04-17 Thread r-w
http://wwwx.cs.unc.edu/~gb/wp/blog/2007/02/04/python-opencv-wrapper-using-ctypes/ -- http://mail.python.org/mailman/listinfo/python-list

how to know the importing file name from an imported file?

2009-04-17 Thread R. David Murray
pose module C imports module B as well? So, no, not in any useful way. -- R. David Murray http://www.bitdance.com -- http://mail.python.org/mailman/listinfo/python-list

Getting Newsgroup Headers

2009-04-16 Thread R. David Murray
m not going to claim that this is the best code that could be written for this task :) Oh, and there's more involved in actually printing the headers if you need to deal with non-ASCII characters ("encoded words") in the headers. (That's in the docs for the email module, though it

Help with run command + variable.

2009-04-14 Thread R. David Murray
the $varname format you used above). Which you choose depends on how you want to work, but I'd recommend .format() for most things. Except for your os.system call, where I'd recommend using the subprocess module instead, in which case you'd do something like this: call(['sixa', 'action', 'profile', profile]) -- R. David Murray http://www.bitdance.com -- http://mail.python.org/mailman/listinfo/python-list

iPython help, Docstring [source file open failed]

2009-04-14 Thread R. David Murray
at the shell > (as oppose lookup at Python Doc). Can I somehow link the actual Python > source code to iPython so that it can be accessed in that way? Notice that the filetype is '.so'. That means it is a compiled C module, so there is no python source to view. -- R. David Murray

Re: GUI Programming

2009-04-12 Thread r
On Apr 12, 11:04 am, Gabriel wrote: [snip] > > It seems ugly to me.. OK, i shall inform the BDFL of this "inadequacy". Good Luck! -- http://mail.python.org/mailman/listinfo/python-list

Re: GUI Programming

2009-04-12 Thread r
On Apr 12, 8:07 am, Gabriel wrote: > Hello, > > I'm python newbie and i need to write gui for my school work in python. > I need to write it really quick, [snip] Tkinter is built-in, why not start there? from Tkinter import * root = Tk() root.mainloop() -- http://mail.python.org/mailman/lis

xml.dom.minidom getElementsByTagName white space issue

2009-04-09 Thread R. David Murray
I've tried some escape chars but it doesnt seems to work. >   > Does anybody has the escape char sequence I should be using or a work around > for this? Thanks in advanced for your replies. As far as I can tell what you are getting is invalid XML. So I think the answer is &q

communication between objects - help

2009-04-09 Thread R. David Murray
Murali kumar wrote: > hi all.. > > > please see my attached document.. I think you'll get more help if you post in plain text. -- R. David Murray http://www.bitdance.com -- http://mail.python.org/mailman/listinfo/python-list

Re: is there a way to collect twitts with python?

2009-04-08 Thread R. David Murray
's all e-mail to them. Granted the scourge of abbreviated words > and lol-speak is just as bad there. Sigh. lol-speak originated on IRC. (Or probably even earlier on the original bitnet relay chat.) -- R. David Murray http://www.bitdance.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Some test fail on my new Python 2.6

2009-04-08 Thread R. David Murray
. > > Everything is done as root. I got failures (different failures) when I tried running that test as root. You might try running it as a regular user, both before and after the install. > I'll move on with make install. > > Thanks for your help; I'm progressing :-)

Re: Some test fail on my new Python 2.6

2009-04-08 Thread R. David Murray
em (and that means that the test is a little fragile). If you rerun that test in verbose mode without the pipe into tee, does it pass? > The output for individual test_httpservers was posted here: > http://mail.python.org/pipermail/python-list/2009-April/708041.html Hmm. These puzzle me.

Re: genetic algorithms in Python??

2009-04-08 Thread R. David Murray
r of interesting hits. I also remember seeing at least one package announced on python-announce that referred to genetic algorithms, so you might check the archives of that mailing list as well. -- R. David Murray http://www.bitdance.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Some test fail on my new Python 2.6

2009-04-08 Thread R. David Murray
pep277 test_py3kwarn test_scriptpackages > test_socketserver test_sqlite test_startfile test_sunaudiodev > test_tcl test_timeout test_unicode_file test_urllib2net > test_urllibnet test_winreg test_winsound test_zipfile64 These as it implies are all normal. > 3 skips unexpected on linux2: > test_tcl test_dbm test_multiprocessing And these we've covered. So your biggest barrier to getting your python working for your purposes is getting python to find the libtk8.5.so. Everything else you can ignore, unless you want to try to track them down. -- R. David Murray http://www.bitdance.com -- http://mail.python.org/mailman/listinfo/python-list

Re: 3D plotting in a GUI

2009-04-07 Thread R Fritz
I've been doing 3D modeling for lighting simulation and I found two reasonably well-supported solutions: VTK and OpenSceneGraph. VTK generally has a research slant and has what I believe are reasonably strong Python bindings. OSG is closer to VR/AR/Flight Simulation applications and the Pytho

Re: pseudo-code

2009-04-07 Thread r-w
r-w wrote: If no internet connection: if have files: run anyway, with warning else: ERROR else: if error getting hash/files: if have files: run anyway, with warning else: ERROR else: run Sorry, guys. This should

Re: Issue with subprocess Module

2009-04-07 Thread R. David Murray
pected. I know there have been quite > a few changes to the subprocess module between Python 2.5 & 2.6 so > maybe you need to upgrade. (Failing that, we'd have to work a bit > harder to pin down a specific bug in the 2.5 code since 2.5 is now > in bugfix-release mode only, I think). 2.5 is in security-fix-only mode. -- R. David Murray http://www.bitdance.com -- http://mail.python.org/mailman/listinfo/python-list

Re: in place list modification necessary? What's a better idiom?

2009-04-07 Thread R. David Murray
On Tue, 7 Apr 2009 at 09:01, andrew cooke wrote: R. David Murray wrote: [...] try: dimensions.append(float(s)) except: dimensions.append(float(quantization[s])) No, no, no; never use a bare except! :) can you explain why? i can't think of any reason why the code wou

cgi file limit size?

2009-04-07 Thread R. David Murray
right? > maybe my connection to the server is timing out during the upload? > web server is IIS 6.0. > python is 2.5.2. > IIS webmapping does not use "-u" b/c nothing works when that option is > used. What are you using to do the upload? What error message do you g

Re: Some test fail on my new Python 2.6

2009-04-07 Thread R. David Murray
the Skip messages (and any real errors) from the make test run? I can run through them quickly for you then, and then we can focus on the ones that are the real errors. -- R. David Murray http://www.bitdance.com -- http://mail.python.org/mailman/listinfo/python-list

Re: in place list modification necessary? What's a better idiom?

2009-04-07 Thread R. David Murray
t; > # to values when reading keys that don't yet exit > > quantization = defaultdict.collections(itertools.count().next) > > with open(fileName, 'r') as f: > > for line in f: > > dimensions = [] > > for s in li

pseudo-code

2009-04-07 Thread r-w
If no internet connection: if have files: run anyway, with warning else: ERROR else: if error getting hash/files: if have files: run anyway, with warning else: ERROR else: run -- http://mail.python.org/mailman/listinfo

Web validation

2009-04-06 Thread r-w
If no internet connection: if have files: run anyway, with warning else: ERROR else: if error getting hash/files: if have files: run anyway, with warning else: ERROR else: run -- http://mail.python.org/mailman/listinfo

Some test fail on my new Python 2.6

2009-04-06 Thread R. David Murray
Tk [...] > Anybody has a quick fix? Yep. Run 'make test' instead of running them one by one. make test will run them under regrtest, which has mechanisms for detecting tests that are expected to or may reasonably fail on a given platform. Then if you still have errors, report back

Re: print from a python script.

2009-04-06 Thread R. David Murray
e subprocess.Popen instead, that's better). By the way, when you get closer to getting the above to work, you're going to want to add a '\n' to the end of that string you are writing. -- R. David Murray http://www.bitdance.com -- http://mail.python.org/mailman/listinfo/python-list

set python default encoding

2009-04-06 Thread R. David Murray
7;invalid data' > start = 10 > > > Please tell me how to solve this problem. That doesn't look anything like a python traceback. I'm guessing you are using some sort of web framework? Perhaps you should try asking in the forum for the framework. -- R. David Murray http://www.bitdance.com -- http://mail.python.org/mailman/listinfo/python-list

object knows which object called it?

2009-04-06 Thread R. David Murray
does the right thing: def Bfoo_func(self): self.B.foo_func(self) Or maybe you could look at generic methods, which provide a way to do multiple dispatch. -- R. David Murray http://www.bitdance.com -- http://mail.python.org/mailman/listinfo/python-list

Re: New super python vm

2009-04-01 Thread r
On Apr 1, 1:55 pm, El Loco wrote: > Hi all, > > This is to announce that right after a few weeks after our first > coding sprint, > our project, "Unswallowed-snot", has already achieved substantial > results. > In our tests, runtime performance shows a 150x slowdown. > This is due mainly to our le

Re: league problem in python

2009-04-01 Thread r
On Apr 1, 12:35 pm, Ross wrote: [snip] > How should I go about starting this problem...I'm feel like this is a > really simple problem, but I'm having writer's/coder's block. Can you > guys help? Ross, I highly disagree with bear on this. What you have here is a 90 percent math problem and a 10 p

Re: The spam to content ratio of this group

2009-04-01 Thread r
On Apr 1, 9:57 am, Grant Edwards wrote: > On 2009-04-01, Eric wrote: > 3) Simply ignoring all posts made from Google Groups works >    quite well. Yea, there's no spam in Usenet land APRIL FOOLS -- http://mail.python.org/mailman/listinfo/python-list

comtypes CreateObject problem

2009-04-01 Thread Maria R
We get the following, less favourable respons :o( Any advice is greatly appreciated!! Setting is python 2.5.2, windows xp professional SP3, SolidEdge V20 SP10 We have success with comtypes interfacing other software like SmarTeam (PDM/PLM software) and of course Excel and alike. Thnx IDLE 1.2.2

Re: How complex is complex?

2009-03-28 Thread r
On Mar 18, 12:30 pm, Kottiyath wrote: > When we say readability counts over complexity, how do we define what > level of complexity is ok? [snip= mommie can i go out an play?] > How do we decide whether a level of complexity is Ok or not? Hmm? How did you know what shoes to put on this morning

Re: complaints about no replies last week

2009-03-28 Thread r
On Mar 28, 10:07 am, Aaron Brady wrote: > Hi, > > A week ago, I posted a question and an idea about Python's garbage > collector.  I got a few replies.  Some days later, I posted a mock-up > implementation of it, and got *NO* replies.  Does this mean: > > a) It works > b) It doesn't work > c) It's

Re: split string at commas respecting quotes when string not in csv format

2009-03-26 Thread R. David Murray
Paul McGuire wrote: > On Mar 26, 2:51 pm, "R. David Murray" wrote: > > OK, I've got a little problem that I'd like to ask the assembled minds > > for help with.  I can write code to parse this, but I'm thinking it may > > be possible to do it with

Re: split string at commas respecting quotes when string not in csv format

2009-03-26 Thread R. David Murray
John Machin wrote: > On Mar 27, 6:51 am, "R. David Murray" wrote: > > OK, I've got a little problem that I'd like to ask the assembled minds > > for help with.  I can write code to parse this, but I'm thinking it may > > be possible to do it with

Re: split string at commas respecting quotes when string not in csv format

2009-03-26 Thread R. David Murray
Tim Chase wrote: > r = re.compile(r""" > (\w+) > \s*=\s*( > "(?:[^"]*)" > | > [^,]+ > ) > """, re.VERBOSE) >results = [ > (m.group(1), m.group(2).strip('"'))

split string at commas respecting quotes when string not in csv format

2009-03-26 Thread R. David Murray
ggestion) I would be greatful. (This has to be stdlib only, by the way, I can't introduce any new modules into the application so pyparsing is not an option.) The challenge is to turn a string like this: a=1,b="0234,)#($)@", k="7" into this: [("a", &quo

Issue Compiling on Aix 5.3

2009-03-26 Thread James R. Emerson
I am trying to compile Python on Aix 5.3. I have used the following options as per the README file: export PATH=/usr/bin:/usr/vacpp/bin ./configure --with-gcc="xlc_r -q64" --with-cxx="xlC_r -q64" \ --disable-ipv6 AR="ar -X64" When I run make I receive the following error: bu

Re: fft of a dat file?

2009-03-25 Thread R. David Murray
which has lines like this:- > >\r\n > > i need to isolate the sampled values and put them into an array. Maybe something like: samples = [] with open('myfile') as f: for line in f: time, value = line.strip().split() samples.append([float(time), float(value

user site-packages, --prefix, --home and friends

2009-03-24 Thread R. David Murray
and handling of .pth files. As for best practice, I would say whichever one meets your needs. The PEP is addressing the needs of users who do not have root privs but who want to install packages via distutils in such a way that they will act as if they had been installed in the system site-packag

Re: Relative Imports, why the hell is it so hard?

2009-03-24 Thread R. David Murray
e, and you've told us that you have '50 modules' with a lot of shared code that 'could be used across other projects', perhaps you see why relative imports are generally discouraged. If you use only relative imports, the code _can't_ be shared across multiple p

Re: file.read() doesn't read the whole file

2009-03-24 Thread R. David Murray
tart logging everything I could (take a look at Python's 'logging' module to help you make that easy), and twidling things. What happens if you change what gets returned to lstat? What happens for various sizes and contents of the '0' file? What happens if you use 'cat -v

importing modules from alternate path

2009-03-24 Thread R. David Murray
> Any idea why alternate path is not working? Possibly because the package gets installed into ~/lib/python, but you haven't put that directory onto the PYTHONPATH. -- R. David Murray http://www.bitdance.com -- http://mail.python.org/mailman/listinfo/python-list

Re: script files with python (instead of tcsh/bash)?

2009-03-23 Thread R. David Murray
e will be closed at program termination anyway, but is a good habit to get in to.) -- R. David Murray http://www.bitdance.com -- http://mail.python.org/mailman/listinfo/python-list

udp package header

2009-03-23 Thread R. David Murray
mete wrote: > Hi all, > I got a problem. İ want to send udp package and get this package (server and > clinet ). it's easy to python but i want to look the udp header how can i > do ? The English word is 'packet'. If you are on Linux you can use raw sockets fo

Re: file.read() doesn't read the whole file

2009-03-23 Thread R. David Murray
/gfs_local/') > > snap = open('mango.txt_snaps/snap1/0','r') > > snap.seek(offset) > > data = snap.read(length) > > print data > > > > read(4096,0) > > > > This code shows what actually happens inside the code

Re: Generator

2009-03-23 Thread R. David Murray
impler statement works, too: > >g = iter(s[:]) Yes, but one presumes that in the real code that prompted the OP's question he wasn't just returning 'x'. -- R. David Murray http://www.bitdance.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Lambda forms and scoping

2009-03-23 Thread R. David Murray
losure is a "read-only closure". But now with Python 3.x we can really have fun (thank you for that info): >>> def g(): ... def a(x): ... nonlocal z ... z = z + x ... def b(x): ... nonlocal z ... z = z - x ... def p()

Re: file.read() doesn't read the whole file

2009-03-23 Thread R. David Murray
Sreejith K wrote: > > Try and write an example that shows the problem in fifteen lines or > > less. Much easier for us to focus on the issue that way. > > import os > def read(length, offset): > os.chdir('/mnt/gfs_local/') > sna

Re: safely rename a method with a decorator

2009-03-22 Thread R. David Murray
is that I'm writing a turbogears application in which the > URLs are determined by the method names. People might want to change > these names if they want to change the URLs. One way would be to put > the method names into a turbogears configuration file and the @rename > decorator could fetch it from there. Use a WSGI routing engine instead. -- R. David Murray http://www.bitdance.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Generator

2009-03-22 Thread R. David Murray
mattia wrote: > Il Sun, 22 Mar 2009 16:52:02 +0000, R. David Murray ha scritto: > > > mattia wrote: > >> Can you explain me this behaviour: > >> > >> >>> s = [1,2,3,4,5] > >> >>> g = (x for x in s) > >> >>> ne

loading program's global variables in ipython

2009-03-22 Thread R. David Murray
and myglobal2 are not imported into > python's interactive namespace. i'd like them too -- how can i do > this? > > (note my file does not contain a __name__ == '__main__' clause.) I'm not familiar with IPython, but perhaps 'from myfile import *

Re: python 3, subclassing TextIOWrapper.

2009-03-22 Thread R. David Murray
"Gabriel Genellina" wrote: > En Sun, 22 Mar 2009 15:11:37 -0300, R. David Murray > escribió: > > "Gabriel Genellina" wrote: > >> En Sat, 21 Mar 2009 23:58:07 -0300, escribió: > >> > > >> > class file(io.TextIOWrapper): > &

Re: Lambda forms and scoping

2009-03-22 Thread R. David Murray
names point to in its local and global namespaces, but cannot modify what names point to in the closure namespace. Of course, we can produce the same _effect_ as a computer science closure in Python by using mutable objects...which is exactly parallel to the difference between passing mutable or immutable objects in a function call. -- R. David Murray http://www.bitdance.com -- http://mail.python.org/mailman/listinfo/python-list

Re: python 3, subclassing TextIOWrapper.

2009-03-22 Thread R. David Murray
tion that would yield such an open function that otherwise is identical to the default open. What's the standard python idiom for when consumer code should be able to specialize the classes used to create objects returned from a called package? (I'm tempted to say monkey patching the module, but that can't be optimal :) -- R. David Murray http://www.bitdance.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Using python 3 for scripting?

2009-03-22 Thread R. David Murray
cases I _do_ have to support a number of servers that are still running 2.5 :( -- R. David Murray http://www.bitdance.com -- http://mail.python.org/mailman/listinfo/python-list

Generator

2009-03-22 Thread R. David Murray
you want next(g) to yield 3, you'd have to do something like: g = (x for x in s[:]) where s[:] makes a copy of s that is then iterated over. -- R. David Murray http://www.bitdance.com -- http://mail.python.org/mailman/listinfo/python-list

Using python 3 for scripting?

2009-03-22 Thread R. David Murray
lmost out the door and that fixes the I/O performance issue. -- R. David Murray http://www.bitdance.com -- http://mail.python.org/mailman/listinfo/python-list

Script for a project inside own directory

2009-03-22 Thread R. David Murray
works in python (PYTHONPATH, sys.path) so that you can decide which of the many possible ways to make this work will serve you best. -- R. David Murray http://www.bitdance.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Preparing teaching materials

2009-03-21 Thread R. David Murray
badly indeed if your handouts > and computers don't make the same assumptions! Print as function can be used in 2.6+ via 'from __future__ import print_function'. So it is probably best to teach print-as-function regardless. -- R. David Murray http://www.bitdance.com -- http://mail.python.org/mailman/listinfo/python-list

Re: How complex is complex?

2009-03-20 Thread R. David Murray
k back further at the post which they were commenting on. Those two lines do not constitute consecutive lines of code, they are individual replacements for individual lines in two different previous examples, one of which updates the dict in place and the other of which creates a new dict. I thin

Re: file.read() doesn't read the whole file

2009-03-20 Thread R. David Murray
7;t read the whole file? You didn't log it. Both your statements might be true, but until you show the logging output proving it, you don't _know_ that your assumptions are true. -- R. David Murray http://www.bitdance.com -- http://mail.python.org/mailman/listinfo/python-list

Re: file.read() doesn't read the whole file

2009-03-20 Thread R. David Murray
On Fri, 20 Mar 2009 at 07:09, Sreejith K wrote: On Mar 20, 4:43?pm, "R. David Murray" wrote: Sreejith K wrote: Hi, snapdir = './mango.txt_snaps' snap_cnt = 1 block = 0 import os os.chdir('/mnt/gfs_local') snap = open(snapdir + '/snap%s/%s' % (rep

<    1   2   3   4   5   6   7   8   9   10   >