Re: Interop between C# and Python

2007-04-28 Thread Ravi Teja
On Apr 27, 8:25 pm, urielka <[EMAIL PROTECTED]> wrote:
> thx i will try this.
>
> i am also trying XML-RPC,i wrote a basic generator(in python) that
> genrate a Interface from the XML-RPC service module,but maybe with
> soaplib i don`t need this if i use wsdl as Visual Studio can generate
> the code from the wsdl

Typed remoting mechanisms (SOAP, CORBA, ICE etc) tend to be less work
with statically typed languages like C#. Untyped remoting mechanisms
are more convenient to work with dynamic languages (XML-RPC, JSON-RPC
etc). When combining them, typed one are more convenient because
working with typed systems is more convenient in dynamic languages
than it is to work with untyped systems in typed languages. Of course,
if the project is really small, none of this really matters. Pick your
poison.

Ravi Teja.

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


Re: Interop between C# and Python

2007-04-27 Thread Ravi Teja
On Apr 27, 6:09 pm, urielka <[EMAIL PROTECTED]> wrote:
> i need a easy way to write a Python Service(be it SOAP or JSONRPC or
> whatever) but i need to easily access it from C#,i created a web
> service in ZSI(which is really easy) like this:
>
> from ZSI import dispatch
>
> def hello():
> return "hello"
>
> dispatch.AsServer(port=8080)
>
> simple and easy but how i access it from C#,where is the wsdl for the
> service?
>
> is there any easier way to get this kind of interop?(not using a
> custom protocol over sockets)
>
> thx,
>Uriel Katz

Use soaplib instead of ZSI. It has better WSDL support which makes it
easier to create client stubs from other languages.

http://trac.optio.webfactional.com/

Ravi Teja.

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


Re: Helpbook and CHM

2007-04-19 Thread Ravi Teja
> > > > Teja wrote:
> > > > > how to generate CHM files in Boa(Python)???
>
> > > >http://www.rutherfurd.net/software/rst2chm/index.html
>
> > > > TJG
>
> > > Can't I do it in Boa constructor ??? I have seen an option in Boa to
> > > create a new helpbook and compile it to CHm and help files, But no
> > > clue how to do it...
>
> > Not that I know of. Which version are you using? Where in the
> > application did you find it? Indicate the menu's you navigated to get
> > to that option.
>
> > MS HTML Help Workshop is the standard compiler for CHM files. There
> > are some other freeware/shareware. The workshop is simple enough
> > though.
>
> If u have Boa constructor 0.4.4, Go to File--->New--->helpbook
>
> Save it. After saving, click File menu option and you will find, "make
> HTB" and "make CHM"
> But I dont know how to add files and generate a complete CHM file.

Right-click the file list view and select "Add files". I didn't see
this Helpbook feature before. However, I could not get it to compile
after that. Unless, Boa Constructor is doing something while building
CHMs that integrates with the app development, I recommend that you
try a specialized tool for the job instead. Boa was an extremely
promising tool when I saw it about 6 yrs ago or so at 0.0.1 (it
already had a streamlined WYSIWYG GUI builder with a code aware editor
back then, something we still don't have elsewhere for Python). But
the development never seemed to gather steam since then. 0.4.4 is not
even listed as a release on the home page and it is almost 2 yrs old.

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


Re: Helpbook and CHM

2007-04-19 Thread Ravi Teja
On Apr 19, 3:58 am, Teja <[EMAIL PROTECTED]> wrote:
> On Apr 19, 3:48 pm, Tim Golden <[EMAIL PROTECTED]> wrote:
>
> > Teja wrote:
> > > how to generate CHM files in Boa(Python)???
>
> >http://www.rutherfurd.net/software/rst2chm/index.html
>
> > TJG
>
> Can't I do it in Boa constructor ??? I have seen an option in Boa to
> create a new helpbook and compile it to CHm and help files, But no
> clue how to do it...

Not that I know of. Which version are you using? Where in the
application did you find it? Indicate the menu's you navigated to get
to that option.

MS HTML Help Workshop is the standard compiler for CHM files. There
are some other freeware/shareware. The workshop is simple enough
though.

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


Re: ZSI, SOAP and .NET web services - problem

2007-03-26 Thread Ravi Teja
On Mar 26, 3:47 pm, Jaroslaw Zabiello <[EMAIL PROTECTED]> wrote:
> Dnia Mon, 26 Mar 2007 20:06:28 + (UTC), David E. Konerding DSD staff
> napisa³(a):
>
> > Try fixing your WSDL, then try again.
>
> The problem is I see no errors in my WSDL. Pythonic implementation of SOAP
> is just crapy.
>
> --
> Jaroslaw Zabiellohttp://blog.zabiello.com

As Lawrence suggested, did you try soaplib? It is a newer project. Try
the more recent svn version
svn co https://svn.optio.webfactional.com/soaplib/trunk soaplib

In my experience, it is more compliant than ZSI, although I mainly
used it as a server than a client.

Ravi Teja.

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


Re: Help me with this!!!

2007-02-01 Thread Ravi Teja
> > > It search a text inside that hex value.
> > > It works perfecly on a txt file but if I open a binary file (.exe,.bin
> > > ecc...) with the same value it wont work, why?
> > > Please help!
>
> > Because the pattern isn't in the file, perhaps.
>
> This pattern IS in the file (I made it and I double check with an hex
> editor).
> It display the file correcltly (print line) but...

No! Peter is right. Regular expressions match ASCII representation of
data, not hex. In simple terms, do you see your pattern when you open
the file in notepad (or other text editor)? You do not use regex to
search binary files.

Ravi Teja.

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


Re: Hi, I'm new to python

2007-01-27 Thread Ravi Teja


On Jan 27, 5:37 am, [EMAIL PROTECTED] wrote:
> Hey Everyone
>
> Let me tell you all a little bit about my programming background so
> you can get an idea of my capability, or lack of, dealing with p.l;
> so far i've learned some visual basic when i was doing my a-levels
> and thats about it lol.
>
> Basically i like the sound of python and its ease of use and would
> like to know in depth more about it and its range of useage.  Please
> do tell me all you know, keeping in mind i am a n00b, so do be
> gentle. :)
>
> Thanks
> Millball54

Start Here
http://www.python.org/doc/
There is a ton of documentation tailored to learners with differing 
skills.

You might also want to pick up a book on Python.

Be sure to read the docs, use Google, search this group for similar 
questions in the past before you post questions. They are great 
resources. If you have very basic questions, IRC (freenode has a 
Python channel), is a better option. When you post, make the question 
as specific as possible. Sometimes typing a good question itself gives 
you an answer.

Ravi Teja.

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


Re: While loop with "or"? Please help!

2007-01-25 Thread Ravi Teja

> while usrinp != "y" or "Y" or "N" or "n": <<<<PROBLEM

Correct way:
while usrinp != "y" or usrinp != "Y" or usrinp != "N" or usrinp != "n":
There has to be a boolean evaluation on both sides of or.

Or in this case:
while usrinp not in ['Y', 'y', 'N', 'n']:

Ravi Teja.

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


Re: How to convert a string into an integer

2007-01-22 Thread Ravi Teja

[EMAIL PROTECTED] wrote:
> Can you please tell me why the following code does not work in python?
> My guess is I need to convert 'count' from a string to an integer. How
> can I do that?
> And my understanding is python is a dynamic type language, should
> python convert it for me automatically?
>
> count = sys.argv[2]
> for i in range(count):
> #do some stuff
>
> Thank you.

You are confusing dynamic typing with weak typing. Weakly typed
languages (such as BASIC perform) such implicit conversions.

However, Python is dynamically and strongly typed.

With dynamic typing, the type information resides with the actual
object and not with the name referring to it. That simply means that
the type cannot be determined till the object is actually created (i.e
till runtime). But once created, the object does have a type.

So you will need to explicitly convert yourself. In this case with
int_value = int(string_value)

Ravi Teja.

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


Re: confused on python rpc with apache, is it possible?

2007-01-19 Thread Ravi Teja

krishnakant Mane wrote:
> On 19/01/07, Diez B. Roggisch <[EMAIL PROTECTED]> wrote:
> >
> > I'm unclear why you want the apache in there in the first place. Why don't
> > you just create an e.g. twisted-based XMLRPC-server, and simply let that
> > run? What is the apache intended for?
>
>
> twisted-based? what is that?  what is that.
> I am very new to xml-rpc so my questions may sound very basic.

All you have to do is Google when you have very basic questions
For example: twisted python xmlrpc

> any ways apache is doing nothing in there but I thought that if some
> thing needs to be done in php in the future then apache better be
> there but as I said that is no need if pythone can do it on a stand
> alone basis.

Use mod_python with some xmlrpc handler. There is more than one around.
Google for them. That way you can keep Apache for both Python and PHP.

Ravi Teja.

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


Re: Making a simple script standalone

2007-01-18 Thread Ravi Teja


On Jan 18, 2:19 pm, Rikishi 42 <[EMAIL PROTECTED]> wrote:
> On Thursday 18 January 2007 10:13, robert wrote:
>
> > stay with py23 for "a script" (and more) and make <700kB
> > independent distros - UPX and 7zip involved:
>
> >http://groups.google.com/group/comp.lang.python/msg/edf469a1b3dc3802Thanks, 
> >that might be an option. But I might just convince the person to
> let me install Python.  :-(

Like you note, it is far simpler to just install Python. Rarely does a
proper cost benefit analysis show any advantage for all the time you
put in for saving a few MB off the installer (since you noted that you
got it working with Py2Exe), especially when you seem to be installing
the app for just one person. How big is your Exe with Py2Exe? Say 3MB?
Is making it 1 MB worth maybe 2 hrs of your time for 1 install?

But just for kicks, check out ShedSkin. Since you mentioned that you
were using very few modules (ShedSkin supports os, stat, string, time),
it might just work. ShedSkin translates your Python code to fast C++
code that can be compiled to a tight app.

http://sourceforge.net/projects/shedskin/

Ravi Teja.

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


Re: I need to consume a .NET web service in a Python client

2007-01-12 Thread Ravi Teja

mohit wrote:
> Hello,
>
> I am a .NET developer experimenting with Python.
> I need to consume a .NET web service in a Python client. how do I go
> about it?
> which libraries do i need?
> pointers to help me get started would be much appreciated.
> I am just a newbie to the Python world so please be bear with my novice
> queries.
>
> thanks in advance,
> Mohit


Start Here
http://www.diveintopython.org/soap_web_services/index.html
Example Client
http://www.diveintopython.org/soap_web_services/first_steps.html

Ravi Teja

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


Re: How to write temporary data to file?

2007-01-08 Thread Ravi Teja

Thomas Ploch wrote:
> Ravi Teja schrieb:
> > Thomas Ploch wrote:
> >> Hi folks,
> >>
> >> I have a data structure that looks like this:
> >>
> >> d = {
> >>'url1': {
> >>'emails': ['a', 'b', 'c',...],
> >>'matches': ['d', 'e', 'f',...]
> >>},
> >>'url2': {...
> >> }
> >>
> >> This dictionary will get _very_ big, so I want to write it somehow to a
> >> file after it has grown to a certain size.
> >>
> >> How would I achieve that?
> >>
> >> Thanks,
> >> Thomas
> >
> > Pickle/cPickle are standard library modules that can persist data.
> > But in this case, I would recommend ZODB/Durus.
> >
> > (Your code example scares me. I hope you have benevolent purposes for
> > that application.)
> >
> > Ravi Teja.
> >
>
> Thanks, but why is this code example scaring you?
>
> Thomas

The code indicates that you are trying to harvest a _very_ (as you put
it) large set of email addresses from web pages. With my limited
imagination, I can think of only one group of people who would need to
do that. But considering that you write good English, you must not be
one of those mean people that needed me to get a new email account just
for posting to Usenet :-).

Ravi Teja.

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


Re: How to write temporary data to file?

2007-01-08 Thread Ravi Teja

Thomas Ploch wrote:
> Hi folks,
>
> I have a data structure that looks like this:
>
> d = {
>   'url1': {
>   'emails': ['a', 'b', 'c',...],
>   'matches': ['d', 'e', 'f',...]
>   },
>   'url2': {...
> }
>
> This dictionary will get _very_ big, so I want to write it somehow to a
> file after it has grown to a certain size.
>
> How would I achieve that?
>
> Thanks,
> Thomas

Pickle/cPickle are standard library modules that can persist data.
But in this case, I would recommend ZODB/Durus.

(Your code example scares me. I hope you have benevolent purposes for
that application.)

Ravi Teja.

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


Re: private variables

2007-01-08 Thread Ravi Teja

belinda thom wrote:
> Hello,
>
> In what version of python were private variables added?
>
> Thanks,
>
> --b

Short answer - 1.5 (or - so long ago that it doesn't matter anymore)
Long answer - There are no true private variables in Python. Just
private variables names by convention.

See Python docs for a detailed explanation.

Ravi Teja.

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


Re: Network failure when using urllib2

2007-01-08 Thread Ravi Teja

[EMAIL PROTECTED] wrote:
> I am fetching different web pages (never the same one) from a web
> server.  Does that make a difference with them trying to block me?
> Also, if it was only that site blocking me, then why does the internet
> not work in other programs when this happens in the script.  It is
> almost like something is seeing a lot of traffic from my computer, and
> cutting it off thinking it is some kind of virus or worm.  I am
> starting to suspect my firewall.  Anyone else have this happen?
>
> I am going to read over that documentation you suggested to see if I
> can get any ideas.  Thanks for the link.
>
> Shuad

No! What I suggested should not effect traffic from other servers. I
would go with Gabriel's suggestion and check for open connections just
in case. Although I can't imagine why that would give you a 404
response since it is a server response (implies successful connection).
I would expect that you would get a client error in such a case.

Of course, you can always rule out your suspicions of local conditions
(turn off security software briefly or try from a different machine)
unless your ISP is implementing safeguards against DOS attacks from
their network with normal users in mind.

Ravi Teja.

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


Re: Network failure when using urllib2

2007-01-08 Thread Ravi Teja

[EMAIL PROTECTED] wrote:
> I have a script that uses urllib2 to repeatedly lookup web pages (in a
> spider sort of way).  It appears to function normally, but if it runs
> too long I start to get 404 responses.  If I try to use the internet
> through any other programs (Outlook, FireFox, etc.) it will also fail.
> If I stop the script, the internet returns.
>
> Has anyone observed this behavior before?  I am relatively new to
> Python and would appreciate any suggestions.
>
> Shuad

I am assuming that you are fetching the full page every little while.
You are not supposed to do that. The admin of the web site you are
constantly hitting probably configured his server to block you
temporarily when that happens. But don't feel bad :-). This is a common
Beginners mistake.

Read here on the proper way to do this.
http://diveintopython.org/http_web_services/review.html
especially 11.3.3. Last-Modified/If-Modified-Since in the next page

Ravi Teja.

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


Re: program deployment

2007-01-05 Thread Ravi Teja

king kikapu wrote:
> hi to all folks here,
>
> i am learning Python, just finished a book and i am starting to write
> programs.
> I just want to ask, is the "correct" way to deploy my programs to other
> computers, the .pyc files ??
>
> I now that with the "-m compileall ." switch can compile a .py file
> into bytecodes. So i suppose that if Python has to run a .pyc file, it
> will load and execute it faster. And if i have some "sensitive" data in
> my source, like passwords (and the source of cource!) they will be more
> secure in a compiled file.
>
> Is that correct ?
>
> Thanks a lot for any help!

Python code is normally deployed as straight source code. It gets
compiled  automatically on its first run and will subsequently load
this quickly. Passwords do not belong in the source code and they are
not secure simply by distributing bytecode instead. This applies to any
language, native or byte code compiled. Distributing bytecode may deter
non-technical users but that's just about it.

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


Re: How do I add users using Python scripts on a Linux machine

2007-01-02 Thread Ravi Teja
> >
> > How about invoking scripts with SUID root set?
>
> Linux seems to ignore SUID bit on scripts:

Yes. My bad. The work around was to use native launchers. I don't
remember the details. Perhaps with the interpreter embedded to launch
it in-process and to hard code the script paths (or at least a config
file/script pointing to them) for security.

> Anyway, you should definitely think about security issues. Not all
> people out there are friendly...

I agree. SUID is often risky.

Web applications such as webmin that do administrative functions
through a web interface require extra precautions for security such as
restricting access to specific IPs.

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


Re: How do I add users using Python scripts on a Linux machine

2007-01-02 Thread Ravi Teja

Ivan Voras wrote:
> Ramdas wrote:
> > Well,
> >
> > I need to add users from a web interface for a web server, which runs
> > only Python. I need to add users, set quotas and in future even look at
> > managing ip tables to limit bandwidth.
> >
> > I know os.system(), but this has to be done through a form entry
> > through a web interface.
> >
> > Anyways thanks, do advise if there more pythonic solutions
>
> What you're looking for is actually a pretty complex thing. You *could*
> in theory manage /etc/passwd (and its "shadow" file) - you can find
> crypto primitives like MD5 and DES on the 'net, but note that you must
> run your script under the 'root' account in order to write (and even
> read!) the passwd database. The same goes for using os.system and the
> built-in OS utility. Be aware of security implications if you're running
> your web server under the root account.

How about invoking scripts with SUID root set?

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


Re: C app and Python

2006-12-31 Thread Ravi Teja

Vertilka wrote:
> Hi,
> I need to create an application that the user ask for python script to
> run.
> this script will call the C application functions (in my app. the
> function will draw on screen).
>
> Do I need to create an extension ? Note that this is not a DLL, but a C
> application.
> or I need to embed Python in my C application.
>
> Thanks,
> Vertilka

A bit of both :-)
http://www.python.org/doc/ext/extending-with-embedding.html

Ravi Teja.

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


Re: keypressed() function

2006-12-28 Thread Ravi Teja

[EMAIL PROTECTED] wrote:
> I need a function (blocking or non-blocking) that tells me if a key has
> been pressed (even before it has been released etc.). Also, I would of
> course like to know _which_ key has been pressed.
>
> I know that this probably does not exist in the Python library already
> as a platform-independant abstraction (even though it probably could),
> but then I would at least like solutions that works on Windows and on
> Linux.

Hmm.. 2 questions on this today. On Windows PyHook will work. It
signals for both Key Up and Key Down events. However it is a Windows
only module making use of very platform specific API. I am not sure if
there is an equivalent for Linux.

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


Re: Reverse of SendKeys??

2006-12-28 Thread Ravi Teja

Scripter47 wrote:
> Hey!
>
> I know there is a module named SendKeys.
> SendKeys module it can type strings as you where typing it, on the keyboard.
> But is there a module that does the reverse. A module that gets
> _anything_ what the keyboard writes.
> For example. If i type "hey" on my keyboard. Will the program get the
> string even if the program not is on focus..

PyHook is what you need.
http://www.cs.unc.edu/~parente/tech/tr08.shtml
It can signal for both global keyboard as well as mouse events.

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


Re: Scaling pictures

2006-12-28 Thread Ravi Teja

Kajsa Anka wrote:
> I would like some advice, I'm going to build a small app that will, among
> other things, scale images so that they can be published on a web site. I've
> never done any image processing in python before so I would like to ask what
> is the best way of doing this, I will not do anything else than scaling the
> images.
>
> I found the Python Imaging Library but before I dive into that I would like
> to know if there is a better way of doing this.

Yes. Python Imaging Library (PIL) is the preferred Python way to do
this. The example is right in the documentation.
http://www.pythonware.com/library/pil/handbook/image.htm

from PIL import Image
import glob, os

size = 128, 128

for infile in glob.glob("*.jpg"):
file, ext = os.path.splitext(infile)
im = Image.open(infile)
im.thumbnail(size, Image.ANTIALIAS)
im.save(file + ".thumbnail", "JPEG")

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


Re: Xah's Edu Corner: Introduction to 3D Graphics Programing

2006-12-27 Thread Ravi Teja

Xah Lee wrote:

> Regarding VisualPython... i saw a demo in 2002 by a professor
> friend. I think it is good. Though, why is its licensing not GPL or
> otherwise Open Source? That's kinda odd since Pyhton is.

You are confusing VPython with Activestate's Visual Python IDE plugin
for Visual Studio.
>From VPython's home page in very bold font - "VPython is free and
open-source"
http://www.vpython.org/

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


Re: merits of Lisp vs Python

2006-12-17 Thread Ravi Teja

Jean-Paul Calderone wrote:
> On 11 Dec 2006 03:01:32 -0800, Ravi Teja <[EMAIL PROTECTED]> wrote:
> >Timofei Shatrov wrote:
> >
> > [snip]
> >
> >Of course, doctest is hardly the ultimate testing solution. But it does
> >an admirable job for many cases where you don't need to setup elaborate
> >tests.
> >
> >> It's not surprising that no one uses this stuff for serious work.
> >
> >I have seen enough libraries that use doctest. Zope, Twisted and Paste
> >are some of the popular Python projects in that use it. Epydoc supports
> >it as well.
>
> Just as a factual correction, Twisted does not use doctests.
>
> Jean-Paul

You are right. I did a quick search on my Python Lib folder for that
post to list some well known projects. Twisted does have some doctests
in there but does not use them for actual testing (apparently, only to
check for doctest support).

Ravi Teja.

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


Re: merits of Lisp vs Python

2006-12-13 Thread Ravi Teja

Robert Uhl wrote:
> "Ravi Teja" <[EMAIL PROTECTED]> writes:
>
> > Mark Tarver wrote:
> >>
> >> seems to show that Python is a cut down (no macros) version of Lisp
> >> with a worse performance.
> >
> > By that standard, every other mainstream dynamically typed language
> > for you is a cut-down version of Lisp with worse performance.
>
> Pretty much;-)
>
> Fewer features, worse performance.  Why use 'em?

Usability. Especially when users quote a very significant difference
here.

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


Re: merits of Lisp vs Python

2006-12-11 Thread Ravi Teja

Mark Tarver wrote:
> Paul Rubin wrote:
> > "Mark Tarver" <[EMAIL PROTECTED]> writes:
> > > How do you compare Python to Lisp?  What specific advantages do you
> > > think that one has over the other?
> >
> >
>
> Thanks;  a quick read of your reference to Norvig's analysis
>
> http://norvig.com/python-lisp.html
>
> seems to show that Python is a cut down (no macros) version of Lisp
> with a worse performance.

By that standard, every other mainstream dynamically typed language for
you is a cut-down version of Lisp with worse performance.

> The only substantial advantage I can see is
> that GUI, and Web libraries are standard.

Somehow you conveniently miss the fact that he stated that it is ...
1. An excellent language for his intended use.
2. Easy to use and learn.
3. Easier to read than Lisp.
4. Looks more like pseudo code than does Lisp.

Here is a quote from the same Peter Norvig

"Python has been an important part of Google since the beginning, and
remains so as the system grows and evolves. Today dozens of Google
engineers use Python, and we're looking for more people with skills in
this language."

http://www.python.org/Quotes.html

> This confirms my suspicion
> that Lisp is losing out to newbies because of its
> lack of standard support for the things many people want to do.

You confirm things too easily :-).

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


Re: merits of Lisp vs Python

2006-12-11 Thread Ravi Teja

Timofei Shatrov wrote:
> But, you have to admit that it looks horrible (at least at the first glance). 
> If
> there's some programming style that I absolutely can't stand, it would be the
> one where programmer writes a huge block of commentary describing what a
> function does, followed by one-liner of code

You Sir, are no fan of Literate Programming :-).

> information in itself. With doctest it is even worse, because examples also
> contain superfluous information. Everyone can just copy-paste the code in REPL
> and see what happens when you execute it.

And doctest automates such REPL tests. Like macros, don't knock it till
you try it.

> Besides that, there are many reasons
> why tests should be stored in a separate file, or at least not in the same
> function that they are testing.

You need not have doctest as a part of source code. You can also create
a separate documentation file that contains prose as well as tests
intervening.

http://www.python.org/doc/lib/doctest-simple-testfile.html

Combine it with ReStructured Text and you have a wonderful
documentation and testing solution in one place. Personally, I like
this a lot better than Javadoc style documentation where usage examples
are often absent.

> Also Wikipedia article contains some "Cons of doctest" that look pretty nasty:

Of course, doctest is hardly the ultimate testing solution. But it does
an admirable job for many cases where you don't need to setup elaborate
tests.

> It's not surprising that no one uses this stuff for serious work.

I have seen enough libraries that use doctest. Zope, Twisted and Paste
are some of the popular Python projects in that use it. Epydoc supports
it as well.

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


Re: merits of Lisp vs Python

2006-12-11 Thread Ravi Teja

Kaz Kylheku wrote:
> Paddy wrote:
> >   http://en.wikipedia.org/wiki/Doctest
>
> I pity the hoplelessly anti-intellectual douche-bag who inflicted this
> undergraduate misfeature upon the programming language.
>
> This must be some unofficial patch that still has a hope of being shot
> down in flames, right?

Sour grapes. Eh :-)
Or were you going to follow up with some intellectual argument to
support your adjectives?

1. pity
2. hopelessly
3. anti-intellectual
4. douche-bag
5. inflicted
6. undergraduate
7. misfeature
8. unofficial patch
9. shot down in flames

That's a lot of hate in 2 sentences for judging a novel feature you
barely came across.

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


Re: SOAP Server with WSDL?

2006-12-07 Thread Ravi Teja

tobiah wrote:
> Actually, do I have to make a WSDL?  Do people hand write these, or
> are there tools?  I don't really need to publish an interface.  I just
> want some in house apps to communicate.

Java and .NET based tools can auto-generate WSDL from code. Python does
not have such because function definitions do not contain the type
information required for such a tool. However , you can grab a free
Java (Netbeans with Enterprise pack) or .NET (Visual Studio Express)
IDE (or just the respective SDK if you don't mind reading through the
docs), create a stub function, mark it as a WebMethod, let it generate
the WSDL and pass it to wsdl2py that comes with ZSI. This is a twisted
approach.

But you state that you don't need to publish an interface. If that is
the case, it can be as simple as this.

  import SOAPpy
  def hello():
  return "Hello World"

  server = SOAP.SOAPServer(("localhost", 8080))
  server.registerFunction(hello)
  server.serve_forever()

Pasted from
http://pywebsvcs.sourceforge.net/soappy.txt

> I can't figure out if I want SOAP, or CORBA, or would it just be
> easier if I just starting opening sockets and firing data around
> directly.  Ideally, I'd like to share complex objects.  That's why
> I thought that I needed one of the above standards.

I posted a few days ago a simple guide to choosing a remoting
framework.
http://groups.google.com/group/comp.lang.python/tree/browse_frm/thread/f53221adfca5c819/58057e83c0ad7c27?rnum=1&hl=en&q=webraviteja&_done=%2Fgroup%2Fcomp.lang.python%2Fbrowse_frm%2Fthread%2Ff53221adfca5c819%2F3f056c5c87279aca%3Flnk%3Dgst%26q%3Dwebraviteja%26rnum%3D4%26hl%3Den%26#doc_3f056c5c87279aca

For *complex* objects, you need a stateful remoting mechanism. The
choice is Pyro if both the server and all the clients are written in
Python. Else, use CORBA or ICE with DMI. All of these are simple to use
for simple remote object invocations although distributed computing in
general does have a learning curve.

Ravi Teja.

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


Re: How to compile omniORBpy on Windows?

2006-12-04 Thread Ravi Teja

[EMAIL PROTECTED] wrote:
> How do I compile omniORBpy 3.0 on Windows?  The readme.txt file seems
> to talk only about how to do this on Unix.  Unfortenuately, I can not
> use the binary because I need to use Python 2.3.5. (and the binary
> requires that I use Python 2.4).
>
> I tried to copy the omniORBpy 3.0 source code to top\src\lib of omniORB
> 4.1 and then tried to execute a "make export" in top\src (this did not
> compile omniORBpy).  I also tried a "make export" in
> top\src\lib\omniORBpy-3.0 and this fails.
>
> Note, I was able to compile omniORB 4.1 on Windows w/o a problem.  I am
> using VS .NET 2003 (VC 7) on W2K.
>
> Many thanks for your help.

This is certainly not the best advice. But how about just downloading
an older release which did support Python 2.3 (unless you want the
latest and greatest)?
http://downloads.sourceforge.net/omniorb/omniORBpy-2.6-win32-python2.3.zip?modtime=1115987834&big_mirror=1

Hopefully you will get a more pertinent reply from the OmniORB mailing
list :-).

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


Re: How to realize the interactive python in Eclipse?

2006-12-03 Thread Ravi Teja

purple wrote:
> I have installed the Eclipse and the plug-in Pydev. Also, I have add an
> python program in the external tools. When I run the python program in
> the external tools, i can type python command just like in the python
> shell.But when I finished running a python file, in the console, I
> could not type any command to check some argument generated in the
> process. Is there any way I can make it?
> thank you~~

I am beginning to wonder if you attempting to use PyDev as nothing more
than a programmer's editor. PyDev is a lot more. You need not debug
this way since it includes a visual debugger. Be sure to read the
documentation at the web site.

http://pydev.sourceforge.net/debug.html
http://pydev.sourceforge.net/faq.html

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


Re: Python script and C++

2006-11-27 Thread Ravi Teja
Thuan Seah Tan wrote:
> Hi all,
>
> I am new to python  and currently I am working on a traffic simulation
> which I plan to define the various agents using scripting. It's kind of like
> scripting for non-playable character in games. I am thinking of using python
> for this but I am concerned with running time. Is scripting a lot slower
> compared to direct implementation in C++? Does compiling the script help in
> any way?

Python is perfectly suitable for this use. Python was in use in video
games in this way when computers were a lot slower. I doubt that you
will need to bother compiling the script or see any observable
enhancement if you do.

One example I can remember is Kingdom Under Fire (2001).

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


Re: How good is CORBA?

2006-11-27 Thread Ravi Teja
On Nov 21, 11:20 am, "Sai Krishna M" <[EMAIL PROTECTED]> wrote:
> there are certainly client/server interactions.

But are they cross-language interactions?

This is how I would choose to distribute code.
Same machine, all in Python - organize in modules in Python path.
Different machines, all in Python - Pyro
Different machines, different languages, stateless calls, simple use -
XMLRPC/ReST
Different machines, different languages, stateless calls, more complex
requirements - SOAP
Different machines, different languages, statelful, typed - CORBA
(omniORB is the best bet at Python end)

ICE
A lot of the CORBA folks have been mad with ICE because it is subtly
discrediting CORBA while not being a standard. It is cleaner, comes
with good documentation, supports more languages than any single ORB
(however you are stuck with only those languages that ZeroC implements
support for). For simple apps, I would stick with omniORBPy. It is not
any more complicated than ICE. While ICE is simpler on the whole, you
will likely use only a fraction of the CORBA/ICE feature set. So the
difference won't necessarily show.

I like my tools to be simple. Lately, I have been happily using JSON
over HTTP.

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


Re: Will GPL Java eat into Python marketshare?

2006-11-16 Thread Ravi Teja
> Personally, I've never gotten jpype to work.  Is it just me, or is it
> a troublesome install?
>
> Harry George
> PLM Engineering Architecture

It works fine for me now. However, I do recall having an issue a while
ago (most likely me, rather than JPype).

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


Re: Programming Language that is Spreadsheet/Table Based

2006-11-05 Thread Ravi Teja
Omar wrote:
> I'm looking for a programming language or module that sorta looks and
> feels like MS Excel (I love and think in tables), yet has the power and
> open-endedness of python or javascript.  I'm still pretty new to
> python.

PyCells
http://pycells.pdxcb.net/
http://pycells.pdxcb.net/wiki/index.php?title=Basic_Tutorial

> any ideas?  i've been having some fun with VBA in excel
> but I want something I can save as en exe and call my own creation, y'know?

You can also do Excel automation using Python.
http://www.markcarter.me.uk/computing/python/excel.html

There are many packaging tools for Python. Py2exe is the most popular.
Although in Excel's case, it would be difficult to make stand alone.

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


Re: Rapid desktop application development

2006-10-19 Thread Ravi Teja

Stephen Eilert wrote:
> Hi all,
>
> There has been much hype lately about web "megaframeworks", like
> TurboGears, Django and Rails(Ruby side). Those are all fantastic
> frameworks, nicely integrated so that the user can focus on solving his
> problem, instead of doing all the scaffolding and framework integration
> by hand.
>
> Now, I am not a fan of web applications so I'm creating a few GUI
> applications using Python. Thanks to wxPython, those are all
> native-looking, with powerful components. This is quite nice. Now, I
> want to use some OR-Mapper, so I chose SQLObjects. This is nice too. I
> do have to write controllers, model, and all the glue code between the
> frameworks by hand.
>
> However, I don't have to do that with a framework such as TurboGears,
> for web applications. Everything is neatly integrated so that I just
> have to "fill in the blanks". It would be the same application, except
> that the presentation is GUI-based, instead of Web-based. MVC
> architecture too and so on.
>
> Are there any frameworks like those, for GUI applications? It would be
> interesting to abstract away that repetitive work.

Dabo
http://dabodev.com/

TraitsUI
http://code.enthought.com/traits/

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


Re: More Noob Questions

2006-10-19 Thread Ravi Teja
> 1) I'm also learning to program flash movies while I learn to do
> python.  How can one implement flash movies into their python code?

Depending on what "implementing flash movies into Python code" means.
Python and Flash can be complementary. You can develop the UI in Flash
and have it talk to Python via web services. I suppose that you can
embed the Flash Player control in a wxPython app as well and drive it
from there.

But such integrations typically deal with some slightly advanced issues
that are best left aside in context of a beginner.

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


Re: ADO with Python

2006-10-16 Thread Ravi Teja
Ralf wrote:
> Is their anybody with xperience in using the both and can provide me with
> some xamples.

Googling for python ado returns this simple tutorial
http://www.markcarter.me.uk/computing/python/ado.html

COM access in Python is straight forward with win32all.

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


Re: newbie IronPython compiled scripts speed question

2006-09-24 Thread Ravi Teja
In most cases, carefully examine why you need native code at all. Since
a good number of performance sensitive CPython modules are in fact
written in C to begin with, the improvements may not always be
significant.

I don't know about your application but here are some general
observations. Beginers are often enamored with native code. This is
normal. Unless your application is explicitly low level, native code is
not worth bothering with.

> thanks, I'll check out psyco's documentation, since unfortunately the
> scripts will be run on a Windows box, and using a compiler other than
> VC++ is not an option...

1.) mingw works quite well for writing Python extensions.
2.) ctypes is a great way to incorporate native code. Create a dll in
whatever native language you please and call it from Python.
3.) Since you are on just MS Windows, you can use COM to wrap your
native code.

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


Re: Running Python script from C++ code(.NET)

2006-09-23 Thread Ravi Teja
> A trivial question - I have a working Python script that I have to
> invoke from C++ code. No fancy stuff - just run the whole script with
> its parameters. No callbacks, no signalling - nada, just
> stupid,primitive, straightforward call.
>
> And while there is a lot of help on embedding, I could not find out how
> to run script as a whole.SOS

System::Diagnostics::Process::Start

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


Re: Running Python script from C++ code(.NET)

2006-09-23 Thread Ravi Teja
> A trivial question - I have a working Python script that I have to
> invoke from C++ code. No fancy stuff - just run the whole script with
> its parameters. No callbacks, no signalling - nada, just
> stupid,primitive, straightforward call.
>
> And while there is a lot of help on embedding, I could not find out how
> to run script as a whole.SOS

System::Diagnostics::Process::Start

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


Re: Writing Video conference software for Windows

2006-09-22 Thread Ravi Teja
> Someone said about VNC... I'll take a look, but since it is an
> exercise I need to do it,

Exercises typically need you to implement, not invent (leave that for a
thesis or a dissertation). Rather than invent VNC, you could just
implement it on your own from the specs.

http://realvnc.com/docs/rfbproto.pdf

> I can't just say someone else arelady did that :)

No. But you can build upon it :-). Few construct software from the
scratch.

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


Re: Writing Video conference software for Windows

2006-09-21 Thread Ravi Teja
> I need to write a software that allow to see the desktop

That would be the VNC protocol. Don't reinvent the wheel.

VNC is relatively efficient in that it only updates the portions of the
screen that changed.

Maybe this project could be your starting point.
PyVNC
http://bdash.net.nz/blog/2005/07/17/pyvnc-the-beginnings-of-a-python-vnc-client/

> and hear the
> microphone capture of a remote PC across a network.
> I need to do that
> for a unviresity assignement. The software must  run on Windows. Since
> I like Python very much I am thinking to write that software in
> Python. Do you thinkit is a good choice? Are there libraries for audio
> compression (OGG or MP3 or maybe GSM or something like realaudio)

PyMedia can record and it works for mp3 and oggs.

> and video compression (btw what can be some good libraries to transmit
> images of a desktop in a bandwidth-efficent way?).

See above. You can lossy compress images in VNC.

> (Probably i will need some Win32 system call,
> there are bindings in Python, aren't they?)

The above modules should take care of everything. BTW, PIL can take
screen shots if you want to do this manually.

You need to create a streaming server for audio. Take a look at Edna, a
streaming MP3 server. http://edna.sourceforge.net/

Also of interest ... Twisted and Shtoom.

And finally... since you are on Windows - you can just try using the
NetMeeting ActiveX control through Python. It already does everything
you want.

Disclaimer: While I tinkered with many of the above, I have not used
most of the above projects recently. These are just leads for you to
explore.

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


Re: include statement

2006-09-19 Thread Ravi Teja
> is it possible in python to include another python source file into the
> current namespace, i.e.completely analogous to the #include statement
> in C.

By using a pre-processor, like C does.
http://www.freenet.org.nz/python/pyp/

If you are new to Python, keep in mind that this is for special cases
only. Since Python has a module system, there isn't a need for #include
as in C.

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


Re: RegexBuddy (anyone use this?)

2006-09-16 Thread Ravi Teja

[EMAIL PROTECTED] wrote:
> Has anyone tried this thing..
> http://www.regular-expressions.info/regexbuddy.html
>
> If I had $30 would this be worth getting or should I just try to learn
> the manual.  (I was hopeing the essential refrence would clear things
> up but I am downloading a gilgillion pages on the re module to try to
> learn it)
>
> http://www.dexrow.com

The time spent on reading about regular expressions will reward you
many times over. A tool is no substitute for that.

However, a visual tool does help in constructing complex expressions.
Python includes one such. Search for redemo.py

On Windows
C:\Python24\Tools\scripts\redemo.py

There are also several good open source tools on Sourceforge. Try them
out.

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


Re: auto fill out web form

2006-09-02 Thread Ravi Teja

Chris Smith wrote:
> Does anyone know of any python scripts that can help me automatically
> navigate through some forms so I can schedule the download the file at the
> end of all the questions?

ClientForm
http://wwwsearch.sourceforge.net/ClientForm/

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


Re: Python web service ...

2006-08-26 Thread Ravi Teja

Tim Williams wrote:
> > At this time right now I prefer to do something that works the quickest
> > possible...
> > I never had any experience with CGI, do I need to set up a web server
> > for that ?
> > can you point me some usefull reading material so I can get a start ?
> > I will post for a comment at Zope , I had installed once and it was
> > very easy. Don't know if it will be easy too to get my job done...
>
> If you need a quick-start and short learning curve,  Karrigell is the
> one to go for.   You can have the beginnings of your own site/web-app
> running within minutes of downloading it.
>
> It now has better CGI handling too - if you must go that route :)
>
> www.karrigell.com
>
> I recommend the Karrigell tour also,  click on the icon next to each
> example to see how each one is coded, and it has a file upload example
> that should get you started.
>
> http://karrigell.no-ip.info/demo/frame_tour_en.htm
>
> :)

I second Karrigell on simplicity. Zope despite recent improvements,
still has a steep learning curve.

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


Re: text editor suggestion?

2006-08-23 Thread Ravi Teja

John Salerno wrote:
> Ravi Teja wrote:
>
> > ???
> >
> > In the same file, near the top.
> >
> > keywordclass.python=and assert break class continue def del elif \
> > else except exec finally for from global if import in is lambda None \
> > not or pass print raise return try while yield
> >
> > I could add my own keywords to it.
> >
>
> But I don't want all my keywords to be highlighted in the same way. I
> have different colors for Python keywords, functions and methods,
> exceptions, other words like 'self', etc. and there's no way to do this
> without rewriting the lexer file (which is in C++) and recompiling Scite
> to build the changes into it.

I don't know if SciTE somehow supports function highlighting but the
properties file for php will perhaps give you some ideas on having
seperate groups with different highlight properties. I recall
repurposing something similar when I used to use Spyce for web apps.

http://mailman.lyra.org/pipermail/scite-interest/attachments/20050912/c9d5e51b/html-0001.obj

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


Re: text editor suggestion?

2006-08-22 Thread Ravi Teja

John Salerno wrote:
> Ravi Teja wrote:
>
> > Stick to SciTE. It takes almost no learning effort and meets everyone
> > of those requirements. As far as customerization goes, SciTE can be
> > customerized quite well. In fact, it can even be scripted with Lua. You
> > seem to be using the single file executable which does not come with
> > the configuration files. Otherwise, I cannot see how you could be
> > missing this ability.
>
> I really like Scite, but I find it's syntax highlighting abilities to be
> quite limited. You can't specify your own groups of words, you can only
> use what is already preset in the lexer files.

???

In the same file, near the top.

keywordclass.python=and assert break class continue def del elif \
else except exec finally for from global if import in is lambda None \
not or pass print raise return try while yield

I could add my own keywords to it.

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


Re: text editor suggestion?

2006-08-21 Thread Ravi Teja
> I also just started using Scite, and I really like it, except I find its
> syntax highlighting to be very inflexible. You aren't able to define
> your own groups of words -- you have to use what's given, basically. One
> thing I like about UltraEdit is that you simply define as many groups of
> keywords as you want and then assign a style to each one. Scite has a
> very strange and rigid method of highlighting.

Stick to SciTE. It takes almost no learning effort and meets everyone
of those requirements. As far as customerization goes, SciTE can be
customerized quite well. In fact, it can even be scripted with Lua. You
seem to be using the single file executable which does not come with
the configuration files. Otherwise, I cannot see how you could be
missing this ability.

Try this one instead if you are on Windows.
http://gisdeveloper.tripod.com/scite.html

You need to edit the file python.properties to add keywords.

Windows - C:\Program Files\SciTe\python.properties
Debian - /usr/share/scite/python.properties

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


Re: Python Editor with Autocorrection

2006-08-21 Thread Ravi Teja

Laurentiu wrote:
> hello!
>
>
> i am searching for a free python editor with
> autocorrection capabillities.
>
> for example:" the wrong setfocus() call to become
> SetFocus(), etc."
>
>
> thanks

Python is a dynamic language, which means that methods that may not
exist in your source code may spring to being at runtime at any point.
So it may be undesirable to have such feature. (For example, take a
look at an XML binding tool such as Amara which creates objects at
runtime after parsing an XML file).

Most good editors (Scintilla based editors, Emacs, Vi etc) have
auto-completion for symbols that have occured in the current file; and
some advanced IDEs (PyDev, WingIDE, SPE, Komodo etc) will auto-complete
to some degree based on your imports through static analysis.

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


Re: What would be the best way to run python client in the background

2006-08-21 Thread Ravi Teja
> The reason for the a seperate persistant check is because it will be
> used to enable software to be installed in whole lab of PCs but only
> allow a predifined number to run the software at any time one time.
> And then when a user stop using the software a licence will become
> available to for someone else on the same or another PC to use the
> software.  The reason that the process of the software being check is
> not used is because it will be used for software written by other
> people.  I hope this makes what and why a little clearer.  Let me know
> if you think that I have misunderstoood you.

Hmm... I don't have experience with such architecture personally. The
software being managed must have some sort of dependency on the license
manager if the manager is to be external. I don't know how you can
reliably manage external programs that are decoupled from the license
manager. You can however create a plug-in of sorts if the other authors
would be willing to incorporate it without much work to them.

I mostly explored license management in Delphi apps. Since Delphi
is/was a Shareware favorite, it has quite a few open source /
commercial components available to manage such licensing, usually with
trivial effort from the component user. You could take a look at them
(http://www.torry.net/quicksearchd.php?String=shareware&Title=No). Some
of them might even compile on Lazarus to expose them to Python. By
large, the culture of Python is open source and such expertise may not
be common place here.

You might want to subscribe to the mailing lists of "Association of
Shareware Professionals" (http://www.asp-shareware.org/). I have not
been on this path in 5 years and so am out of touch.

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


Re: What would be the best way to run python client in the background

2006-08-20 Thread Ravi Teja

gel wrote:
> Hi
> I have written a python client server app that keeps an eye on
> processes starting and ending on a client and makes decision on what to
> do based on information from the server end.  I want to run the client
> end of the app more or less invisibly (no console) on the XP clients
> when ever a users logs on.  What would be the best way to get this
> done?  A bit more info on the purpose of the app... it is to act as a
> licence server, where we have a limited number of licences for software
> and the software installed on all PCs.  The app will only allow a pre
> defined number of clients to run the software at any one time.

To run a python script without a console - use *.pyw extension.

But from what you stated you perhaps don't want to do this. Whether you
deploy this check as a service (through py2exe for example) or a
straight script, the users may simply kill it if they want to bypass
the check. Plus it is not common to use a seperate persistant process
to check for licenses. A better way is to incorporate the check
directly into the process of the software.

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


Re: How to catch these kind of bugs in Python?

2006-08-19 Thread Ravi Teja
asincero wrote:
> Is there anyway to catch the following type of bug in Python code:
>
> message = 'This is a message'
> # some code
> # some more code
> if some_obscure_condition:
>nessage = 'Some obscure condition occured.'
> # yet more code
> # still more code
> print message
>
>
> In the above example, message should be set to 'Some obscure condition
> occured.' if some_obscure_condition is True.  But due to a lack of
> sleep, and possibly even being drunk, the programmer has mistyped
> message.  These types of bugs would easily be caught in languages that
> have a specific keyword or syntax for declaring variables before use.
> I'm still fairly new to using Python on a more than casual basis, so I
> don't know if Python has anyway to help me out here.

The keyword is "obscure condition". The solution is to use a coverage
tool and create unit tests that give you 100% code coverage.

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


Re: Text to MP3 using pyTTS - Non-programmer question

2006-08-19 Thread Ravi Teja

[EMAIL PROTECTED] wrote:
> Thanks for the script. Are there any online python intrepreters?
>
> I'd like to play around with the script. I don't have access to my home
> PC.

You probably will have to wait till you get to yours. There were some
AJAXian ones but I doubt that you will find a free (assuming that you
meant that) online interpreter on a MS Windows box that allows you to
install your modules and give you an FTP or such account to get the
recorded file back.

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


Re: sqlite3 or mysqldb?

2006-08-18 Thread Ravi Teja
> To learn SQL SQLite should be enough - it has all the basics, just as
> MySQL, while it doesn't require any server/client configuration
> (encoding configuration in MySQL is real PITA). But if you want any
> "serious SQL", go with any freely available *real SQL server*, like
> Firebird or PostgreSQL. I'd consider Firebird, as it's pretty lightweight.

Firebird can be used as an embedded database just like SQLite as well.
This gives a much more powerful database that can still be used without
the administration overhead. Aside from flexibility, the reason I
prefer FireBird is that it has much more sophisticated visual tools
available.

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


Re: recommended general-purpose string template packages?

2006-08-13 Thread Ravi Teja
> In general, I'm mainly interested in a template engine for dynamic web
> pages but would like a general purpose one to avoid learning yet
> another package for generating e-mail messages, form letters, source
> code, whatever.
>
> In particular, does anyone have much experience with the Python
> interface to Terence Parr's StringTemplate
> (http://www.stringtemplate.org/)? Reading the website, I'm attracted by
> the approach, but a Google search (both generally and in this
> newsgroup) gives me the impression that it's little used in the Python
> world.

Most Python templating engines are general purpose. Choice between them
however is sometimes a matter of preference, like editors. I settled
down on Cheetah for most part.

Here is a list of some popular ones.
http://wiki.python.org/moin/Templating

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


Re: Easy to use distributed system?

2006-08-13 Thread Ravi Teja
Jim Jones wrote:
> I am looking for a system in Python that will easily allow me to distribute
> processes across multiple systems?So, if I have a function 'foo', I'd
> like to be able to call something along the lines of
>
> distribute(foo(x))
>
> And have the system figure out which node is available for process, and then
> have the results returned in some sort of callback fashion.
>
> Any insight is greatly appreciated.

Sounds like Grid computing. Google for Globus toolkit and ActiveGrid.

Good luck.

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


Re: The decentralized nature of the Python community is driving me crazy

2006-08-09 Thread Ravi Teja
> But I must say the one thing I miss about Perl is my ability to stay on
> top of all the latest modules and apps in one place: CPAN. With Python,
> code is EVERYWHERE - people's local boxes, sourceforge, freshmeat,
> codezoo, parnassus, etc, etc.

Python CheeseShop is equivalent to CPAN
http://www.python.org/pypi

Easy Install provides a nice client
http://peak.telecommunity.com/DevCenter/EasyInstall

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


Re: New to Python-- Help

2006-08-08 Thread Ravi Teja

Philippe Martin wrote:
> John & Mary Cook wrote:
>
> > I just installed Python on Windows XP Pro.  When I enter 'python' at the
> > >>> prompt in Pythonwin IDE I get the following:
> >
> > Traceback (most recent call last):
> >File "", line 1, in ?
> > Name Error: name 'python' is not defined
> >
> > Can anyone help?
> >
> > Thank you,
> >
> > J. T. Cook
>
> Did you install Python, or Pythonwin ?
>
> Cannot use #2 without #1.

He probably used ActivePython. It includes both. Besides PythonWin IDE
won't start without Python :-)

John:
Try this tutorial. It does not assume a programming background.
http://honors.montana.edu/~jjc/easytut/easytut/

You already started Python when you started PythonWin IDE. You won't
need to type python in it again :-)

In the tutorial I linked, PythonWin is analogous to IDLE (another IDE)
mentioned in it. You should also have IDLE installed in your menus.

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


Re: Programming newbie coming from Ruby: a few Python questions

2006-08-02 Thread Ravi Teja
> Is this kind of cleverness what is usually known as "magic"?
> I suspect that this has something to do with it, but not completely
> sure...

:-). It must be. Now Django has a "magic removal branch".

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


Re: Programming newbie coming from Ruby: a few Python questions

2006-08-01 Thread Ravi Teja
>  'Clever is not considered a compliment in Python.' (don't know where I
> read that...)

On a similar note.

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it."

 -- Brian Kernighan of C

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


Re: python and JMS

2006-07-30 Thread Ravi Teja

Alan Kennedy wrote:
> [tksri2000]
> > I am looking to use python to talk to JMS. Can some please point me to
> > such resources if this is possible.
>
> PyHJB is the python-to-JMS gateway. ... via HJB, the HTTP JMS bridge.
> http://hjb.python-hosting.com/
>
> HJB (HTTP JMS Bridge)
> http://hjb.berlios.de/

Neat. Apparently ActiveMQ supports multi-language clients through STOMP
too.
http://www.activemq.org/site/cross-language-clients.html

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


Re: python and JMS

2006-07-30 Thread Ravi Teja
> I am looking to use python to talk to JMS. Can some please point me to
> such resources if this is possible.

JPype
http://jpype.sourceforge.net/

Jython
http://www.jython.org/

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


Re: Python for Lazarus (not Delphi)

2006-07-23 Thread Ravi Teja

Uwe Grauer wrote:
> Does anyone know if something similar to Python for Delphi
> does exist for lazarus?
>
> Thanks for any pointers,
>   Uwe

Python for Delphi does support Lazarus since Version 3.29
http://mmm-experts.com/VersionHistory.aspx?ProductId=3

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


Re: Web Browser Pygame Plug-in?

2006-07-10 Thread Ravi Teja
Gregory Piñero wrote:
> That's interesting, Ben.  So we'd be better off making a new library
> similiar to Pygame in functionality but designed from the ground up to
> work in a browser.

In open source community, that would be YOU since you are the one with
the need :-). Maybe you can make "Python WebStart".

Running foreign native code from a browser has long been abandoned as a
bad idea since ActiveX spyware proliferation (which BTW, is another way
to package your game as. Although that would effectively restrict it to
IE just like XPCOM would restrict it to Mozilla family). Plus your
users will have to download Python somehow (Python is not as widespread
as Java or Flash on consumer desktops), either as part of the game or
independently. And finally, if PyGame was written in pure Python
without taking advantage of SDL to be fully cross-platform, it would
likely not be fast anymore. It better be a REALLY great game to go with
all these issues :-).

> I guess that XPCOM technology that someone
> mentioned might be the way to go?

It is far simpler to just use Jython and some Java Game library instead
of PyGame if browser delivery is that important to you.

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


Re: python - regex handling

2006-07-04 Thread Ravi Teja

bruce wrote:
> hi...
>
> does python provide regex handling similar to perl. can't find anything in
> the docs i've seen to indicate it does...
>
> -bruce

It helps to learn to search before asking for help.
Typing the words - python regex (words from your post) into Google
gives you plenty of results with the first link being the HOWTO. A
better query - python "regular expressions" would give you even more.

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


Re: beautifulsoup .vs tidy

2006-07-01 Thread Ravi Teja

Paul Boddie wrote:
> Ravi Teja wrote:
> >
> > 1.) XPath is not a good idea at all with "malformed" HTML or perhaps
> > web pages in general.
>
> import libxml2dom
> import urllib
> f = urllib.urlopen("http://wiki.python.org/moin/";)
> s = f.read()
> f.close()
> # s contains HTML not XML text
> d = libxml2dom.parseString(s, html=1)
> # get the community-related links
> for label in d.xpath("//li[.//a/text() = 'Community']//li//a/text()"):
> print label.nodeValue

I wasn't aware that your module does html as well.

> Of course, lxml should be able to do this kind of thing as well. I'd be
> interested to know why this "is not a good idea", though.

No reason that you don't know already.

http://www.boddie.org.uk/python/HTML.html

"If the document text is well-formed XML, we could omit the html
parameter or set it to have a false value."

XML parsers are not required to be forgiving to be regarded compliant.
And much HTML out there is not well formed.

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


Re: building/installing python libs/modules...

2006-07-01 Thread Ravi Teja
> Here is a click and go installer built for Windows that I found from
> Google.
> http://users.skynet.be/sbi/libxml-python/binaries/libxml2-python-2.6.22.win32-py2.4.exe

Oops! That is for libxml2, not libxml2dom.

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


Re: I have 100 servers which need a new backup server added to a text file, and then the backup agent restarted.

2006-07-01 Thread Ravi Teja

gavino wrote:
> list of servers L.txt
> #cat L.txt
> config file is /var/bkupexec/agent.cfg need to add "tell epobackup" to
> bottom of file
> # cat "tell epobackup" >> /var/bkupexec/agent.cfg
> agent is /etc/init.d/agent.ini stop (and then start)
> # /etc/init.d/agent.init stop
> # /etc/init.d/agent.init start
> os=redhat ent 4ES
> I intend to use root password which is same for all 100 servers.
> #now I'm stuck

Read L.txt from (not your shell as you seem to be doing) Python and
connect to each one from pxssh, and send the commands you listed. I am
afraid, you will have to readup and experiment on a smaller scale. The
sample I pointed you to is a rather simple one and you don't seem to
have even tried it.

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


Re: building/installing python libs/modules...

2006-07-01 Thread Ravi Teja
> i've got the python app:
> http://www.boddie.org.uk/python/downloads/libxml2dom-0.3.3.tar.gz
>
> and i've downloaded it, an untarred it...
> i have the dir structure, but i don't know what needs to be done now!!! i
> have a setup.py. does it get run?
>
> the Readme file didn't tell me how to build the app

The setup.py is a distutils installer. The usual drill in that case is
to simply type "python setup.py install". If the module is registered
in PyPi (which this one is), you can just type "easy_install
libxml2dom" (after easy_install is setup) and you will not even need to
download and extract.

In this case, your module is a native wrapper. So you will need the
libraries that it provides a wrapper for, installed. In this case
(libxml2, libxml2dom). You will also need a C compiler.

All this can be trivial on a unix based platform. However, if you are
new and on Windows, this can be a hassle since you will have to
manually setup your C compiler and the dependencies. Try to find a
binary installer for native Python modules in MS Windows whenever you
can.

Here is a click and go installer built for Windows that I found from
Google.
http://users.skynet.be/sbi/libxml-python/binaries/libxml2-python-2.6.22.win32-py2.4.exe

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


Re: I have 100 servers which need a new backup server added to a text file, and then the backup agent restarted.

2006-07-01 Thread Ravi Teja
LittlePython wrote:
> Does this require a ssh client or server?
>
> I use authpf to open up my  PF firewall for internet use. Generally I just
> open up putty and make a connection to the FW ( which open the ports) and
> minize it till I am done. When I close putty authpf losses the ssh session
> heartbeat and will then instruct the FW to close the ports. I would love to
> write a simple client to do this form me instead of using putty. Do you
> think these mods would work for me on a windows platform?
>
> Thx

Pexpect needs a POSIX system. However, you can use Cygwin.

>From the website, "Pexpect does not currently work on the standard
Windows Python (see the pty requirement); however, it seems to work
fine using Cygwin."

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


Re: I have 100 servers which need a new backup server added to a text file, and then the backup agent restarted.

2006-07-01 Thread Ravi Teja

gavino wrote:
> This seems easy but I have been asking tcl and python IRC chat all day
> and no one gave an answer.
> I have 100 servers which need a new backup server added to a text file,
>  and then the backup agent restarted.
> If I have a list of the servers, all with same root password, and the
> connection is ssh.
> How do I connect to the server, cat the line to the config file, stop
> adn start the agent, and then do same to next server in list and
> iterate through the 100 servers.
> What script would allow this?

Try pxssh from pexpect. Look at the sample in the page.
http://pexpect.sourceforge.net/pxssh.html
It will allow you to automate ssh interactions.

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


Re: beautifulsoup .vs tidy

2006-06-30 Thread Ravi Teja
bruce wrote:
> hi...
>
> never used perl, but i have an issue trying to resolve some html that
> appears to be "dirty/malformed" regarding the overall structure. in
> researching validators, i came across the beautifulsoup app and wanted to
> know if anybody could give me pros/cons of the app as it relates to any of
> the other validation apps...
>
> the issue i'm facing involves parsing some websites, so i'm trying to
> extract information based on the DOM/XPath functions.. i'm using perl to
> handle the extraction

1.) XPath is not a good idea at all with "malformed" HTML or perhaps
web pages in general.
2.) BeautifulSoup is not a validator but works well with bad HTML. Also
look at Mechanize and ClientForm.
3.) XMLStarlet is a good XML validator
(http://xmlstar.sourceforge.net/). It's not Python but you don't need
to care about the language it is written in.
4.) For a simple HTML validator, Just use http://validator.w3.org/

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


Re: code is data

2006-06-29 Thread Ravi Teja
I missed this reply earlier.

Fredrik Lundh wrote:
> there might be cognitive theories that argue that the length of the
> symbols used to describe something is more important than the symbols
> you use and how they can be "chunked" by the brain

Expert communication is known to work differently. For example, take a
doctor's note. It's minimalist representation and domain specific
notational standardizations are absolute gibberish for a reader without
the knowledge of medicine (or more specifically, the sub-specialty) and
the context of the patient. But it is very efficient for the audience
it is intended for. Now, the hand writing - that's a wholly different
story :-).

BTW, I am studying clinical information representations. This
discussion was interesting to me because I am trying to see programming
language representation as a better discussed and more structured
microcosm of the relatively fuzzy domain I am studying. Of course,
there are many important differences and I may be drawing the parallels
liberally at this point but it gives me an interesting perspective.

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


Re: what do you guys prefer for ajax?

2006-06-29 Thread Ravi Teja
a wrote:
> what do you guys prefer for ajax?
> dojo
> mochikit
> prototype
> or somehting else/

I am using OpenLaszlo for a project with a Karrigell (Python) ReST
backend. Now strictly speaking, this is not AJAX at the moment.  It
uses Flash but has the same "asynchronous updates from the server"
model. I am waiting for their DHTML engine to mature to switch to it
(they just released a preview). The DHTML engine is AJAX and is based
on Dojo toolkit.

Pro:.
1.) Declarative UI development.
2.) Good look and feel for free.
3.) Comprehensive API for data binding.
4.) Excellent documentation.

Cons:
1.) Only Flash available now.

You might want to take a look at TurboGears 1.0 preview as well. They
have made quite a bit of progress integrating MochiKit.

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


Re: Import Issue

2006-06-29 Thread Ravi Teja
[EMAIL PROTECTED] wrote:
>   What is the difference between
>import string
>   and
>from string import *

Here is an explanation.
http://effbot.org/zone/import-confusion.htm

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


Re: code is data

2006-06-22 Thread Ravi Teja
> I don't think that distinction is very meaningful.  As a programmer I
> have to understand both.
> I understand the Python compiler well, and it gives me reasonably good 
> feedback when I
> get things wrong, and it has a lot of flexibility along several
> orthogonal lines.
> We're talking about programming languages, so it's useless to consider
> a cognitive perspective without considering the compiler perspective.

As some one who has followed your excellent articles, posts and tools
over the last many years, I don't doubt your expertise at all.

I admit I am not be entirely looking at this as a programmer. I am
working in informatics for the last few years. At least in this domain,
it is useful to seperate the perspectives. Sort of like designing a
functional language based primarily on mathematical abstractions rather
than imperative realities. Yes! Once the implementation is underway,
the practical realities are unavoidable but they interfere in thinking,
otherwise.

> I understand you, but it's very unclear to me how you can make a thin
> layer that's not horribly leaky or stunted.  In my experience one or
> both are likely in DSLs, and the result is horrible and only useful as
> a toy.

I am not making this up out of thin air. There is already an
implementation, Logix, which allows you make thin layer DSLs on top of
itself (which in turn sits on top of Python). It did not fly but I
could not technically fault it (except maybe that it is not very
optimized at the moment). Maybe with your better understanding of
language implementations, you can.

> I understood the distinction you were making.  But you were also
> speaking generally about generally programmable syntax, and I don't
> think that's a good idea, and it's very unclear how that mixes with
> Python.  You can always do:
>
>   model = make_model("""
>   my funny syntax
>   """)
>
> And you actually get something that can be a close peer to normal
> Python code.  But if you are talking about Python and some novel syntax
> interleaved, then the details seem to matter a lot, because the
> implementation is substantial and potentially invasive.

NO! I have a feeling that you are interpreting me as a language
radical. I do not think that Python syntax should have too many
novelties. Currently Python feels a cohesive whole. A well designed
entity rather than something that evolved by accretion of features like
Perl. With active attempts to prune inconsistencies for that end
(Python 3000). And I value all that.

But Logix does not add ANY new syntactic constructs to Python. There is
a special import function that imports a macro supporting Python
language variant module where one can create special syntactic
constructs. I am quite satisfied with the macro capabilities of Logix.
But I am just grumbling that the Python community does not find macros
interesting. But without enough users, it simply dies away.

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


Re: code is data

2006-06-20 Thread Ravi Teja
> Or... maybe to be more specific, the hard work later on goes into
> *code*.  If you are enhancing your model, you do so with methods on the
> model classes, and those methods don't effect the DSL, they are just
> "code".  You create some raw XML in the beginning, but quickly it's
> just a matter of gluing those pieces together, using functions instead
> of DSLs, and that's just "code".

> That doesn't look that much better.  How do you create it
> programmatically?  I know how to pass a variable to
> CharField(maxlength=200); can I pass a variable to "char length 200"
> just as easily?  Can I use **kw?  Can I read it from a CSV file and
> construct the class that way?  Maybe, but only by recreating all the
> native patterns that I can infer easily looking at the Django class.

I am looking at it from the cognitive perspective. You are looking at
it from the compiler perspective.

I think you are talking about full blown DSLs like SQL which try to be
self contained for a given domain. The ones I am referring are only
thin layers on Python.

> Words are great. Python is light on symbols, and that is good.

Agreed. When I came to Python from Perl, I loved the clean syntax.
Scalars, arrays, hashes occur too frequently in Perl code that using
symbols to denote them causes more noise than cognitive assistance. On
the other hand, using symbols to denote an occational special construct
is helpful (as in decorators).

> Even the Lisps stick to an incredibly homogenous syntax (far more
> homogeneous than Python) to make macros feel familiar.

Yes! The parser friendly, "everything is a list" syntax does help. I
did consider that to be an essential feature to enable dynamic macros.
However I changed my mind when I saw Logix macro syntax.

> Constrained context is a step backward!  How do you add methods?  How
> do you do looping?  How do you write *code*?  If you aren't going to
> allow those things, then just make a parser and build the structure
> from the file, and make it a DSL implemented entirely external to
> Python.  That's completely okay, though in my experience it's not very
> satisfying for something like a model definition (see MiddleKit for an
> example of an ORM that doesn't use Python code).

I agree that constrained context is a step back in terms flexibility.
But it is a strategic step backwards, in this case to trade for
representational benefits. The extent of constraints is a judgement
call. And proof of utility can only be emperical.

However I think that you are seeing my sample differently than I meant
it. I did not mean to create a special syntax file that would be parsed
as a text file such that it would loose all the benefits of Python. It
is just a thin layer over Python code for specific representational
benefits. Kay Schluehr does a good job of identifying it as such in his
reply.

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


Re: code is data

2006-06-19 Thread Ravi Teja
Kay Schluehr wrote:
> Ravi Teja wrote:
>
> > People have however written various language interpreters (Scheme,
> > Forth and yes, even Basic) in Python, just for kicks. Still does not
> > make it a DSL language anymore than it makes C a DSL language.
> >
> > At present, the closest thing to writing a DSL in Python is Logix
> > http://livelogix.net/logix/
> > Too bad though, the project is defunct and there has never been enough
> > interest in it.
>
> You might be interested in EasyExtend:
>
> http://www.fiber-space.de/EasyExtend/doc/EE.html

Your framework does look very interesting and might just be what I am
looking for. Will give it a try.

Thanks.

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


Re: code is data

2006-06-19 Thread Ravi Teja

BJörn Lindqvist wrote:
> > > > community has no interest in it. When I absolutely need macros, I will
> > > > go elsewhere.
> > I *like* 1..5 (ada, ruby) instead of range(5). If I had macros, I would
> > have done it myself for *my* code.

> I think this example more is a symptom of a childish need to get
> things your way than of a deficiency in Python.

I thought I had enough asterisks in there to indicate that it is a
preference that I will not be defending on rational grounds. I had a
better argument before it in the same post. But you had to choose only
the trivial one to dismiss me as childish. Didn't you? :-)

> BTW, range(5) = 0..4 in Ada and Ruby.

My bad. I usually write range(1, 5 + 1) to get 1..5.
I could write range(1, 6). But I would like to see the upper bound
explicitly. Of course, I could write a function to wrap that up.

> You said "when I absolutely need macros" but none of your examples
> demonstrate any "absolute need." I can't see your point.

Did you miss the word - *WHEN*?
I don't need them absolutely now. And I know, that I won't get them
here. And just so you don't misinterpret, I don't call that a
"deficiency". Just a mismatch between the personal and the community
mindset.
BTW, the recent language changes - decorators, conditional expressions
and with statements are not absolute either. That did not stop them
from being welcome additions.

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


Re: code is data

2006-06-18 Thread Ravi Teja

Fredrik Lundh wrote:
> Ravi Teja wrote:
>
> > Web frameworks, which seem to be the rage now in Python community could
> > have benefited tremendously from Macro capabilities since they have a
> > lot of boiler plate.
>
> they do?  methinks you haven't done much web programming lately...
>
> 

You blogged on Django. Let's use that. Don't you think model creation
in Django can be represented better, given that it is done often
enough?

Let's take an example from the official tutorial
from
http://www.djangoproject.com/documentation/tutorial1/#creating-models

class Poll(models.Model):
question = models.CharField(maxlength=200)
pub_date = models.DateTimeField('date published')

class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(maxlength=200)
votes = models.IntegerField()

I don't use Django and I made this up quickly, so please don't pick on
subtleties.

@Poll:
question: char length 200
pub_date('date published'): date

@Choice:
poll -> Poll
choice: char length 200
votes: int

The following is my rationale. Annoted variables, symbols and code
layout visually cue more efficiently to the object nature than do
explicit text definitions. Of course, this is only sensible when there
aren't too many of any of those. In that case, the cognitive cost of
notation outweighs the representational cost of text.

Representational minimalism is troublesome in general code (ala Perl),
but not so in a DSL where the context is constrained.

I would also like to symbolize field types since they occur so commonly
in a definition file and only a few of them are commonly used. I admit
though that I find the code below a bit visually jarring and I might
use something else. But it serves to illustrate the point. I chose the
respective symbols based on their colloquial use and association with
the field types.

@Poll:
$question: length 200
%pub_date('date published')

@Choice:
poll -> Poll
$choice: length 200
#votes

Since you are on thread and are a prominent and involved member of the
Python community, I would like it if you (or any such other) can
provide feedback on the rest of my previous post rather than be
dismissive by just a small portion of it. Perhaps, that will give me
some insight how these language design decisions are rationally made (I
am not strictly a programmer by profession, much less a language
designer).

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


Re: code is data

2006-06-18 Thread Ravi Teja
Paddy wrote:
> Ravi Teja wrote:
> > BJörn Lindqvist wrote:
> > > > Personally, I would like to see macros in Python (actually Logix
> > > > succeeding is good enough). But I am no language designer and the
> > > > community has no interest in it. When I absolutely need macros, I will
> > > > go elsewhere.
> > >
> > > One must wonder, when is that? When do you absolutely need macros?
> >
> > Whenever there is significant boiler plate code that functions and
> > classes cannot eliminate alone.
> > Whenever there is a more elegant way to express your code.
> >
>
> Me, I am torn. I should now better. I have listened to the arguments
> against Macros in Python and the ones that struck home were the
> argument for maintainability:
>  Without macros, Python is Python. Statements do what you expect.

Yes! I heard those arguments too. And I am not convinced.

Static language programmer: Lack of static typing removes the necessary
safeguards. The code is more error prone. Objects have behavior that is
not obvious.
Dynamic language programmer: Really? I don't seem to have any more bugs
than in my statically typed code. And my code is compact and reads
better. I don't want to go back.

No to macros proponent: Macros introduce a lot of potential for abuse.
Code will be worse to read than Perl.
Macros proponent: Really? We have been doing macros for decades. We all
think our code is better for macros, not worse. We are not going back.

I just don't get it. Don't we often invoke the "We are all adults here"
argument.

Writing a macro is not as simple as writing a function. Sort of like
metaclasses. Many will stay off them. Those that really need them will
walk that extra mile. Don't we all believe that "Simple should be
possible. Complex should be doable"

> And the argument against DSLs altogether:
>  Make Python your DSL! If you design your own DSL before long you start
> to embellish it with more statements or data types and before long it
> becomes complex. If you used Python from the beginning then you would
> have a community for support.

Python has a low cognitive overhead. But it not a DSL by definition. No
language can be. The idea is that when the domain changes, a DSL should
be driven by the new domain as warranted. In other words, driven "by
the problem, not the tool".

  I don't want "a DSL". I want a language that allows me to make "my
DSL" based on it. That means I don't loose the community connection. I
can still use all the rich libraries in my DSL.

I like Python for its indentation syntax, sensible semantics and
readability. I invested a lot of time in Python. After much language
hopping, I settled with Python. I like the community and the code base
available for it. The libraries just seem to be designed at the right
level of abstraction for me (as opposed to say, Java). When I need to
do something, I know where to go. But all this ties me to the language
tightly that I cannot change.

> I know the arguments, but every once in a while I think if only I could
> craft my own ??? statement or 

My thoughts exactly.

Web frameworks, which seem to be the rage now in Python community could
have benefited tremendously from Macro capabilities since they have a
lot of boiler plate.

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


Re: code is data

2006-06-17 Thread Ravi Teja

BJörn Lindqvist wrote:
> > Personally, I would like to see macros in Python (actually Logix
> > succeeding is good enough). But I am no language designer and the
> > community has no interest in it. When I absolutely need macros, I will
> > go elsewhere.
>
> One must wonder, when is that? When do you absolutely need macros?

Whenever there is significant boiler plate code that functions and
classes cannot eliminate alone.
Whenever there is a more elegant way to express your code.

Python 2.5 introduced conditional expressions and with statement. With
macros, one would not have to wait for the language team to implement
them. More so for features which only a small part of the community has
an interest in.

I *like* 1..5 (ada, ruby) instead of range(5). If I had macros, I would
have done it myself for *my* code.

I would like special behaviour code blocks in my programs, for say DBC
(I am aware of the work arounds).

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


Re: Standard Yes / No Windows Dialog box creation

2006-06-17 Thread Ravi Teja

[EMAIL PROTECTED] wrote:
> I found a way to create "Open File" or "Open Folder" windows dialog
> boxes, but not to create an easier Yes / No dialog box...
> Maybe someone has a solution for this?

Assuming you are on MS Windows.
import win32api, win32con
win32api.MessageBox(0, "Question", "Title", win32con.MB_YESNO)

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


Re: code is data

2006-06-17 Thread Ravi Teja

Anton Vredegoor wrote:
> With the inclusion of ElementTree (an XML-parser) in Python25 and recent
> developments concerning JSON (a very Pythonesque but somewhat limited
> XML notation scheme, let's call it statically typed XML) Python seems to
> have reached a stage where it now seems to be possible to completely
> swallow lesser languages code, modify it, and spit out new source code
> targeting the original language the code was written in, or even make a
> translation to other languages.
>
> The idea is that we now have a fast parser (ElementTree) with a
> reasonable 'API' and a data type (XML or JSON) that can be used as an
> intermediate form to store parsing trees. Especially statically typed
> little languages seem to be very swallow-able. Maybe I will be able to
> reimplement GFABasic (my first love computer language, although not my
> first relationship) someday, just for fun.
>
> Then there are things like cTypes (calling functions from native DLL's)
> and PyPy (implementing Python in Python).
>
> All this taken together, to me it starts looking like we're now entering
> a territory that traditionally was exclusively in the Lisp domain.
>
> Yes, Python had eval and exec for a long time already, and metatypes and
> generators are having some strange unexplored possibilities too, but the
> day will come soon (and at last when PyPy is reaching execution speeds
> close to cPython) where Python will be able to swallow smaller
> languages, and finally it will be able to swallow its own tail, like
> Lisp but then more powerful (because of the widely used standard data
> types and the code exchange between languages that that makes possible).
>
> Your thoughts please.

I don't share your optimism at all. Most of the things you mentioned
have existed for long. Just because some of them are now included in
the standard library isn't going to change things drastically.
Installing them earlier was never hard at all.

People like to call everything with the lightest semblence, a DSL. That
gives the feel that the language is more powerful. Ruby people do it
all the time. Python cannot be called a DSL language until, creating
them is a natural language feature (like Lisp). And that does not seem
to be happening anytime soon. Boo for example allows you to write new
constructs with it's AST library. It still cannot be called a DSL
"language".

People have however written various language interpreters (Scheme,
Forth and yes, even Basic) in Python, just for kicks. Still does not
make it a DSL language anymore than it makes C a DSL language.

At present, the closest thing to writing a DSL in Python is Logix
http://livelogix.net/logix/
Too bad though, the project is defunct and there has never been enough
interest in it.

Personally, I would like to see macros in Python (actually Logix
succeeding is good enough). But I am no language designer and the
community has no interest in it. When I absolutely need macros, I will
go elsewhere.

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


Re: code is data

2006-06-17 Thread Ravi Teja

Paddy wrote:
> Anton Vredegoor wrote:
> > With the inclusion of ElementTree (an XML-parser) in Python25 and recent
> > developments concerning JSON (a very Pythonesque but somewhat limited
> > XML notation scheme, let's call it statically typed XML)
>  >
> > Your thoughts please.
> >
> > Anton
>
> Hi Anton.
> If you mean this JSON: http://www.json.org/example.html
> then I'd just point out that JSON isn't XML-like at all. In fact the
> examples look like valid Python nested dictionaries.

It is the same JSON. JSON is typically seen as a human friendly
replacement for some of the functions that XML is otherwise used for,
where the full blown XML spec is an overkill and JSON does not need
complicated parsers in some common languages because it can express
hierarchical data just like XML.

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


Re: Combining The Best Of Python, Ruby, & Java??????

2006-06-13 Thread Ravi Teja

Luis M. González wrote:
> Diez B. Roggisch wrote:
> > > But semantically it is a proper functional language. The features may
> > > not attract Python users who might prefer Boo/Jython/IronPython. But it
> > > does offer something to disillusioned Groovy users.
> >
> > Are they disillusioned? Just wondering.
> >
> > Diez
>
> Whay talking about disillutioned programmers?
> These are tools, not religions...
> I love python, and I like it more everyday. And with the advent of
> Pypy, its future looks brighter than ever.
> But I also find very interesting these new options that are coming up.
> Although I'm not a professional programmer (not even a serious
> aficionado), I love to be able to translate my python skills very
> easily to .NET through Boo, for example.
> I even find it more appealing than Ironpython, because it was created
> from the ground up to take advantage of the CLR.
> On the other hand, porting pure python to .NET is in many aspects like
> trying to fit a square on a circle (I don't know if this sentence makes
> sense in english...).
> Because many of the design choices taken by GvR back in the early
> nineties were surely conditioned by the platform he chose to write
> python, which is the c language.
> The good thing is that python is having a lot of influence in these new
> languages.
> As far as I could see, even C# 3.0 is showing up some pythonic traits.

I did not realize the flame potential of that remark. Just to clarify,
I have no criticism of any kind on Groovy. I mentioned Groovy since
Scala, the original topic of the thread addresses the needs of the same
group (a modern language with a Java friendly syntax). I am not a
language bigot. Note that I am defending Scala, a new language, in this
thread so far. I do not want this thread to break into a language war
from my remark. I hope that Python gets some of the features listed in
my above post in it's own unique Pythonic way eventually. The
discussion perhaps is more constructive if we can see some good in
Scala that is worth adopting.

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


Re: Combining The Best Of Python, Ruby, & Java??????

2006-06-13 Thread Ravi Teja

Diez B. Roggisch wrote:
> > But semantically it is a proper functional language. The features may
> > not attract Python users who might prefer Boo/Jython/IronPython. But it
> > does offer something to disillusioned Groovy users.
>
> Are they disillusioned? Just wondering.

Nah! Just a poor passing attempt at humor. Groovy is a great language
too. I should watch out. Maybe Groovy programmers have knives too :-).
http://cardboard.nu/blog/2005_02_02/gosling_on_jvm_scripting.html

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


Re: Combining The Best Of Python, Ruby, & Java??????

2006-06-12 Thread Ravi Teja
> Ok, here's the Hello World example from the Scala website:
>
> object HelloWorld {
>   def main(args: Array[String]) = {
> Console.println("Hello, world!")
>   }
> }
>
> Opening and closing braces?
> "def main(args: Array[String])"?
> Console.println?
>
> About the only Pythonic thing I can see here is the "def" keyword.
> Otherwise, it looks too much like Java - no, thanks!
>
> -- Paul

Don't be too harsh on it though. It is a language built for the
JVM/CLR. The author perhaps intended the library to be natural to the
users of the respective SDKs regardless of its' aesthetics and it
explicitly seems to provide a unified API for Java and .NET. Of course,
that is nothing new. Many languages have interchangeable backends for
these platforms these days but there seems to be a specific focus on
that here. The syntax does resemble Java/C#, which is also important if
you want buy in from the Java/C# crowd.

But semantically it is a proper functional language. The features may
not attract Python users who might prefer Boo/Jython/IronPython. But it
does offer something to disillusioned Groovy users.

But on the other hand, there are some neat features even for Python
programmers.
Tail recursion
Pattern matching
Currrying
Macros
Concurrency
Native XML support

Of course, you can get by without some of these in Python with
workarounds, libraries or hacks.
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691
http://www.python.org/dev/peps/pep-0309/ (in 2.5)
http://logix.livelogix.com/ (offline)

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


Re: Combining The Best Of Python, Ruby, & Java??????

2006-06-12 Thread Ravi Teja
Tim Daneliuk wrote:
> So it is claimed:
>
>
> http://www.infoq.com/news/Scala--combing-the-best-of-Ruby-;jsessionid=CC7C8366455E67B04EE5864B7319F5EC
>
> Has anyone taken a look at this that can provide a meaningful contrast
> with Python?

I find the language very interesting but it is not like Python or Ruby
at all. Feels a lot more like OCaml + Haskell for JVM with a more
mainstream (Java) syntax.

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


Re: Python or Ajax?

2006-06-09 Thread Ravi Teja
> I've been hearing a ot about AJAX lately. I may have to build a web
> application in the near future, and I was curoius:
>
> How does a web application that uses Python compare with one that uses AJAX?
>
> I've done some basic web page design with HTML and CSS, but never any
> web applications. I don't want to learn a new language if I can use
> Python. Would AJAX offer me any significant advantages?

AJAX is *NOT* a programming language. It is a certain way of building
web applications. Any Python (or any other language) web framework may
be used, though some (TurboGears / LivePage etc) have explicit support
for it.

I bit of googling does not hurt.

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


Re: in python , could I accomplish the purpose that "a=Console.read()" used in C?

2006-06-05 Thread Ravi Teja

Bruno Desthuilliers wrote:
> python a écrit :
> > in python , could I accomplish the purpose that "a=Console.read()" used
> > in C?
>
> 
> There's nothing like "Console.read()" in ansi-C.
> 

He probably got it mixed up with C# which ( almost - Console.Read() )
has that.

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


Re: New to Python: Do we have the concept of Hash in Python?

2006-06-02 Thread Ravi Teja

A.M wrote:
> "Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > A.M wrote:
> >
> >> This is my 1st day that I am seriously diving into Python and I have to
> >> finish this application by the end of today. Maybe it wasn't a good idea
> >> to choose the language that I don't know when I have to deliver my work
> >> in such short time.
> >
> > are your boss aware of this ?
> >
> > 
> >
>
>
> > are your boss aware of this ?
>
> In fact my boss is quite impressed with my progress so far.
>
>
>
> I am a little confused about the fact that you got frustrated with my posts
> today. I am not asking for a big tutorial or
>
> deepest philosophy behind the concepts. The answer to this post could be
> just the word "Dictionary" which is 10 key stroke !
>
> Does this hurt?

IRC is a better place to request 10 key stroke answers. And it is
faster for you to get answers there too. Usenet is archived these days
and it adds value to all of us that it is filled with discussions of
questions that are more intellectual than those which can be looked up
at a glance at the documentation.

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


Re: How to access the content of notepad with Python?

2006-05-31 Thread Ravi Teja
> I have a software running on my computer that really looks like notepad
> ( same interface, different name). I need to write a script that will
> capture the content of this software --> the text written inside.
>
> Is it possible using win32 libs? any clue?

http://www.openqa.org/pywinauto/
The example on their home page is in fact how to automate Notepad. I am
sure you can work from there.

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


Re: Need C# Coding for MD5 Algorithm...

2006-05-28 Thread Ravi Teja
> I need C# code for Implementing MD5 Algorithm.

So ask in a C# group.
Python's is here
http://docs.python.org/lib/module-md5.html

> please Send... ITs URgent

http://www.catb.org/~esr/faqs/smart-questions.html#urgent

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


Re: html 2 plain text

2006-05-28 Thread Ravi Teja
> i remember seeing this simple python function which would take raw html
> and output the content (body?) of the page as plain text (no <..> tags
> etc)

http://www.aaronsw.com/2002/html2text/

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


Re: Fancy GUI with Python

2006-05-28 Thread Ravi Teja
> Hi all.  I just downloaded and installed the new Office suite from MS
> with their new 'ribbon' based UI.  I think it's pretty cool and AFT*
> for a new UI paradigm.  I hope it sticks.

> Anyway, I'm wondering how to implement a gui like this with Python.

I haven't seen their new Office suit (apart form a few screenshots).
Judging from the past, the code is probably statically linked to MS
Office. Many of the previous iterations of MS Office did introduce
their own look and feels, effects and widgets. Third party Windows
developers soon followed suit reimplementing the widgets. Delphi
community for example focuses a lot on UI and UI effects (Python
community does not). VCL libraries can be compiled to ActiveX
components and you should then be able to use them from Python, at
least on Windows. Or maybe someone will make a .NET assembly and you
will be able to drive it from IronPython or Python for .NET. If you are
lucky, it may even be cross-platform via Mono.

> So I'm not sure if this is a Python question, a xxx-Python question
> (where xxx is the widget toolkit of choice), or a windows API type of
> question.

This is NOT a Python specific issue. It is a widget library and FFI
(Foreign Function Interface) issue. If another language can get at the
functionality, so can Python.

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


  1   2   3   >