Re: ANN: Compyler 0.1

2007-08-13 Thread olsongt
>
>   + has the exact same semantics as compiler code.  I was more
>

This "should read exact same semantics as python code"

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: Compyler 0.1

2007-08-13 Thread olsongt
> Grant Olson wrote:
> > Compyler is a pre-alpha x86 native code compiler.
>
> In what ways is this similar or different to Shed 
> Skin?http://mark.dufour.googlepages.com/
>
> --Irmen

I've never actually downloaded shedskin, but my understanding is that
it:

  + does type inference for speed, but means you're working with a
subset of python.

  + Generates C++ so you need an intermediate compiler (probably only
an issue on windows)

  + Generates code via the AST.

OTOH, compyler:

  + has the exact same semantics as compiler code.  I was more
concerned with this than performance payoffs.

  + generates .COFF files that are ready for linking.

  + Skips syntax tree processing and just assumes the default bytecode
is a good enough starting point.

I was going to say you couldn't make a .pyd in ShedSkin, but it looks
like you can do that too.

-Grant


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Windows Debugging w/o MS

2007-05-24 Thread olsongt
On May 24, 5:54 pm, "Christopher Anderson" <[EMAIL PROTECTED]>
wrote:
> > Debug builds are incompatible with release builds.  You'll need to
> > build every binary extension in debug mode (assuming the original
> > authors don't provide debug builds).
>
> Right, and this is what I would like to avoid having to do.
>
> Thanks,
> Chris
>
> PS. Sorry for the duplicate olsongt

Well I guess what I'm saying is, it's a pain to get a python debug
environment up and running, regardless of your toolchain, but there
isn't really any way of avoiding it.  (Although I guess this is the
case with any project that uses a bunch of different 3rd party
components.)  So you might as well buckle down and do it with whatever
environment you like to use.

I'd say maybe you could figure things out with a map file, but I'm
guessing at least some .dlls are getting their addresses relocated
when they're loaded.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Windows Debugging w/o MS

2007-05-23 Thread olsongt

>
> I've tried compiling python from source, and my extension module,
> using MSVC8 (free express version), and I managed to get this to work.
> The thing is, I don't want to have to recompile every single python
> package I need (wxPython, SciPy, etc).
>

