Re: Returning a value from code string

2006-01-29 Thread Steven D'Aprano
Fried Egg wrote: >>From above: > > I hope the contents of the database are trusted, because if the code is > coming from an untrusted source, well, U R pwn3d. > > Seems like you are jumping through a lot of hoops for very little > benefit. > What am I missing? > > > > Why does anyone care abo

Re: A class with eventhandlers ?

2006-01-29 Thread Farshid Lashkari
It's definitely possible, here's a small example. There are probably better ways to do it, but I'll let you figure that out ;) class ErrorHandler: def __init__(self,method): self.method = method self.errorHook = None def onError(sel

Re: Python module for LX200 telescope command set

2006-01-29 Thread Robert Kern
RayS wrote: > Whatever happened to the astropy list? http://www.scipy.net/mailman/listinfo/astropy -- Robert Kern [EMAIL PROTECTED] "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter -- http://mail.python.org/mailman/listinfo/pyth

Re: Python loading library containing embedded python...

2006-01-29 Thread Martin v. Löwis
Alex Martelli wrote: > I believe the python core developers who do develop on Windows have not > even tried VS 2005 and have no intention of so doing for the foreseeable > future. That is not true. I have already tried it. Many others did, too, and found that Microsoft managed to break ISO C comp

Re: Python module for LX200 telescope command set

2006-01-29 Thread RayS
At 06:55 PM 1/29/2006, you wrote: >Subject: Re: Python module for LX200 telescope command set >Message: 9 > >On Sun, 29 Jan 2006 15:25:43 -0800, RayS <[EMAIL PROTECTED]> declaimed >the following in comp.lang.python: > > > I've begun a Python module to provide a complete interface to the Meade > >

Re: Python loading library containing embedded python...

2006-01-29 Thread Martin v. Löwis
Brennus wrote: > I compiled pythoncore.lib. I statically link this to my dll > and define Py_BUILD_CORE before including Python.h. Can you please elaborate? How did you do this? How do you know pythoncore.lib is a static library? What msvcrt is it linked with (use depends.exe to find out)? > The

Re: Python loading library containing embedded python...

2006-01-29 Thread Martin v. Löwis
Brennus wrote: > I have solved my problem, or at least part of it by downgrading > to Visual Studio 2003. For whatever reason, the same steps applied > to Visual Studio 2005 result in massive problems. > > Even the python.exe compiled by VS 2005 throws A/Vs on startup. > > Does Python have to use

Re: StringIO proposal: add __iadd__

2006-01-29 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > Not really: <<'s point is to allow chaining, f< no such "advantage" (or disadvantage, as the case may be). Hmm, ok. I've always found << repulsive in that context though, so won't suggest it for Python. -- http://mail.python.org/mailman/listinfo/pyth

Re: Authenticating to Kerberos

2006-01-29 Thread Martin v. Löwis
David wrote: > I don't need to do anything except authenticate and gain the correct > credentials. I normally run kinit(1) to determine whether a password is correct. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: python success story

2006-01-29 Thread Alex Martelli
Max M. Stalnaker <[EMAIL PROTECTED]> wrote: > I urged a friend from Boeing to use python on a personal project. He liked it > and repeatedly urged a Boeing developer to use it. Python is on the list of > approved languages at Boeing. The developer wrote a thousand line enterprise > level progra

Re: StringIO proposal: add __iadd__

2006-01-29 Thread Alex Martelli
Paul Rubin wrote: > And is making += a synonym for write() on other file objects really > that bad an idea? It would be like C++'s use of << for file objects > and could make some code nicer if you like that kind of thing. Not really: <<'s point is to allow chaining, f

Re: Python vs C for a mail server

2006-01-29 Thread Alex Martelli
Donn Cave <[EMAIL PROTECTED]> wrote: > Quoth [EMAIL PROTECTED] (Alex Martelli): > | ... Therefore, > | if the inability to verify that a function named 'foobar' is in fact > | never called anywhere is a weakness, it's a weakness shared by all of > | these languages. The originator of this thread