Debug builds are incompatible with release builds.  You'll need to
build every binary extension in debug mode (assuming the original
authors don't provide debug builds).

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Towards faster Python implementations - theory

2007-05-10 Thread olsongt
On May 9, 5:02 pm, John Nagle <[EMAIL PROTECTED]> wrote:
> Paul Boddie wrote:
>
>  Python has that capability mostly because it's free in an
> "everything is a dictionary" implementation.  ("When all you have
> is a hash, everything looks like a dictionary".)  But that limits
> implementation performance.  Most of the time, nobody is using
> "setattr" to mess with the internals of a function, class, or
> module from far, far away.  But the cost for that flexibility is
> being paid, unnecessarily.
>

I've had this idea in the back of my head for a year or so now, but
have been too lazy or busy or both to give the implementation a try.

The idea is to create a special dictionary for python internals that
contains a pointer-to-a-pointer for the value side of the dictionary,
instead of just the standard PyObject*.  Then when you start to eval a
code block, you could do a one-time lookup of the pointer-to-the-
pointer for each method, attribute, etc; and store them in pre-
allocated slots.  The calls in the block to various GET_ and SET_
functions can then just deal with pointer derefencing instead of a
dictionary lookup, and the dictionary can still get changed while this
is going on without things blowing up.

I think you'd get a big speed up by changing all those dictionary
function calls to inlined pointer deref code.

Anyone else buy this approach? Or see any fatal flaws?

-- 
http://mail.python.org/mailman/listinfo/python-list


Python at Google

2007-04-03 Thread olsongt
Here's an article about python at google.  Apologies in advance.

http://valleywag.com/tech/google/missing-python-tracked-down-249208.php

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3.0 unfit for serious work?

2007-02-21 Thread olsongt
On Feb 20, 9:04 pm, "Jeff Templon" <[EMAIL PROTECTED]> wrote:
> yo,
>
> Bjorn, I am not sure I see why my post is bull crap.  I think all you
> are doing is agreeing with me.  My post was entitled "Python 3.0 unfit
> for serious work", you just indicated that the Linux distros will
> agree with me, in order to be taken seriously, the distros will have
> to include 2.x python for a very long time.  If 3.0 and 2.x have any
> serious degree of incompatibility, python will be a favorite subject
> for religious rants and heated arguments for many people.  And if we
> don't manage to restrain our d evelopers from using features that force
> us prematurely to move to 3.0 ... and don't underestimate what this
> means, because this means other things will have to move as well,
> which may have dependencies on yet other things like C++ library
> versions ... then I would have to, for reasons of maintainability,
> argue against continuing to allow python code development in the
> project.  I love python, but not enough to make 20+ people's lives
> difficult.
>
> There are already people making this sort of argument in our project.
>
>JT

I don't know the specifics of your app, but why does everyone insist
that they need to use the 'system' python?

At least one commercial python app I work with installs it's own
completely independant version of python.  For many apps where
predictible behaviour is required you can install 'your' python,
under /opt/myapp or /usr/local/myapp or whatever instead of python,
python2.2, python3, etc.  The downside is that you'll waste another
15Mb harddrive space, and you'll need to update your internal source
tree 4 or 5 times when maintenance releases come out.

Apologies if this sounds like a rant, I really mean it in a
constructive way.

-Grant

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help Required for Choosing Programming Language

2007-02-18 Thread olsongt
On Feb 16, 4:22 pm, [EMAIL PROTECTED] wrote:
> I am VB6 programmer and wants to start new programming language but i
> am unable to deciced.
>
> i have read about Python, Ruby and Visual C++. but i want to go
> through with GUI based programming language like VB.net
>
> so will you please guide me which GUI based language has worth with
> complete OOPS Characteristics
>
> will wait for the answer
>
> hope to have a right direction from you Programmer
>
> Regards
> Iftikhar
> [EMAIL PROTECTED]

Despite what "real programmers" and various apologists might say,
there isn't much out there that comes close to the ease-of-use and
functionality of VB when it comes to designing a GUI.  I say this not
to discourage you, but to let you know that if a GUI designer is your
sole criteria for a new language, you're going to be disappointed with
everything you see.

I'd suggest that with whatever new language you go with, you either
write apps that aren't gui-based, or write a web application with a
web-based GUI.  Another alternative would be to write the "business
logic" in the new language, and have a shell VB app implementing the
GUI call it.  You can do this easily in python by creating python
based COM components (not sure how easy it is in ruby, and it's a
comparitive pain-in-the-ass in C++)

Good luck,

Grant

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Execute binary code

2007-01-08 Thread olsongt

[EMAIL PROTECTED] wrote:
> Is it possible to execute a binary string stored within a python script
> as executable code ?
>
> The script is run under Windows, and the binary code (a full executable
> file) is stored in a variable in the script.
>
> I know I can use os.system() or os.popen() to run an external file, but
> these functions take as argument a string evaluated as command-line.
>
> I also know I could save the binary code as a temporary file, execute
> it and delete it afterwards, but this is not an alternative.
>
> Thanks.

It's not impossible, that's basically what I did on a smaller scale in
pyasm:

http://mysite.verizon.net/olsongt/

A small C-stub executes arbirary asm that was originally built as a
string.  The tough part for you would be loading all of the referenced
.dlls into memory and patching in all the relocations from the source
COFF file.  It'll be a pain but not entirely impossible.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: About alternatives to Matlab

2006-12-11 Thread olsongt

Paul Rubin wrote:
> Jon Harrop <[EMAIL PROTECTED]> writes:
> > F# runs under Linux with Mono.
>
> Interesting, where do I get it, and is there source?  I've never been
> interested in Mono but maybe this is a reason.  How does the compiled
> code compare to OCaml or MLton code?

The source is avaliable, but it's under Microsoft's Shared Source
license, which isn't quite an open source license.  There are some
restrictions on commercial usage.

http://research.microsoft.com/fsharp/fsharp-license.txt

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: good documentation about win32api ??

2006-12-01 Thread olsongt

__schronos__ wrote:
> Hi all.
>
>   Recently I've to developed a project in python that made operation
> under win32 platform and I found a lot of problema to find good
> information. The only one documentation is in ActivePython page
> (http://aspn.activestate.com/ASPN/docs/ASPNTOC-APYTH2.4.0) but it is
> not very good and finally I had to turn to the newsgroups (it was very
> nice).
>
>   And the question is: ¿Anybody knows where can I find good
> documentation about win32api?
>
> Thanks in advanced.
>
>   ScnS.

http://msdn.microsoft.com covers the API itself, although you need to
transliterate from the C code to python.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: profanity on comp.lang.python (was Re: Pyro stability)

2006-11-08 Thread olsongt

BartlebyScrivener wrote:
> Chaz Ginger wrote:
>
> >> it is supposed to be about PYTHON. Get it?
>
> I agree. And Python is an extremely serious matter calling for decorum
> and propriety.
>
> Don't say fuck, ni, peng, or ni-wom.
>
> http://en.wikipedia.org/wiki/Knights_who_say_Ni
>
> rd

Does using foobar in examples count as profanity?

http://en.wikipedia.org/wiki/Foobar

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a Python-on-Windows person to help with SpamBayes

2006-10-23 Thread olsongt

[EMAIL PROTECTED] wrote:
> I'm looking for some help with SpamBayes.  It can be short-term or
> long-term.  I've implemented some OCR capability based on the open source
> ocrad program that works reasonably well to extract text tokens from
> image-based spam.  Alas, I don't use Windows at all, so I can't make sure
> this stuff works on Windows.  None of the usual suspects in the SpamBayes
> development community have any free time at the moment.  Others are helping
> out, but they are user types, not programmer types, so the round trip
> between "this doesn't work", to "okay, try this" and back again is
> agonizingly slow.
>
> The bare requirements are:
>
> * Able to program in Python on Windows (that is, remove my Unix-think
>   from the OCR bits of code)
>
> * Use Outlook to read mail (so you can test the changes with the
>   SpamBayes Outlook plugin)
>
> If you can compile software under cygwin (the ocrad program builds fine
> under cygwin) and/or can create installers for Python-based Windows apps
> that would be a plus.
>
> If you can help out, please drop an email to [EMAIL PROTECTED]
> 
> Thanks,
> 
> -- 

Does ocrad require the cygwin environment to run?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Restart a Python COM Server

2006-10-18 Thread olsongt

[EMAIL PROTECTED] wrote:
> Hello all.
> I am desperately in need for you help guys. Here is the story:
> 1- I have created a small simple COM serve with python (along the lines
> read in Win32 Programming with python).
> 2- If I start the server and call a function from VBE everything works
> fine
> 3- I then want to modify the function in the python COM server
> 4- I unregister the server and register it again hoping the changes
> will take effect
> 5- I make call to the function from VBE but the it seems that VBE
> doesn't reload/refresh the reference to the server.
> So I do I get VBE to point to the last version of the server? If I
> close VBE and reload it then it works. But I think there is probably a
> smarter way. Please, tell me there is!
> Few posts deal with the issue, but so far I couldn't find anything
> about it...
>
> Thanx all
> M.E

I don't know how well this works for python-based COM components, but
the general fix is to setup a Component Services package.  This creates
a proxy component which can be independently killed from the Component
Services management console.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: building extensions for Windows Python

2006-10-13 Thread olsongt

JW wrote:
>
> My main problem is that I don't really grasp the big picture.  Can someone
> give me an overview of the requirements to build extensions for Windows
> Python, circa 2.5?  Or, can I tell my employer she'll just have to
> hire/contract a Windows expert to do the mud wrestling?
>
> Jim Wilson
> Gainesville, FL

To build an extension that runs on a generic python 2.5 you need a
Windows OS (suprise!) and VS.NET 2003.  Some people may have had some
success with MinGW32 (on windows) but it's not going to work
'out-of-the-box'.

If your code is straightforward crossplatform C, you could setup a
distutils configuration script and pass it off to someone else to build
the windows binaries, but chances are some debugging will have to be
done.

-- 
http://mail.python.org/mailman/listinfo/python-list


+1 QOTW

2006-09-22 Thread olsongt
Did anyone else crack up when Larry Wall described python with the
statement:

Python, as the "anti-Perl," is heavily invested in maintaining Order.

In the state of the onion address?

http://www.perl.com/pub/a/2006/09/21/onion.html

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What do you want in a new web framework?

2006-08-24 Thread olsongt

Peter Maas wrote:
> Alex Martelli wrote:
> > Indeed, it has been truthfully observed that Python's the only language
> > with more web frameworks than keywords.
> >
> > I have already suggested to the BDFL that he can remedy this situation
> > in Py3k: all he has to do, of course, is to add a LOT more keywords.
>
> Here is another remedy: he adds one of the frameworks to the standard
> library :)
>
> Peter Maas, Aachen

But there are already 3 ;-)

http://docs.python.org/lib/module-BaseHTTPServer.html
http://docs.python.org/lib/module-SimpleHTTPServer.html
http://docs.python.org/lib/module-CGIHTTPServer.html

To answer the original poster, I personally like the ASP.NET model of
Controls (I'm sure some people will disagree) that do things like
automatically render, automatically marshall/unmarhall form data and
bind to variables, and respond to events.  I always think it's a little
stupid when I try to use a framework, and I still need to manually
extract info from post data, and I still need to manually construct
simple things like  boxes.  That is probably an
interesting area to explore.

I haven't looked at python web frameworks in a while, so if there are
any existing frameworks out there that do things with a similar model,
someone please let me know.

-Grant

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Clean way to not get object back from instantiation attempt gone bad

2006-08-18 Thread olsongt

tobiah wrote:
> Suppose I do:
>
>
> myfoo = Foo('grapes', 'oranges')
>
> And in the __init__() of Foo, there is
> a real problem with the consumption of fruit.
> Is there a clean way to ensure that myfoo
> will be None after the call?  Would the
> __init__() just do del(self), or is there
> a better way to think about this?
>
> Thanks,
>
> Toby

As others have said, just raise an exception.  You can hide
instantiation inside a factory function to simulate the behaviour
you're specifically talking about:

class Foo:
def __init__(self, *args):
for arg in args:
if is_fruit(arg):
 raise RuntimeError("I don't like fruit")


def FooFactory(*args):
try:
return Foo(*args)
except RuntimeError:
return None

-Grant

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread olsongt

Erik Max Francis wrote:
> [EMAIL PROTECTED] wrote:
>
> > Basically, someone could inject an arbirtrary script called 'python'
> > into your path that does whatever (rm -fr /) under your user context
> > when you run the script.  But the same thing would happen if you run
> > 'python test.py' instead of '/usr/local/bin/python test.py' to run a
> > script that doesn't have a she-bang or hasn't been flagged as
> > executable.  Some admins will use a fully-qualified path for every
> > command to guard against this; I think that can be overkill.
>
> The primary guard for this is not having publicly-writable things in
> your PATH.  In other words, this is the argument for not putting things
> like /tmp or . (because you might cd to somewhere publicly writable like
> /tmp) in your PATH, not really for avoiding /usr/bin/env in hash bangs.
>

Yeah, I agree 100%.  I guess the best way to put it is that if random
people are creating scripts called 'python' in your path, you've got
bigger problems than /usr/bin/env calling the wrong program or a plain
old 'python test.py' doing the same.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread olsongt

Aahz wrote:
> In article <[EMAIL PROTECTED]>,
> John Salerno  <[EMAIL PROTECTED]> wrote:
> >
> >I understand the difference, but I'm just curious if anyone has any
> >strong feelings toward using one over the other? I was reading that a
> >disadvantage to the more general usage (i.e. env) is that it finds the
> >first python on the path, and that might not be the proper one to use. I
> >don't know if that's a real issue most of the time, but it's at least
> >something to consider.
>
> The main argument against the env method is that I've seen a fair number
> of sysadmins claim that it's less secure.  I'm not competent to judget
> that claim myself, but I prefer to play safe and stay away from env.
> --
> Aahz ([EMAIL PROTECTED])   <*> http://www.pythoncraft.com/
>

Basically, someone could inject an arbirtrary script called 'python'
into your path that does whatever (rm -fr /) under your user context
when you run the script.  But the same thing would happen if you run
'python test.py' instead of '/usr/local/bin/python test.py' to run a
script that doesn't have a she-bang or hasn't been flagged as
executable.  Some admins will use a fully-qualified path for every
command to guard against this; I think that can be overkill.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Info on continuations?

2006-08-08 Thread olsongt

vasudevram wrote:
> Hi,
>
> I am Googling and will do more, found some stuff, but interested to get
> viewpoints of list members on:
>
> Continuations in Python.
>
> Saw a few URLs which had some info, some of which I understood. But
> like I said, personal viewpoints are good to have.
>
> Thanks
> Vasudev

Could you be a little more specific on what you're looking for?
Continuations are a big can of worms.

In general, some of the historical uses of continuations are better
represented as classes in python.  Generators provide some limited
functionality as well, and will be able to send info both ways in
python 2.5 to enable limited co-routines.  Stackless python allows you
to *really* suspend the stack at a given time and do a bunch of crazy
stuff, but doesn't currently support 'full continuations'.

-- 
http://mail.python.org/mailman/listinfo/python-list


An interesting way to implement an abstract base class

2006-08-04 Thread olsongt
This one made me smile.  From:

http://aima.cs.berkeley.edu/python/utils.html#Queue

class Queue:
"""Queue is an abstract class/interface. There are three types:
Stack(): A Last In First Out Queue.
FIFOQueue(): A First In First Out Queue.
PriorityQueue(lt): Queue where items are sorted by lt, (default
<).
Each type supports the following methods and functions:
q.append(item)  -- add an item to the queue
q.extend(items) -- equivalent to: for item in items:
q.append(item)
q.pop() -- return the top item from the queue
len(q)  -- number of items in q (also q.__len())
Note that isinstance(Stack(), Queue) is false, because we implement
stacks
as lists.  If Python ever gets interfaces, Queue will be an
interface."""

def __init__(self):
abstract

def extend(self, items):
for item in items: self.append(item)

-- 
http://mail.python.org/mailman/listinfo/python-list


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

2006-07-28 Thread olsongt

Nick Vatamaniuc wrote:
> Roman,
>
> According to the Python call syntax definition
> (http://docs.python.org/ref/calls.html) commas should be allowed, so it
> seems like a minor bug.  Here are the  lines in question:
> -http://docs.python.org/ref/calls.html---
> call ::= primary "(" [argument_list [","]] ")"
> argument_list::=positional_arguments ["," keyword_arguments] ["," "*"
> expression] ["," "**" expression]
>   | keyword_arguments ["," "*" expression] ["," "**" expression]
> | "*" expression ["," "**" expression]
> | "**" expression
> --
> If you notice in the 'call' definition, no matter what the
> 'argument_list' is, it can be followed by an optional ',' right before
> the closing ')'. Your code is a counterexample to this. Here is a more
> exhaustive example:
> 

Actually, in the real BNF it's not allowed:

http://svn.python.org/view/python/trunk/Grammar/Grammar?rev=46209&view=markup

parameters: '(' [varargslist] ')'
varargslist: ((fpdef ['=' test] ',')*
  ('*' NAME [',' '**' NAME] | '**' NAME) |
  fpdef ['=' test] (',' fpdef ['=' test])* [','])
fpdef: NAME | '(' fplist ')'

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to force a thread to stop

2006-07-25 Thread olsongt

Carl J. Van Arsdall wrote:
> Jean-Paul Calderone wrote:
> > On Mon, 24 Jul 2006 11:22:49 -0700, "Carl J. Van Arsdall" <[EMAIL 
> > PROTECTED]> wrote:
> >
> >> Steve Holden wrote:
> >>
> >>> Carl J. Van Arsdall wrote:
> >>> [... rant ...]
> >>>
> >>>
>  So with this whole "hey mr. nice thread, please die for me" concept gets
>  ugly quickly in complex situations and doesn't scale well at all.
>  Furthermore, say you have a complex systems where users can write
>  pluggable modules.  IF a module gets stuck inside of some screwed up
>  loop and is unable to poll for messages there's no way to kill the
>  module without killing the whole system.  Any of you guys thought of a
>  way around this scenario?
> 
> 
> 
> 
> >>> Communications through Queue.Queue objects can help. But if you research
> >>> the history of this design decision in the language you should discover
> >>> there are fairly sound rasons for not allowing arbitrary "threadicide".
> >>>
> >>>
> >>>
> >>>
> >> Right, I'm wondering if there was a way to make an interrupt driven
> >> communication mechanism for threads?  Example: thread receives a
> >> message, stops everything, and processes the message.
> >>
> >>
> >
> > And what happens if the thread was halfway through a malloc call and
> > the data structures used to manage the state of the heap are in an
> > inconsistent state when the interrupt occurs?
> >
> > This has been discussed many many times in the context of many many
> > languages and threading libraries.  If you're really interested, do
> > the investigation Steve suggested.  You'll find plenty of material.
> >
>
> I've been digging around with Queue.Queue and have yet to come across
> any solution to this problem.  Queue.Queue just offers a pretty package
> for passing around data, it doesn't solve the "polling" problem.  I
> wonder why malloc()'s can't be done in an atomic state (along with other
> operations that should be atomic, maybe that's a question for OS guys, I
> dunno).  Using Queue.Queue still puts me in a horribly inflexible
> "polling" scenario.  Yea, I understand many of the reasons why we don't
> have "threadicide", and why it was even removed from java.  What I don't
> understand is why we can't come up with something a bit better.  Why
> couldn't a thread relinquish control when its safe to do so?  While the
> interpreter is busy doing malloc()s a thread receives a control message,
> the thread waits until it knows its no longer in an atomic state and
> gives control to the message handler when it can.  Its about setting up
> a large system that is controllable without the painstaking process of
> putting message polling loops all over the place.  Main threads in a
> python program can setup a signal handler, accept signals, and that
> signal can happily go ahead and kill a python interpreter.  Why can't
> this concept be taken farther and introduced into threading?
>
> There is no system that is completely interruptible, there will always
> be a state in which it is not safe to interrupt, but many systems work
> around this just fine with cautious programming.  Has anyone considered
> an event driven approach to sending control messages to threads?
>
> -c
>


Have you looked at stackless yet?

You can do all kinds of crazy stuff like infinitely suspending a
tasklet (stackless' version of threads) and effectively killing it,
sending messages via channels that can be externally monitored, send
arbitrary exceptions that are immediately raised in other tasklets,
writing your own pre-emptive schedules, saving a tasklet on disk for
later examination, etc, etc.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: attaching debugger to runinng python program

2006-07-14 Thread olsongt

alf wrote:
> Bill Pursell wrote:
> > Now, in another shell,
> > % gdb
> > (gdb) attach 54321
> >
>
> Thx for the reply. But I wish to debug the python program, not python
> interpreter itself.

I haven't used this, but it looks like it's worth a try:

http://hapdebugger.sourceforge.net/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Multi-threaded FTP Question

2006-07-12 Thread olsongt

[EMAIL PROTECTED] wrote:
> I'm trying to use ftp in python in a multi-threaded way on a windows
> box - python version 2.4.3.  Problem is that it appears that it's only
> possible to have five instances/threads at one point in time.  Errors
> look like:
>
>File "C:\Python24\lib\ftplib.py", line 107, in __init__
> self.connect(host)
>   File "C:\Python24\lib\ftplib.py", line 132, in connect
> self.welcome = self.getresp()
>   File "C:\Python24\lib\ftplib.py", line 208, in getresp
> resp = self.getmultiline()
>   File "C:\Python24\lib\ftplib.py", line 194, in getmultiline
> line = self.getline()
>   File "C:\Python24\lib\ftplib.py", line 184, in getline
> if not line: raise EOFError
> EOFError
>
> Is it possible to have more than five simultaneous ftp connections?
>
> Thanks.
>
> Derek

It might be XP SP2's worm protection as well:

http://www.speedguide.net/read_articles.php?id=1497

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Running multiple versions of Python on the same host..

2006-07-10 Thread olsongt

Cowmix wrote:
> For my day job I am forced to run RHEL3 (and Centos3 on my desktop). I
> want to be able to use a few applications that require Python 2.4.X but
> RHEL3 ships with Python 2.2.3. I have tried to install and upgrade
> Python 2.4.X many ways like using PyVault and doing a source based
> install but each way has been fraught with problems from weird
> dependency issues to screwing up 'yum'.
>
> What is the best way to run multiple version of Python on the same
> system?
>
> thanks!

If installing from source, 'make altinstall' will do everything but
link python to (for example python2.4.  You can then run 'python2.4'
'python2.3',etc to use a particular version.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reddit broke - should have remained on Lisp?

2006-06-30 Thread olsongt

Kay Schluehr wrote:
>
> Please, since this is a Python+Lisp cross-thread and you seem to have
> background info: can you explain why Lisp hackers have turned
> themselves into Python newbies for Reddit impl. and finally complain
> about the language switch? What was cause for their decision to use
> Python in the first place?

Basically, it was the same complaint everyone else has about common
lisp.  It's an awesome language, but there are no reliable standard
crossplatform (and free) libraries for threading and sockets.  They
were using FreeBSD as a server, and (trying to) use powerbooks as a dev
platform, and that seriously restricted viable CL implemenations.

http://redditblog.blogspot.com/2005/12/night-of-living-python.html
http://redditblog.blogspot.com/2005/12/on-lisp.html

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Bug reporting impossible

2006-06-29 Thread olsongt

>
> I usually refrain from posting if I don't have anything to add to the
> discussion, but that struck me as perverse and I was curious.
> I certainly have no objection to having that bug fixed. : )
>


If you find that sort of perversity strangely exciting, I would like to
refer you to pages 67-69 of the Unix Hater's Handbook:

http://www.simson.net/ref/ugh.pdf

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Psyco tagging the same function multiple times

2006-06-28 Thread olsongt

[EMAIL PROTECTED] wrote:
> I'm trying some stuff with Psyco and am confused about its apparent desire
> to compile the same function (or method) multiple times).  Here's an
> abstract from a recent run:
>
> 12:45:15.99  tag function: __main__.Watcher.processUpdate%
> 12:45:24.95  tag function: __main__.Watcher.processUpdate%
> 12:45:55.12  tag function: __main__.Watcher.processUpdate%
> 12:46:12.29  tag function: __main__.Watcher.processUpdate%
> 12:46:28.09  tag function: __main__.Watcher.processUpdate%
> 12:47:05.32  tag function: __main__.Watcher.processUpdate%
> 12:47:48.62  tag function: __main__.Watcher.processUpdate%
> 12:48:09.63  tag function: __main__.Watcher.processUpdate%
> 12:48:43.20  tag function: __main__.Watcher.processUpdate%
> 12:49:58.80  tag function: __main__.Watcher.processUpdate%
> 12:50:32.20  tag function: __main__.Watcher.processUpdate%
> 12:51:07.91  tag function: __main__.Watcher.processUpdate%
> 12:52:17.14  tag function: __main__.Watcher.processUpdate%
> 12:52:33.67  tag function: __main__.Watcher.processUpdate%
>
> What (if anything) does it mean that it tagged Watcher.processUpdate more
> than once?
>
> Thanks,
>
> Skip

I think that's what Armin means by a *specializing* compiler.  I
believe it will compile multiple versions based on the arguments going
into a block of code.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Debugging C++ code called from Python 2.2 with Visual Studio.NET

2006-06-20 Thread olsongt

[EMAIL PROTECTED] wrote:
> I can't seem to be able to download
> http://www.python.org/ftp/python/2.2/Python-2.2.tgz.
> Do you know if I can find it elsewhere?
> Thanks,
> Emmanuel

The link you gave worked for me...

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Debugging C++ code called from Python 2.2 with Visual Studio.NET

2006-06-20 Thread olsongt

[EMAIL PROTECTED] wrote:
> Hi,
> I'm trying to debug some VS native C++ code called from a python script
> (version is 2.2).
> For that, I added the _DEBUG macro in Setup.py but when I rebuild the
> pyd file, I get a compilation error whereby it says that python22_d.lib
> could not be found.
>
> I've seen in various groups that python22_d.lib is not available for
> download anymore but that it is easy to recompile. Could someone send
> it to me, explain how to build it or, even better, both.
>
> I expect that after that, if I recompile the python pyd file, I will be
> able to attach a debugger to it. Could someone confirm this?
>
> Cheers,
> Emmanuel
>
> PS: I'm new to Python and I'm using legacy code.

To elaborate on Frederick's advice, the source .tgzs available on
python.org contain everything you need to build the windows version,
excluding a few modules that require third-party dependancies (tkinter,
ssl, zip, bzip2 and probably a few others).  You'll need VC6.0 as well
for 2.2.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: a good programming text editor (not IDE)

2006-06-15 Thread olsongt

John Salerno wrote:
> Ant wrote:
>
> > jEdit is for me still the best text editor available. Very extensible
> > with macros (which can be written in Jython with the appropriate plugin
> > installed).
>
> I like the idea of being extensible, but of course I can only write in
> Python. Are there any editors that support that?

I can think of one editor that supports that ;-)

http://www.vim.org/htmldoc/if_pyth.html#Python

Seriously though, yes vim is wierd.  Wierd enough that you might think
maybe people just use it because they're trying to proove they're l337
or hardcore, instead of using it for real practical reasons.  But it
really is an amazing text editor once you accept the wierdness.

If you use it for a little bit, one day you'll be editing a document in
Word, or notepad, or SciTE, or Eclipse; you'll instinctively type
'[ESC]:wq', and be suprised that the app is still open.  That's when
you realize there's no turning back.

-Grant
[ESC]:wq 

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread olsongt

> >
> >
> > Time for a game!
> >
> > Both johnbokma.com and castleamber.com are hosted by seagull.net.  Here
> > is a link to their TOS:
> >
> > http://www.seagull.net/tos.html
> >
> > Who can come up with the most violations that John is committing on
> > this thread? I count 4.
> >
> Let's not drop to his level.
> --


I agree.  I never actually said that anyone should report him. I simply
wanted to illustrate his hipocrisy.

[Although John insinuated I did say that, which I find defamitory, and
is clearly a violation of his TOS ;-) ]

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread olsongt

John Bokma wrote:
> "Ant" <[EMAIL PROTECTED]> wrote:
>
> > I have no particular affinity for Xah's views, but what does get up my
> > nose is usenet Nazism.
>
> That's because you're clueless.
>
> --
> John   MexIT: http://johnbokma.com/mexit/
>personal page:   http://johnbokma.com/
> Experienced programmer available: http://castleamber.com/
> Happy Customers: http://castleamber.com/testimonials.html

Time for a game!

Both johnbokma.com and castleamber.com are hosted by seagull.net.  Here
is a link to their TOS:

http://www.seagull.net/tos.html

Who can come up with the most violations that John is committing on
this thread? I count 4.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: John Bokma harassment

2006-05-24 Thread olsongt

Tim N. van der Leeuw wrote:
> [EMAIL PROTECTED] wrote:
> > I agree there are limits to you right to free speech, but I believe Xah
> > Lee is not crossing
> > any boundaries. If he starts taking over newspapers and TV stations be
> > sure to notify me,
> > I might revise my position.
> > Immanuel
>
> Perhaps he's not crossing boundaries of free speech, but he's
> repeatedly crossing boundaries on usenet nettiquette, even though
> repeatedly he's being asked not to do so. (Extensive crossposting to
> various usenetgroups / mailing lists, for instance).
>
> If he would just post his stuff on a blog and find a why to get people
> to visit hist blog, without crossposting to 10 usenest groups for each
> post he makes to his blog, then nobody would mind him expressing his
> opinions, and those interested could discuss them wildly on the blog.
>
> But I've repeatedly seen people telling him not to crosspost his essays
> to so many newsgroups, yet he continues doing it.
> If that's enough to quit his subscription with his ISP I don't know,
> but since I've stopped following threads originated by him I don't know
> what other grounds there would be.
>
> Cheers,
>
> --Tim

The trouble is there's no definitive definition of 'nettiquette' (and
no the RFC on nettiquette doesn't count).  Should people get kicked off
of thier ISP for top posting? What about not asking 'smart' questions
as defined by Eric Raymond?

In addition, the people telling him not to cross-post don't really have
any authority.  They're just random people on the internet.  For
example, you've cross posted to several groups.  I'm telling you to
stop.  Of course I'm doing the same thing and you can feel free to
ignore me.  I'm not the Supreme Master of comp.lang.python.

But I think you would agree that it would be harrassment if I went to
your ISP- nl.unisys.com - and said that you were abusing the internet
and 'spamming' the usenet, especially if you are a unisys employee (not
sure if they're a service provider over there, but I'm guessing not).
If I got a hold of the wrong person on the wrong day, you could lose
your job.

Xah is an crackpot, but he doesn't spam or mailbomb groups.  And
besides, what fun would the usenet be without crackpots?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Install

2006-05-18 Thread olsongt

Paul Osman wrote:
> On 18-May-06, at 10:30 AM, D wrote:
>
> > I'm sure this is an easy question for most here, but it's throwing me
> > for a loop at the moment - I need to upgrade RHEL 3 with the latest
> > version of Python.  I downloaded the source and installed, but we're
> > still having problems (i.e. some Python apps don't work, Add/Remove
> > Applications console errors out and doesn't open, etc.).  My guess is
> > that it's using old libraries or otherwise conflicting with the old
> > Python version, but I'm not sure how to remove the original version.
> > Any help would be greatly appreciated!
>
> RHEL uses python for distro specific tools pretty extensively iirc.
> I'd stay away from source installs and stick to rpms / yum /
> up2date / whatever RH uses these days.
>
> Cheers,
>
> Paul Osman
> http://www.eval.ca

You can also use 'make altinstall'  This does everything but symlink to
python, so you can still run (for example) python2.4 to start your
scripts.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Windows Registry Dump

2006-05-18 Thread olsongt

Dirk Hagemann wrote:
> Hi!
>
> Does someone know how I can make a Text-Dump-File of a remote
> Windows-Computer's Registry (not the whole registry - only a part of
> it)?
>
> Thanks a lot for some code or a helpful link!
>
> regards
> Dirk