Re: StringIO proposal: add __iadd__

2006-01-29 Thread Paul Rubin
"Raymond Hettinger" <[EMAIL PROTECTED]> writes: > The StringIO API needs to closely mirror the file object API. > Do you want to change everything that is filelike to have += > as a synonym for write()? Why would they need that? StringIO objects have getvalue() but other file-like objects don't.

Re: stumped by tricky logic

2006-01-29 Thread Paul McGuire
"Dave" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > So I'm trying to write a CSS preprocessor. > > I want to add the ability to append a selector onto other selectors. > So, given the following code: > = > #selector { > >

Re: Concerning Regular Expressions

2006-01-29 Thread Alex Martelli
Tempo <[EMAIL PROTECTED]> wrote: > You are right that my move towards regular expressions was way > premature, but also this post may too turn out to be a little > premature. I guessed and checked myself a way to accomplish what I > needed and I will include it in this post. But first Alex (doesn'

Mouse manipulation

2006-01-29 Thread arkestra
I am writing a script that interacts with the computer screen. Is there a module (either built in or add on) that would allow the script to manipulate the mouse pointer ? -- eg right click, move two pixels to the right, left click etc? thank you. -- http://mail.python.org/mailman/listinfo/pytho

Re: Sql Parser

2006-01-29 Thread Alex Martelli
Sergey Eizner <[EMAIL PROTECTED]> wrote: > Does anybody know python module for sql parsing? has one. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: A class with eventhandlers ?

2006-01-29 Thread Alex Martelli
Runsun Pan <[EMAIL PROTECTED]> wrote: ... > or, more specific, a function/method-specific error > handling feature: > > c.load.onError( IOErrorHook) > c.load( filename ) > > Is there such a mechnism around? If not, is it possible > to make such a thing ? Never heard of one, but you could sure

Re: Python loading library containing embedded python...

2006-01-29 Thread Alex Martelli
Brennus <[EMAIL PROTECTED]> wrote: ... > I have solved my problem, or at least part of it by downgrading > to Visual Studio 2003. For whatever reason, the same steps applied > to Visual Studio 2005 result in massive problems. > > Even the python.exe compiled by VS 2005 throws A/Vs on startup.

Re: Concerning Regular Expressions

2006-01-29 Thread Tempo
You are right that my move towards regular expressions was way premature, but also this post may too turn out to be a little premature. I guessed and checked myself a way to accomplish what I needed and I will include it in this post. But first Alex (doesn't have to be Alex) could you tell me if yo

Re: Python vs C for a mail server

2006-01-29 Thread Donn Cave
Quoth [EMAIL PROTECTED] (Alex Martelli): | ... Therefore, | if the inability to verify that a function named 'foobar' is in fact | never called anywhere is a weakness, it's a weakness shared by all of | these languages. The originator of this thread appeared to assume that | it was a weakness of

Re: Concerning Regular Expressions

2006-01-29 Thread Terry Reedy
"Tempo" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Whoops. I've got another tid-bit to tack onto this post. What kind of > value does this expression return: > > re.sub(r'^R0 -', line) > > > Does it return a '1' if successful and a '0' if not successful? Start up an interactiv

Re: instance references?

2006-01-29 Thread Alex Martelli
bytecolor <[EMAIL PROTECTED]> wrote: > Thanks Alex, the weak references *seem* to be doing what I want for > now. > > In each __init__() I use: > aptbase.drawables.append(weakref.ref(self)) > > Then in show(): > for d in aptbase.drawables: > o = d() > if o is not None: > # render

Re: Concerning Regular Expressions

2006-01-29 Thread Alex Martelli
Tempo <[EMAIL PROTECTED]> wrote: > I've been reading a bunch of articles and tutorials on the net, but I > cannot quite get ahold of the whole regular expression process. I have > a list that contains about thirty strings, each in its own spot in the > list. What I want to do is search the list, s

Re: Python vs C for a mail server

2006-01-29 Thread Donn Cave
Quoth [EMAIL PROTECTED] (Alex Martelli): | Jens Theisen <[EMAIL PROTECTED]> wrote: ... |> What do you do when you want to no if a certain method or function is |> actually used from somewhere, say "foobar", it a language which allows |> (and even encourages) that it could be called by: |> |> getat

Re: Trouble opening files

2006-01-29 Thread Tim Roberts
"Westbrook, Christopher L (WESTBCL04)" <[EMAIL PROTECTED]> wrote: > >I am having some trouble, and I can't figure out why. ... >form = cgi.FieldStorage() >print "Content-type:text/html\n\n"; >filename = form["file"].value+".txt" #all files end in .txt extension > >filename = filename.replace("\

Re: Concerning Regular Expressions

2006-01-29 Thread Tempo
Whoops. I've got another tid-bit to tack onto this post. What kind of value does this expression return: re.sub(r'^R0 -', line) Does it return a '1' if successful and a '0' if not successful? -- http://mail.python.org/mailman/listinfo/python-list

Concerning Regular Expressions

2006-01-29 Thread Tempo
I've been reading a bunch of articles and tutorials on the net, but I cannot quite get ahold of the whole regular expression process. I have a list that contains about thirty strings, each in its own spot in the list. What I want to do is search the list, say it's called 'lines', for 'R0 -'. Thank

Re: URL Character Decoding

2006-01-29 Thread Kirk McDonald
Paul McGuire wrote: > "Kirk McDonald" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>If you have a link such as, e.g.: >> >>Main menu! >> >>The space will be translated to the character code '%20' when you later >>retrieve the GET data. >> >>I guess what I'm asking is: Is there

Re: URL Character Decoding

2006-01-29 Thread Paul McGuire
"Kirk McDonald" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If you have a link such as, e.g.: > > Main menu! > > The space will be translated to the character code '%20' when you later > retrieve the GET data. > > I guess what I'm asking is: Is there a library function (in Python

Re: webbrowser module + urls ending in .py = a security hole?

2006-01-29 Thread Blair P. Houghton
Oh, uh, Python version 2.4.2, in case you're wondering. --Blair -- http://mail.python.org/mailman/listinfo/python-list

webbrowser module + urls ending in .py = a security hole?

2006-01-29 Thread Blair P. Houghton
I'm just learning Python, so bear with. I was messing around with the webbrowser module and decided it was pretty cool to have the browser open a URL from within a python script, so I wrote a short script to open a local file the same way, using the script file as an example target: # browser-tes

Re: batch tiff to jpeg conversion script

2006-01-29 Thread William Park
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hope it's not inappropriate to post this here. > > Could someone critique my code? I have no Python programmers in my > office to show this to. The script works OK, but should I do it > differently? I especially don't like how I check to see if jpegs

Re: URL Character Decoding

2006-01-29 Thread Kirk McDonald
Kirk McDonald wrote: > Actually, I just noticed this doesn't really work at all. The URL > character codes are in hex, so not only does the regex not match what it > should, but sub_func fails miserably. See why I wanted a library function? > > -Kirk McDonald Not to keep talking to myself, but

Re: Python loading library containing embedded python...

2006-01-29 Thread Brennus
>I have a dll/so which embeds python. I can verify it works by >compiling it as an executable and adding an appropriate main. > >I tried to write unit tests for this library with ctypes and a simple >python script. Access violations and other strange things result. I >suspect this is because I am

Re: URL Character Decoding

2006-01-29 Thread Kirk McDonald
Kirk McDonald wrote: > If you have a link such as, e.g.: > > Main menu! > > The space will be translated to the character code '%20' when you later > retrieve the GET data. Not knowing if there was a library function that > would convert these back to their actual characters, I've written the

Re: StringIO proposal: add __iadd__

2006-01-29 Thread Raymond Hettinger
[Paul Rubin] > here, "temp_buf += v" is supposed to be the same as "temp_buf.write(v)". > So the suggestion is to add a __iadd__ method to StringIO and cStringIO. > > Any thoughts? The StringIO API needs to closely mirror the file object API. Do you want to change everything that is filelike to ha

URL Character Decoding

2006-01-29 Thread Kirk McDonald
If you have a link such as, e.g.: Main menu! The space will be translated to the character code '%20' when you later retrieve the GET data. Not knowing if there was a library function that would convert these back to their actual characters, I've written the following: import re def sub_func

A class with eventhandlers ?

2006-01-29 Thread Runsun Pan
Is it possible to code a class that raise exception automatically when an error occurs? We usually use try-except pair at where we expect an error might occur. What am thinking is a class that has built in error handling so we can do this: c=MyClass() c.onError = some_hook or c.onError('IndexEr

Re: Python module for LX200 telescope command set

2006-01-29 Thread Terry Hancock
On Sun, 29 Jan 2006 15:25:43 -0800 RayS <[EMAIL PROTECTED]> wrote: (about LX200 module) Sounds interesting, but I don't actually know what an LX200 is. I considered buying one of the Meade computer controlled telescopes (there is a very inexpensive one that has been marketed through Walmart. Ordin

Re: Sql Parser

2006-01-29 Thread raviteja . bhupatiraju
You could use PyParsing. http://pyparsing.sourceforge.net/ People don't normally parse SQL unless they are building a query engine itself. Perhaps it is something else that you want? Could you elaborate the task? -- http://mail.python.org/mailman/listinfo/python-list

python success story

2006-01-29 Thread Max M. Stalnaker
I urged a friend from Boeing to use python on a personal project. He liked it and repeatedly urged a Boeing developer to use it. Python is on the list of approved languages at Boeing. The developer wrote a thousand line enterprise level program in Python. He reports that it would have take t

Re: Print dict in sorted order

2006-01-29 Thread Michael Spencer
Raymond Hettinger wrote: >> from itertools import count, izip >> >> def dict2str(d, preferred_order = ['gid', 'type', 'parent', 'name']): >> last = len(preferred_order) >> rank = dict(izip(preferred_order, count())) >> pairs = d.items() >> pairs.sort(key=lambda (k,v): rank.get(k, (l

Re: beta.python.org content

2006-01-29 Thread Paul Rubin
Terry Hancock <[EMAIL PROTECTED]> writes: > Of course, in the original concept, the interviewer is the > straight man asking Allen's character about the "obviously" > esoteric and high-tech field of computers for which someone > like him is "obviously" not qualified. His statement that > his Aunt

Re: StringIO proposal: add __iadd__

2006-01-29 Thread Paul Rubin
Paul Rubin writes: > etc., probably not worth the trouble. Based on examining StringIO.py, > on my current computer (512MB ram), with 100 million items, it looks Better make that 200 million. -- http://mail.python.org/mailman/listinfo/python-list

Re: beta.python.org content

2006-01-29 Thread Terry Hancock
On Sat, 28 Jan 2006 09:47:20 -0800 Scott David Daniels <[EMAIL PROTECTED]> wrote: > Terry Hancock wrote: > > On Fri, 27 Jan 2006 13:44:19 -0800 > > Scott David Daniels <[EMAIL PROTECTED]> wrote: > >> Paragraph 3 in "Why Python": > >> and later in that paragraph, I'd change: > >> ... extensions

Re: StringIO proposal: add __iadd__

2006-01-29 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > > That depends on how much ram you have. You could try a billion items. > Let's see you try it If you want me to try timing it with a billion items on your computer, you'd have to set up a suitable account and open a network connection, etc., probably n

Re: Server side newbie

2006-01-29 Thread John M. Gabriele
swisscheese wrote: > I have a simple python desktop app with several edit controls and a > couple of buttons. It just does some math. What's the simplest way to > make it a server-side app so visitors to my site can run the app via > their browser? > The *simplest* way is to make it into a CGI sc

Re: Using non-ascii symbols

2006-01-29 Thread Terry Hancock
On Fri, 27 Jan 2006 23:57:16 -0600 Runsun Pan <[EMAIL PROTECTED]> wrote: > But ... to my knowledge, all of the input tablets that > using OCR has a training feature. You can teach the > program to recognize your own order of strokes. The > ability to train (be trained) is a very key element of > su

Re: Print dict in sorted order

2006-01-29 Thread Raymond Hettinger
> from itertools import count, izip > > def dict2str(d, preferred_order = ['gid', 'type', 'parent', 'name']): > last = len(preferred_order) > rank = dict(izip(preferred_order, count())) > pairs = d.items() > pairs.sort(key=lambda (k,v): rank.get(k, (last, k, v))) > return '{%s}'

Re: Print dict in sorted order

2006-01-29 Thread Raymond Hettinger
[Kamilche] > I have a code snippet here that prints a dict in an arbitrary order. > (Certain keys first, with rest appearing in sorted order). I didn't > want to subclass dict, that's error-prone, and overkill for my needs. I > just need something that returns a value like dict.__str__, with a key

Sql Parser

2006-01-29 Thread Sergey Eizner
Does anybody know python module for sql parsing? -- http://mail.python.org/mailman/listinfo/python-list

Re: instance references?

2006-01-29 Thread bytecolor
Thanks Alex, the weak references *seem* to be doing what I want for now. In each __init__() I use: aptbase.drawables.append(weakref.ref(self)) Then in show(): for d in aptbase.drawables: o = d() if o is not None: # render it -- bytecolor -- http://mail.python.org/mailman/listi

Re: Help saving output onto a text file

2006-01-29 Thread [EMAIL PROTECTED]
I tried using the sys.stdout method and it worked. It seems pretty simple but I dont understand the simple method you posted. Thanks for the help, I'll mess around with it and keep on learning. -- http://mail.python.org/mailman/listinfo/python-list

Re: StringIO proposal: add __iadd__

2006-01-29 Thread Paul Rubin
Paul Rubin writes: > > After all, how do you think StringIO is implemented internally? A list > > of strings and a ''.join at the end are the best way that comes to mind, > > I'd have used the array module. I just checked the implementation and it uses ''.join combined

Re: StringIO proposal: add __iadd__

2006-01-29 Thread Alex Martelli
Paul Rubin wrote: ... > > Absolutely wrong: ''.join takes less for a million items than StringIO > > takes for 100,000. > > That depends on how much ram you have. You could try a billion items. Let's see you try it -- I have better things to do than to trash aroun

Re: Storing lines from a text file

2006-01-29 Thread bradfordh
Whoops. I figured it out. Thanks for everybody's help. -- http://mail.python.org/mailman/listinfo/python-list

Re: Language Semantics: @ symbol??

2006-01-29 Thread James Stroud
Brennus wrote: > "Enigma Curry" <[EMAIL PROTECTED]> wrote: > > >>Sorry, for the noob question, but I haven't been able to find >>documentation on this matter. >> >>I've been looking for documentation that describes what the @function() >>syntax is all about. > > > http://www.google.com/search?q

Re: Storing lines from a text file

2006-01-29 Thread bradfordh
Alright now that I know how to read the text file line by line, my question is almost answered completely. And before I ask anything else I want to say thanks for the help recieved already. Well the last thing I need help on is storing each line into one big list. Each line needs to have its own p

Re: Help saving output onto a text file

2006-01-29 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > If I have a simple program that for example calculates > the squares of 2 to 100 times, how can I write the resulting output > onto a separate text file? > > I know about the open() function and I can write strings and such in > text files but I'm not able to write the o

Cheetah template driven object output? Pythonically?

2006-01-29 Thread Fried Egg
This may be trivial or stupid or both, but does anyone have a recipe for gracefully using Cheetah to generate a text representation of an object, but embedded in the object (so that it can be pickled, unpickled, and told to display itself)? Here is what I am thinking: import Cheetah.Template as

Re: Python vs C for a mail server

2006-01-29 Thread Paul Boddie
Jay Parlar wrote: [...] > >> getattr(obj "foo" + "bar")(). [...vs...] > > meth = getattr(self.visitor, 'visit' + className, 0) [...] > I don't think you understood my assertion, then. The example that the > original poster gave was using getattr() with a simple string ("foo" + > "bar") for th

Python module for LX200 telescope command set

2006-01-29 Thread RayS
I've begun a Python module to provide a complete interface to the Meade LX200 command set: http://rjs.org/Python/LX200.py and would like input from potential users or people interested in developing it further. The code I have online is a very alpha start - it contains all of the command set, pa

Re: StringIO proposal: add __iadd__

2006-01-29 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > Absolutely wrong: ''.join takes less for a million items than StringIO > takes for 100,000. That depends on how much ram you have. You could try a billion items. > It's _so_ easy to measure...! Yes but the result depends on your specific hardware a

Re: Python vs C for a mail server

2006-01-29 Thread Alex Martelli
Paul Boddie <[EMAIL PROTECTED]> wrote: ... > The context was whether you can know before running the program whether > the function you're attempting to call exists, along with where it is > defined. Obviously, it's a struggle to think of cases where one would > do this for the sake of it (espec

Re: Storing lines from a text file

2006-01-29 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > I keep getting an error when I try to use what you said Mr. McDonald. I > think I've got something wrong, but take a look if you can. > > log = open('C:\log_0.txt') > lines = log.getlines() > for line in lines: > print line > > When I debug it the error I get i

Re: Storing lines from a text file

2006-01-29 Thread Kirk McDonald
[EMAIL PROTECTED] wrote: > I keep getting an error when I try to use what you said Mr. McDonald. I > think I've got something wrong, but take a look if you can. > > log = open('C:\log_0.txt') > lines = log.getlines() > for line in lines: > print line > > When I debug it the error I get is t

Re: StringIO proposal: add __iadd__

2006-01-29 Thread Alex Martelli
Paul Rubin wrote: ... > ''.join with a list (rather than a generator) arg may be plain worse > than python StringIO. Imagine building up a megabyte string one > character at a time, which means making a million-element list and a > million temporary one-character stri

Re: Python vs C for a mail server

2006-01-29 Thread Paul Boddie
Fredrik Lundh wrote: > Paul Boddie wrote: > [Quoting Jay Parlar...] > > > I don't think I've ever seen anyone advocating calling a function like > > > getattr(obj "foo" + "bar")(). > > > > >From Lib/compiler/visitor.py: > > > > meth = getattr(self.visitor, 'visit' + className, 0) > > > > Later on

Re: Storing lines from a text file

2006-01-29 Thread bradfordh
I keep getting an error when I try to use what you said Mr. McDonald. I think I've got something wrong, but take a look if you can. log = open('C:\log_0.txt') lines = log.getlines() for line in lines: print line When I debug it the error I get is the following: AttributeError: 'file'

Re: instance references?

2006-01-29 Thread Alex Martelli
bytecolor <[EMAIL PROTECTED]> wrote: ... > So how can I tell if an instance of point, line or circle has actually > been assigned to a variable? You can't really distinguish whether an object has been assigned to a variable, an item in a list, an attribute, etc etc -- all of these assignments a

Re: StringIO proposal: add __iadd__

2006-01-29 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > > Is there some sound reason cStringIO acts differently from > > StringIO? I'd expect them to both do the same thing. > > I believe that cStringIO tries to optimize, while StringIO doesn't and > is thereby more general. I'm not sure what optimizations

Re: Language Semantics: @ symbol??

2006-01-29 Thread Alex Martelli
Enigma Curry <[EMAIL PROTECTED]> wrote: ... > @somefunction() > def a_newfunction(): > > > What does it mean and what does it do? It means and does exactly the same thing as having a_newfunction = somefunction()(a_newfunction) right after the end of a_newfunction's body.

Re: Python vs C for a mail server

2006-01-29 Thread Alex Martelli
Jay Parlar <[EMAIL PROTECTED]> wrote: ... > >> From Lib/compiler/visitor.py: > > > > meth = getattr(self.visitor, 'visit' + className, 0) ... > I even said you can do some "very powerful things" with getattr, by > which I meant something exactly like you did. What did you think I > meant by

Help saving output onto a text file

2006-01-29 Thread [EMAIL PROTECTED]
I have been learning python during the past weeks and I have been able to program some interesting things. Python is my first and only programing language from which I wish to enter the programing world. My question was: if I have a simple program that for example calculates the squares of 2 to 10

Re: Language Semantics: @ symbol??

2006-01-29 Thread Enigma Curry
Awesome! Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Python module for Meade LX200 command set

2006-01-29 Thread RJS
I've begun a Python module to provide a complete interface to the Meade LX200 command set: http://rjs.org/Python/LX200.py and would like input from potential users or people interested in developing it further. The code I have online is a very alpha start - it contains all of the command set, pa

Re: Language Semantics: @ symbol??

2006-01-29 Thread Brennus
"Enigma Curry" <[EMAIL PROTECTED]> wrote: >Sorry, for the noob question, but I haven't been able to find >documentation on this matter. > >I've been looking for documentation that describes what the @function() >syntax is all about. http://www.google.com/search?q=python+decorators -- http://mail

ANN: Rur-ple lessons 0.36

2006-01-29 Thread André
Announcing RUR-PLE lessons 0.36 RUR-PLE stands for Roberge's Used Robot: a Python Learning Environment. This is the first official release of the lessons, separately from the application. The lessons are intended as a somewhat non-typical introduction to programming using Python, that has been u

Re: Storing lines from a text file

2006-01-29 Thread Kirk McDonald
[EMAIL PROTECTED] wrote: > With what kind of list? I don't see how I can do it with a list unless > I create one indefinate list and use the objects in the indefinate list > for the names of the lists to hold the lines of text. Is that how you > are suggesting that I do it? > You're thinking too

Re: Language Semantics: @ symbol??

2006-01-29 Thread Jay Parlar
Enigma Curry wrote: > > > Sorry, for the noob question, but I haven't been able to find > documentation on this matter. > > I've been looking for documentation that describes what the @function() > syntax is all about. > > I've seen this on a few pages, for instance: > > http://aspn.activestate.co

Re: Storing lines from a text file

2006-01-29 Thread bradfordh
With what kind of list? I don't see how I can do it with a list unless I create one indefinate list and use the objects in the indefinate list for the names of the lists to hold the lines of text. Is that how you are suggesting that I do it? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python loading library containing embedded python...

2006-01-29 Thread Brennus
Martin v. Löwis wrote: >Brennus wrote: >> I have a dll/so which embeds python. I can verify it works by >> compiling it as an executable and adding an appropriate main. > >Please explain in more detail how you did the embedding. Did you >statically link the Python interpreter into your dll/so, or

Language Semantics: @ symbol??

2006-01-29 Thread Enigma Curry
Sorry, for the noob question, but I haven't been able to find documentation on this matter. I've been looking for documentation that describes what the @function() syntax is all about. I've seen this on a few pages, for instance: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/307871 an

instance references?

2006-01-29 Thread bytecolor
I'm working on a simple graphics package. I've got a function show() that the user needs to call at the end of the script to actually display the points, lines and circles that have been defined in the script. p1 = point(0, 0) l1 = line(1, 3, -4, 5) c1 = circle(-2, 3, 1) show() In each __init__()

Re: Storing lines from a text file

2006-01-29 Thread Kirk McDonald
[EMAIL PROTECTED] wrote: > so this: > a, b, c, d, e =f.readlines() > > ..this will put the first line in a, second in b, etc? How do I > accomplish this when I'm not sure how many lines there are going to be > every time? Thanks. > With a list: http://python.org/doc/2.4.2/tut/node5.html#SECT

Re: Python vs C for a mail server

2006-01-29 Thread Jay Parlar
> Paul Boddie wrote: > >> I don't think I've ever seen anyone advocating calling a function like >> getattr(obj "foo" + "bar")(). > >> From Lib/compiler/visitor.py: > > meth = getattr(self.visitor, 'visit' + className, 0) > > Later on: > > meth(node, *args) > > Of course, you can drop the "visit" p

Re: Storing lines from a text file

2006-01-29 Thread bradfordh
so this: a, b, c, d, e =f.readlines() ..this will put the first line in a, second in b, etc? How do I accomplish this when I'm not sure how many lines there are going to be every time? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Returning a value from code string

2006-01-29 Thread Kirk McDonald
Peter Hansen wrote: > In the specific case in question, Kirk's first post gave little or no > hint about how much he knew about security issues and, by asking "why?", > with a single word Steven hoped to learn enough to say things like "oh, > there's a package designed to do that which you can j

Re: Storing lines from a text file

2006-01-29 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I am not sure how hard of a question is, but I do know that I need some > help if you can give it. What I want to do is read the lines in a text > file and store each line into a variable. I believe that I can use > readlines() to read the individual lines, but how would

Re: StringIO proposal: add __iadd__

2006-01-29 Thread Alex Martelli
Scott David Daniels <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > It would be nice (in Py3k, when backwards compatibility can be broken) > > to make the plain-named, "default" modules those coded in C, since > > they're used more often, and find another convention to indicate pure > > Pyth

Storing lines from a text file

2006-01-29 Thread bradfordh
Hello everyone. I am not sure how hard of a question is, but I do know that I need some help if you can give it. What I want to do is read the lines in a text file and store each line into a variable. I believe that I can use readlines() to read the individual lines, but how would I store each lin

Storing lines from a text file

2006-01-29 Thread bradfordh
Hello everyone. I am not sure how hard of a question is, but I do know that I need some help if you can give it. What I want to do is read the lines in a text file and store each line into a variable. I believe that I can use readlines() to read the individual lines, but how would I store each lin

Re: StringIO proposal: add __iadd__

2006-01-29 Thread Alex Martelli
Paul Rubin wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > But why can't I have perfectly polymorphic "append a bunch of strings > > together", just like I can now (with ''.join of a list of strings, or > > StringIO), without caring whether the strings are Unicode

Re: Using bytecode, not code objects

2006-01-29 Thread Michael Spencer
Fredrik Lundh wrote: > Fabiano Sidler wrote: > >> I'm looking for a way to compile python source to bytecode instead of >> code-objects. Is there a possibility to do that? The reason is: I want >> to store pure bytecode with no additional data. > > use marshal. > >> The second question is, there

Re: Python vs C for a mail server

2006-01-29 Thread Volker Grabsch
Jens Theisen wrote: > What do you do when you want to no if a certain method or function is > actually used from somewhere, say "foobar", it a language which allows > (and even encourages) that it could be called by: > > getattr(obj, "foo" + "bar")() No. The recommended way to do it is:

Re: StringIO proposal: add __iadd__

2006-01-29 Thread Scott David Daniels
Alex Martelli wrote: > It would be nice (in Py3k, when backwards compatibility can be broken) > to make the plain-named, "default" modules those coded in C, since > they're used more often, and find another convention to indicate pure > Python equivalents -- e.g., pickle/pypickle and StringIO/pyStr

Re: Print dict in sorted order

2006-01-29 Thread Fuzzyman
You can always use OrderedDict : htttp://www.voidspace.org.uk/python/odict.html from odict import OrderedDict my_dict = OrderedDict(some_dict.keys()) keys = my_dict.keys() keys.sort() my_dict.setkeys(keys) print my_dict Of course if your ordering requirement was *that* trivial, you could do

Re: Find directory name of file?

2006-01-29 Thread Grant Edwards
On 2006-01-29, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > also the function os.cwd() Neither os.path nor os.cwd are going to tell you the location of the python program being executed. Looking at the value of sys.argv[0] is probably the best bet. If it's a relative path, then you can use os

Re: Python vs C for a mail server

2006-01-29 Thread Fredrik Lundh
Paul Boddie wrote: > > I don't think I've ever seen anyone advocating calling a function like > > getattr(obj "foo" + "bar")(). > > >From Lib/compiler/visitor.py: > > meth = getattr(self.visitor, 'visit' + className, 0) > > Later on: > > meth(node, *args) > > Of course, you can drop the "visit" pr

  1   2   >