the win32api module has a bunch of Reg* functions that let you do this.

-- 
http://mail.python.org/mailman/listinfo/python-list


Did anyone get audio/video from PyCon 2006?

2006-05-16 Thread olsongt
The obvious link from google seems to indicate that no audio or video
got captured.  Is this true, or am I looking in the wrong place?


http://tinyurl.com/zu9lo

Thanks,

Grant

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A critic of Guido's blog on Python's lambda

2006-05-07 Thread olsongt

Alex Martelli wrote:
> Steve R. Hastings <[EMAIL PROTECTED]> wrote:
>...
> > > But the key in the whole thread is simply that indentation will not
> > > scale. Nor will Python.
> >
> > This is a curious statement, given that Python is famous for scaling well.
>
> I think "ridiculous" is a better characterization than "curious", even
> if you're seriously into understatement.
>

When you consider that there was just a big flamewar on comp.lang.lisp
about the lack of standard mechanisms for both threading and sockets in
Common Lisp (with the lispers arguing that it wasn't needed) I find it
"curious" that someone can say Common Lisp scales well.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Missing interfaces in Python...

2006-04-18 Thread olsongt

Rene Pijlman wrote:
> [EMAIL PROTECTED]:
> >If it looks like a duck, and quacks like a duck, then for all practical
> >purposes it supports the 'duck' interface.
>
> The problem with that of course, is that there's much more to being a duck
> than being called 'duck'.
>
> public interface JarFile {
> void explode();
> }
> public interface NuclearBomb {
> void explode();
> }
> http://www.beust.com/weblog/archives/000269.html
>
> --
> René Pijlman

Not that I disagree with you, but interfaces don't really guarantee any
semantics either.  You'd probably need to use Eiffel if you really want
to design by contract.

public class EarFile implements JarFile {
void explode()
{
HackerTools.WipeHardDrive();
}

}

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Missing interfaces in Python...

2006-04-18 Thread olsongt
[EMAIL PROTECTED] wrote:
> I'm coming from a Java background, so please don't stone me...
>
> I see that Python is missing "interfaces". The concept of an interface
> is a key to good programming design in Java, but I've read that they
> aren't really necessary in Python. I am wondering what technique I can
> use in Python to get the same benefits to a program design that I would
> get with interfaces in Java.
>
> For example, if I want to have a program with a Car object, and a Bus
> object. I want both of these objects to present a common group of
> methods that can be used by Mechanic objects, but slightly different
> methods that can be used by Driver objects.
>
> In Java I would accomplish this by defining an IFixable interface that
> would be implemented by both the Car and Bus objects. Mechanic objects
> would work with any object implementing this interface.
>
> How would I approach this problem in Python? I think I would use an
> abstract class instead of an interface for IFixable, since Python
> supports multiple inheritance, but I'm not sure this is correct.
>
> Thanks for any suggestions.
>
> Scott Huey

Everyone is getting off track here.

Java has interfaces because it doesn't support multiple inheritance.
Python supports MI, so you don't need to use the seperate concept of an
interface.  You're right that an abstract class is the equivilent of an
interface.  Just create a ABC that raises NotImplementedExceptions for
each of the methods, and use that class as one of the base classes.  Of
course, like a lot of stuff in python, this won't throw an exception at
'compile-time', only when you try to invoke a method that has no
implemenation.

The general wisdom is that Abstract Base Classes aren't pythonic
though.  If you want to  be pythonic, just implement the methods for
your 'interface', and (if necessary) check for their existance with
hasattr before calling (or even just call the method and you'll get an
attribute error anyway).  This is referred to as duck-typing.  If it
looks like a duck, and quacks like a duck, then for all practical
purposes it supports the 'duck' interface.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to comment lot of lines in python

2006-03-31 Thread olsongt

Eric Deveaud wrote:
> [EMAIL PROTECTED] wrote:
> >  Like in C we comment like
> >  /*
> >  Bunch of lines of code
> >  */
> >
> >  Should we use docstring """ """
>
> I would say NO.
> docstring are displayed by pydoc, thus a pydoc on your code will display some
> inconsistent information ;-)
>

docstrings are a bit of a magical construct.  Not all strings in a
function are docstrings.

>>> def foo():
... "real docstring"
... """
... x=1
... """
... print x
...
>>> help(foo)
Help on function foo in module __main__:

foo()
real docstring

>>>

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Validating Syntax only with PyParser_SimpleParseString ?

2006-03-29 Thread olsongt

[EMAIL PROTECTED] wrote:
> I am seeking for a method to parse single lines of Python code (infact
> they are only formulas, so I generate a line like RESULT=). I
> do only want to know if the syntax is correct and if there is an error
> best would be to know where.
>
> I did find PyParser_SimpleParseString which does return a node
> structure. If there is an error it seems to return NULL, while I did
> not find this documented.
>
> Th eproblem with this is that first I do not get th elopcation of the
> syntax error, and second I don't know what is the proper method to free
> the node structure after I got it, since I will not use it. Or is there
> any better method doing this anyway.
>
> Environment: Windows / Borland C++

The builtin function compile will throw a SyntaxError if the syntax is
bad.

>>> compile("1=a","","single")
Traceback (most recent call last):
  File "", line 1, in ?
SyntaxError: can't assign to literal
>>>

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: in-place string reversal

2006-03-28 Thread olsongt

Sathyaish wrote:
> How would you reverse a string "in place" in python? I am seeing that
> there are a lot of operations around higher level data structures and
> less emphasis on primitive data. I am a little lost and can't find my
> way through seeing a rev() or a reverse() or a strRev() function around
> a string object.
>
> I could traverse from end-to-beginning by using extra memory:
>
> strText = "foo"
> strTemp = ""
> for chr in strText:
>strTemp = chr + strTemp
>
>
> but how would I do it in place?
>
>
> Forget it! I got the answer to my own question. Strings are immutable,
> *even* in python. Why not! The python compiler is written in C, right?
> It is amazing how just writing down your problem can give you a
> solution.
>
>
> PS: Or, if my assumption that strings are immutable and an in-place
> reversal is possible, is wrong, please correct me.

If you are using strings that are long enough where you're going to run
into memory issues, you can create a character array from the array
module.  This will basically create a mutable string.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Debugger / IDE ??

2006-03-14 Thread olsongt

[EMAIL PROTECTED] wrote:
> Is there any editor or IDE in Python (either Windows or Linux) which
> has very good debugging facilites like MS VisualStudio has or something
> like that.
>
> I like SPE but couldn't easily use winPDP. I need tips to debug my code
> easily.
>
> Every help is greatly appreciated.
>
> Thanks

I've always been happy with the debugger in PythonWin.  You can even
use:

from pywin.debugger import set_trace;set_trace()

to bring up the debugger directly from a script that wasn't originally
run in the ide.

-- 
http://mail.python.org/mailman/listinfo/python-list


Advice from distutils experts?

2006-03-04 Thread olsongt
I'm doing something a little wierd in one of my projects.  I'm
generating a C source file based on information extracted from python's
header files.  Although I can just generate the file and check the
result into source control, I'd rather have the file generated during
the install process instead of doing it manually.

So I'd like to:
+ have the file generated when a unix user runs setup.py install.
+ have the file generated when I create a windows binary
distribution.
+ not have the file generated when I create source distribution
.tgz's and .zip's.

I'd appreciate any pointers on the best way to hook into disutils to do
this.  And if the answer is "Your crazy, generate the file outside of
distutils." just let me know.

-Grant

-- 
http://mail.python.org/mailman/listinfo/python-list


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

2006-01-30 Thread olsongt
Http protocol give the content-type in the http headers, so the
originating server determines how your browser is going to handle it,
not the client browser.  I think the problem is that the 'file://'
protocol probably does use the registry keys above since it's not
getting any HTTP headers.

-- 
http://mail.python.org/mailman/listinfo/python-list


is this a unicode/string bug?

2005-12-09 Thread olsongt
I was going to submit to sourceforge, but my unicode skills are weak.
I was trying to strip characters from a string that contained values
outside of ASCII.  I though I could just encode as 'ascii' in 'replace'
mode but it threw an error.  Strangely enough, if I decode via the
ascii codec and then encode via the ascii codec, I get what I want.
That being said, this may be operating correctly.

>>> print 'aaa\xae'
aaa®
>>> 'aaa\xae'.encode('ascii','replace') #should return 'aaa?'
Traceback (most recent call last):
  File "", line 1, in ?
UnicodeDecodeError: 'ascii' codec can't decode byte 0xae in position 3:
ordinal not in range(128)
>>> 'aaa\xae'.decode('ascii','replace') #but this doesn't throw an error?
u'aaa\ufffd'
>>> 'aaa\xae'.decode('ascii','replace').encode('ascii','replace') #this does 
>>> what I wanted
'aaa?'
>>>

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python23.pdb

2005-04-25 Thread olsongt

Saravanan wrote:
> Hello,
>
> 1) Is is possible to get the pdb files for the Python version 2.3.3?
>
> Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)]
> on win32
>

These don't exist.  If you have access to VC 6.0 you could check out
the appropriate tag from cvs and do your own build to get them.  If
you're just trying to use Debugging Tools for Windows in an environment
without a compiler you're out of luck.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Proposal: an unchanging URL for Python documentation

2005-04-20 Thread olsongt

Simon Brunning wrote:
>
> Yup, but it's not all unchanging. Take, for example,
> . I have wanted to
> steer people towards that page a number of times, and that node
number
> keeps changing.
>

Here's the code I've been using to translate the latex2html links
(including embedded anchors) to something that has some context.  I can
lookup links via something that is understandable like
('os','path','exists').  A truly adventurous person could probably use
this to write a redirector.

http://pyxr.sourceforge.net/PyXR/c/python24/lib/site-packages/pyxr/htmlCrawler.py.html

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: terminate exectutioin in PythonWin

2005-04-13 Thread olsongt

> >
> >
> D'oh. I didn't think of that.
>
> Thanks
>
> Jim

A little off-topic, but here's a little more fun with pythonwin.  You
can spawn the debugging environment from a normal python script running
outside of pythonwin with:

import pywin.debugger;pywin.debugger.set_trace()

Also note that 'pywin.debugger.set_trace()' can be used anywhere if
you're trying to 'keep' breakpoints in the code without relying an an
IDE or project tracking them for you.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: I'm just an idiot when it comes logging

2005-03-23 Thread olsongt

Vinay Sajip wrote:
>  verizon.net> writes:
>
>
> Handlers normally process all events passed to them, but you can set
a level on
> a handler to get it to drop events below a certain threshold. Since
you haven't
> done this, you will see an INFO message appear even though the root
logger's
> level is set to ERROR. (This would only affect logging calls to the
root logger).
>
> Rule of thumb: Set levels on handlers only when you need them, not as
common
> practice. If you don't want to see info messages from otherLogger,
set its level
> to > INFO.
>
> Vinay Sajip

Thanks Vinay,

By adding a handler with a level of ERROR I fixed my problem.  Things
are starting to make sense.  I just feel like a logger should filter
out any messages below its error level instead of sending them to its
handlers.  But that is obviously not the case.  I just need to get used
to it.

-Grant

-- 
http://mail.python.org/mailman/listinfo/python-list


I'm just an idiot when it comes logging

2005-03-20 Thread olsongt
I'm trying to be a good boy and use the logging module but it's
behaving rather counter-intuitively.  I've posted a simplified test
script below.

To summarize, I've set the basic config to only log root level messages
with >= ERROR level.  I've created another named logger that logs on
info level.  I've set it up so it just shows the message text without
"INFO:: logger:" boilerplate.

The way I see things, when I call otherLogger.info, it should propogate
the message to the root logger, but the root logger should discard it
since it is at ERROR level.

Could someone explain what I'm not getting?

-Grant

###
### logging_test.py
###

import logging

logging.basicConfig(level=logging.ERROR)

root = logging.getLogger('')

otherLogger = logging.getLogger("logger")
otherLogger.setLevel(logging.INFO)

console = logging.StreamHandler()
console.setLevel(logging.INFO)
formatter = logging.Formatter("%(message)s")
console.setFormatter(formatter)

otherLogger.addHandler(console)

root.info("Shouldn't print") # lower level
root.error("Should Print") #higher level

otherLogger.info("Should only print once")

root.info("Shouldn't print") # lower level

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pyasm 0.2 - dynamic x86 assembler for python

2005-03-13 Thread olsongt
[JanC]
> The code below makes it possible to write assembler code for
different
> architectures (in case pyasm ever supports that ;) and also a Python
> code version to use when running on a system where no assembler code
> can be used.  It prints:

[Michael]
> Another (perhaps wacky) approach would be to change the assembler
> source syntax
> enough to make it legal Python - in particular, this means
parenthesizing
>the
> arguments - then it can just be stored in-line with other Python
source. This
> has the additional benefit that one could write support functions to
enable
> the
> source to be executed interactively in Python.
>
> The following example uses the CPython opcodes, represented as Python

> functions.
>  Python control structures 'while' and 'if' are used as assembler
directives
> for flow.

I've been trying to come up with responses to these two posts, but I'm
just plain speechless.  That should be taken as a complement.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyAsm

2005-03-11 Thread olsongt
I haven't checked PyPy out lately.  I was under the impression the
Pyrex/C backend was still doing static compilation.  Guess I'll have to
take a look.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyAsm

2005-03-10 Thread olsongt
Hey Roger,

I didn't realize that Stefan replied to the list and sent a private
email reply.  There seemed to be a lag in google groups today.  I
basically told him that I might be crazy enough to write an assembler
in python, but I'm not crazy enough to start using those function
decorators.

I'm working more on the backend stuff now but I was considering adding
the hook. I never realized that you couldn't use string interpolation
on a docstring, so that's probably the showstopper.  I don't want to
take that functionality away.

I was thinking that the decorator could cheat and just swallow the
originating docstring when returning the assembly function.
Introspection based tools (which I'm assuming epydoc is) would only see
the new docstrings on the assembly function.  Not that I have docstring
functionality built in yet but it's on the todo list.  Size also isn't
an issue because I'm currently using a string anyway.  But lack of
string interpolation is an issue.

-Grant

P.S.  Where'd you get that cool source code formatter for BitPim ;-)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pyasm 0.2 - dynamic x86 assembler for python

2005-03-08 Thread olsongt
>
> #
> ## helloWorld.py
> ## assembly hello world script
> #


DOH! The example file got truncated.  Here it is.

#
## helloWorld.py
## assembly hello world script
#

from pyasm import pyasm

pyasm(globals(),r"""
 !CHARS hello_str 'Hello world!\n\0'

 !PROC hello_world PYTHON
 !ARG  self
 !ARG  args

  PUSH hello_str
  CALL PySys_WriteStdout
  ADD ESP, 0x4
  MOV EAX,PyNone
  ADD [EAX],1
 !ENDPROC
 """)

hello_world()

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT: google groups bug, or worse?

2005-01-07 Thread olsongt

[EMAIL PROTECTED] wrote:
> I'm concerned that google groups is not correctly reflecting the
> python lists.  A month ago I announced the xsdbXML framework to the
> python list and the python-announce list.  As you can see from the
> links
> below the python announce submission was approved by the moderators
> (thanks!)
> and the python list submission also went out, but the messages cannot
> be found at google groups.
>
>
http://mail.python.org/pipermail/python-list/2004-December/254479.html
>
http://mail.python.org/pipermail/python-announce-list/2004-December/003583.html
>
> Is it a google bug?  Or is it something darker, like an anti-Python
> conspiracy at google?
>
> Inquiring minds want to know.
>
> -- Aaron Watters
>
> ===
> There are 3 kinds of people, those who can count and those who can't.
> -- folklore.

Exact same thing happened to me on Jan 2nd.

-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: PyXR 0.9.4 - Cross-Referenced HTML from Python Source

2005-01-01 Thread olsongt
PyXR 0.9.4 - Cross-Referenced HTML from Python Source

PyXR generates pretty-printed HTML pages from python source files to make 
source browsing easier.  It provides extensive cross-referencenced hyperlinks 
that integrate with the Python Library Reference as well as other python source 
files.  Its cross-referencing capabilities are vastly superior to other source 
pretty-printing packages that I've seen.

0.9.4 provides compatibility with the new language semantics in Python 2.4 and 
addresses changes to the format of the Library Reference Manual, in addition to 
a littany of smaller fixes.  Previous versions WILL NOT work with python 2.4.  
This release does provide backward compatibility to python versions as early as 
2.2 and should work on all major OSes.

PyXR is available for download here:
http://sourceforge.net/projects/pyxr/

PyXR'ed markup of Python 2.4's source is available here:
http://pyxr.sourceforge.net/PyXR/

Detailed release notes are available here:
http://pyxr.sourceforge.net/

Enjoy!

-- 
http://mail.python.org/mailman/listinfo/python-list