Re: Help Required for Choosing Programming Language

2007-02-17 Thread Stef Mientki
Peter Decker wrote:
> On 2/16/07, Stef Mientki <[EMAIL PROTECTED]> wrote:
> 
>> In one of the other threads, Dabo was meant as a GUI designer,
>> I tried it yesterday,
>> and although it looks very promising,
>> at the moment this is not a graphical design environment,
>> just a complex (compared to Delphi) design environment with graphical 
>> feedback.
>> Just my 2 cents ;-)
> 
> Dabo is indeed a work in progress. They are developing the various
> tools now to get people started, but have plans for a full graphical
> IDE in the manner of Delphi or Visual Studio.
> 
> You can complain that this free tool developed by volunteers in their
> spare time isn't as polished as a commercial tool backed by large
> corporations that can afford large paid staffs.
Sorry, but I didn't complain !!
I just wrote down my observations.
I didn't write my observations to dis-encourage people,
(if so, my sincere appologies)
but to show that their are other (and maybe better) ways.
> 
> Or you could contribute.
> 
Believe me or not, I love free and open software,
and I do contribute to the open source community,
but let everyone do what he/she is good in.
Why do you think I want to replace the use of MatLab and LabView
(and a number of others) with Python ;-)

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help Required for Choosing Programming Language

2007-02-17 Thread Diez B. Roggisch
> The final goal of programming language is (in most cases)
> meant to create functional things,
> that can assist people to perform their tasks.
> The UI of that resulting thing should be optimal adapted to the final 
> audience (and task).
> My audience is most comfortable with a intuitive GUI.
> In most of my applications,
> I need about 50% of the time for the GUI and 50% for the other 
> functional code.
> These estimates are for Delphi (is about identical as VB, which I used 
> previous).
> For what I've seen until now from Python,
> - designing the GUI will cost me about 2 .. 3 times as much in Python

You mean delphi here I presume?
> - Python is not capable of doing everything I need
> (almost all interactive actions are very primitive and crashes a lot)

I'm not sure what you are talking about here, and I have the deep 
impression you yourself don't as well.

Matter of factly, there is no "the python GUI". There are quite a few 
choices. The built-in tkinter, which - while limited in some senses - is 
developed by Frederik Lundh, and while I personally haven't done too 
much with it, his reputation as one of the most high profiled python 
developers doesn't go along pretty well with your assertions above. So 
-whatever you used as GUI-toolkit, you either used it wrong, or it 
really wasn't good.

But then there are at least three major other toolkits available, wx, 
gtk and Qt. The first two I've only dabbled a bit with and can't comment on.

But I've done extensive, cross-platform development with Qt. And can 
assert that it is unmatched in productivity and feature richness, 
especially when combined with python. And certainly beat VB, and most 
probably even delphi (albeit I haven't done too much in that to really 
put all my weight behind these words).

And so I'm under the strong impression that your - undoubtedly correct 
from a personal point of view, and I don't think your meaning evil here 
- observations are wrong and are based on a lack of experience in python 
and it's available gui-options.

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


HTTP_REFERER value

2007-02-17 Thread Johny
Is HTTP_REFERER value transfered between different domains?
For example if I come to a website , say, www.python.org, from
website  www.microsoft.com
will www.python.org finds that I came there from www.microsoft.com?
Thank you for help
L.

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


Re: HTTP_REFERER value

2007-02-17 Thread Gabriel Genellina
En Sat, 17 Feb 2007 05:38:06 -0300, Johny <[EMAIL PROTECTED]> escribió:

> Is HTTP_REFERER value transfered between different domains?
> For example if I come to a website , say, www.python.org, from
> website  www.microsoft.com
> will www.python.org finds that I came there from www.microsoft.com?

Yes. This is how you know who is sending traffic to your site; some  
browsers (Opera by example) let the user choose not to send this header.
(And what has this to do with Python?)

-- 
Gabriel Genellina

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


Re: HTTP_REFERER value

2007-02-17 Thread Roel Schroeven
Johny schreef:
> Is HTTP_REFERER value transfered between different domains?
> For example if I come to a website , say, www.python.org, from
> website  www.microsoft.com
> will www.python.org finds that I came there from www.microsoft.com?

If you get from www.microsoft.com to www.python.org by clicking a link 
on Microsoft's website, yes. If you get to www.python.org by manually 
typing in the URL or by using a bookmark, no.

-- 
If I have been able to see further, it was only because I stood
on the shoulders of giants.  -- Isaac Newton

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


Re: WHAT IS THIS?

2007-02-17 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Shadab Sayani
wrote:
> --- Captain <[EMAIL PROTECTED]> wrote:
> 
>> Just bought a new PC with Windows XP Media Edition. I gather Python is
>> a programming language, but I am wondering why it was installed on my
>> PC, and is it safe to remove it?  I have no intention of learning the
>> program.  Thanks in advance
>
> I think it is safe to remove it.As far as I know no windows OS core
> programs use python

But there must be a reason why the vendor installed Python.  So removing
it might break any service program preinstalled by the vendor of that
machine.

A good advice about installing an uninstalling software is:

If you don't know what it does and…

1. …it is not installed then don't install it.
2. …it is installed then don't uninstall it.

Or things may break.

Ciao,
Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Output to a text window

2007-02-17 Thread pdalet
Hi,

http://spinecho.ifrance.com/frmouterr-py242-wxpy2621.zip

I use this gui windows written by jean marie fauth, which is very
easy: printing to stdout or stderr (gui windows written in wxpython).

You have only to translate frmouterr in pygtk.

ph DALET

FRANCE










On 17 fév, 01:19, [EMAIL PROTECTED] wrote:
> Hi,
>
> I'm going around in circles so I'm asking for help. I want to read a
> simple text file and output the contents to a GUI window when I click
> on a button. I have written a small python program to read the
> contents of a file when a button is clicked but can only output this
> to a console window. I'm using the pygtk binding with glade for the
> gui.
>
> I know it must be quiet simple but a mental block has rapidly
> descended.
>
> Any help would be appreciated.


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


Re: builtin set literal

2007-02-17 Thread Hendrik van Rooyen
 "Paul Rubin"  wrote:



> Steven Bethard <[EMAIL PROTECTED]> writes:
> > Yes, a lot of people liked this approach, but it was rejected due to
> > gratuitous breakage. While Python 3.0 is not afraid to break backwards
> > compatibility, it tries to do so only when there's a very substantial
> > advantage. I guess enough people felt that having a shortcut for set()
> > was less important than keeping the current spelling of dict() the same.
>
> There's even a sentiment in some pythonistas to get rid of the [] and {}
> notations for lists and dicts, using list((1,2,3)) and dict((1,2),(3,4))
> for [1,2,3] and {1:2, 3:4} respectively.

YUK!

Moving in the wrong direction to bracketmania!

If you are going to use only one kind of brackets, use [] - on most keyboards,
you don't have to press the shift key - think of the numberless hours of total
time
saved by this simple reform...

It will also give Python a very distinctive "look" - unlike any other language.

- Hendrik

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


Re: builtin set literal

2007-02-17 Thread Hendrik van Rooyen
 "Schüle Daniel" <[EMAIL PROTECTED]> wrote:


>
> > {:} for empty dict and {} for empty set don't look too much atrocious
> > to me.
>
> this looks consistent to me

I disagree. What would be consistent would be to follow the pattern,
and use a different set of delimiters.

Python uses () for tuples, [] for lists, {} for dictionaries.
To be consistent, sets need something else, so you can see at a
glance what you are dealing with.

About all that is left is <>, ugly as it is.

The other way is the start of the slippery slide into alphabet soup.

- Hendrik

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


Re: Pep 3105: the end of print?

2007-02-17 Thread Hendrik van Rooyen
"Steve Holden" <[EMAIL PROTECTED]> wrote:

> Jean-Paul Calderone wrote:

> >
> > I think some people are confused that the language "Python 3.x" has "Python"
> > in its name, since there is already a language with "Python" in its name,
> > with which it is not compatible.
> >
> Right. Let's call Python 3.0 something different but related. How about
> "snake oil"? ;-)

I kind of like this idea - it means that the initiates can go on caravan tours
of America, selling it as a panacea for all ills, IT related or not...

A whole new industry.

- Hendrik

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


Re: Approaches of interprocess communication

2007-02-17 Thread Hendrik van Rooyen
 "exhuma.twn" <[EMAIL PROTECTED]> wrote:

> Hi all,
> 
> Supposing you have two separate processes running on the same box,
> what approach would you suggest to communicate between those two
> processes.

8< -- sockets,webservices,CORBA,shared memory ---

> Supposing both processes are written in Python, is there any other way
> to achieve this? To me, shared memory sound the most suited approach.
> But as said, I am still fuzzy in this area. Where can I find more
> information on this subject?

Using named pipes works for me

Also look at Pyro, albeit not aimed at being in the same box.

- Hendrik



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


Re: HTTP_REFERER value

2007-02-17 Thread Johny
On Feb 17, 10:21 am, Roel Schroeven <[EMAIL PROTECTED]>
wrote:
> Johny schreef:
>
> > Is HTTP_REFERER value transfered between different domains?
> > For example if I come to a website , say,www.python.org, from
> > website  www.microsoft.com
> > willwww.python.orgfinds that I came there fromwww.microsoft.com?
>
> If you get fromwww.microsoft.comtowww.python.orgby clicking a link
> on Microsoft's website, yes. If you get towww.python.orgby manually
> typing in the URL or by using a bookmark, no.
>
> --
> If I have been able to see further, it was only because I stood
> on the shoulders of giants.  -- Isaac Newton
>
> Roel Schroeven

Thank you both for help.
L

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


Re: WHAT IS THIS?

2007-02-17 Thread Laurent Pointal
Captain wrote:

> Just bought a new PC with Windows XP Media Edition.  I have two entries in
> the "Add or Remove Programs" section of Control Panel, but there is no
> corresponding item in the Start Menu.  One entry says: Python 2.2.3 and
> the
> other says: Python 2.2 pywin32 extensions (build203)..  The size for each
> is
> 29.28mb.  I gather Python is a programming language, but I am wondering
> why
> it was installed on my PC, and is it safe to remove it?  I have no
> intention
> of learning the program.  Thanks in advance

DONT USE UPPERCASE TITLE (thanks)

Maybe your PC assembler installed some software which need Python... so,
before removing it, ask the vendor.

You may too search for *.py *.pyc *.pyo files in directories other than
Python, so identify software which may need Python.
And you may searchfor extra-libraries in the lib/site-packages subdirectory
of Python directory.

A+

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


Re: Reg Google Web Toolkit and Python

2007-02-17 Thread Daniel Nogradi
> > Hi ,
> > We have a project where I need to read files store
> > them in database in the backend.We have done this in
> > python.Now we decided to use Ajax technique for user
> > interface.For that we found that GWT is one of the
> > best toolkits.Now I got a doubt can I interface GWT
> > with python.
> > Thanks ,
> > Shadab.

You might also want to look at the javascript backend of pypy. It
translates python code into javascript and has all kinds of cool
mechanisms for "AJAX".

pypy main page: http://codespeak.net/pypy/dist/pypy/doc/news.html

javascript backend info:
http://codespeak.net/pypy/dist/pypy/doc/js/webapps_with_pypy.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Enter Enter... troubles

2007-02-17 Thread Sorin Schwimmer
It works, thanks.

Sorin



 

Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
http://answers.yahoo.com/dir/?link=list&sid=396546091
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: f---ing typechecking

2007-02-17 Thread Chris Mellon
On 15 Feb 2007 16:04:14 -0800, Paul McGuire <[EMAIL PROTECTED]> wrote:
> On Feb 15, 5:21 pm, Paul Rubin  wrote:
> > How can there be a structure datatype with an unpredictable
> > number of members?
> >
> > It might have come across as a different question-sorry for any
> > confusion.
>
> This may be where the "tuple is like a struct" analogy isn't so good,
> and "tuple is like a list but immutable" is better.
>
> In both of your examples, the caller of f() sent a fixed list of
> arguments: (1,2,3,4,5,6,7) in the first case and (8,9,10) in the
> second.  Internally I bet the compiler wants to clean up that same
> list of those same args when f() is finished.
>
> Just as a thought experiment, do this for yourself.  Implement f as:
>
>def f(*args):
>   args = list(args)
>   print args
>
> Now what is it you want to do with args that you can't do with it as a
> tuple?  Do you want some form of communication back to the caller to
> occur, for example?  Maybe some kind of pass-by-ref instead of pass-by-
> value?
>

I wrote code that did exactly this just yesterday. I needed a list
because I wanted to pop arguments off as I consumed them.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter __call__

2007-02-17 Thread Gigs_
James Stroud wrote:
> Gigs_ wrote:
>> James Stroud wrote:
>>> Gigs_ wrote:
 def printit(self, name):
 print name, 'returns =>', demos[name]()


 I have tried but cant get it to work properly.
 I want to instead printit method to put __call__ and call it like that
 Can someone help me, please?
> 
>> I understand lambda, and I know that code is working. But want to do 
>> for exercise with __call__. This coed is from programming python 2ed boo
> 
> You want to use a function factory that itself defines "__call__"? This 
> requires creating a class and not a function.
> 
> 
> class printit(object):
>   def __init__(self, name):
> self.name = name
>   def __call__(self):
> print self.name, 'returns =>', demos[self.name]()
> 
> class Demo(Frame):
> def __init__(self, parent=None):
> Frame.__init__(self, parent)
> self.pack()
> Label(self, text="Basic demos").pack()
> for (key, value) in demos.items():
> func = printit(key)
> Button(self, text=key, command=func).pack(side=TOP, fill=BOTH)
> 
> 
> However, the functional way (as with lambda) is the most widely used way 
> to do this. Another functional way is with closure:
> 
> def printit(key):
>   def _f():
> print key, 'returns =>', demos[key]()
>   return _f
> 
> Which behaves identically to the class above. Even more ways to do this 
> exist in python, including partial functions--which are also a 
> functional approach.
> 
> James

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


how do you expose pylons c variables to javascript functions

2007-02-17 Thread sqad
Hi,

I am making a javascript call to google maps to get the geocodes of an
address. Ok, so its trivial to get the latitude/longitude, but now I
want to pass that data via the Pylons MVC framework so that my
controllers have access to them.

I could get the lat/long by instead going through HTTP via a
webservice call, but new problem comes up - how do I now hand off the
c variables to the javascript function.

Appreciate any help.

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


cmd all commands method?

2007-02-17 Thread placid
Hi all,

if i want to treat every cmdloop prompt entry as a potential command
then i need to overwrite the default() method ?

What i want to achieve is to be able to support global variable
creation for example;

res = sum 1 2

this would create a variable res with the result of the method
do_sum() ?

then would i be able to run;

sum a  5

this would return 8 or an error saying that res is not defined


Cheers

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


Re: cmd all commands method?

2007-02-17 Thread placid

placid wrote:
> Hi all,
>
> if i want to treat every cmdloop prompt entry as a potential command
> then i need to overwrite the default() method ?
>
> What i want to achieve is to be able to support global variable
> creation for example;
>
> res = sum 1 2
>
> this would create a variable res with the result of the method
> do_sum() ?
>
> then would i be able to run;
>
> sum a  5

this should have been,

sum res 5

>
> this would return 8 or an error saying that res is not defined
>
>
> Cheers

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


Re: WHAT IS THIS?

2007-02-17 Thread Grant Edwards
On 2007-02-17, Captain <[EMAIL PROTECTED]> wrote:

> Just bought a new PC with Windows XP Media Edition.  I have two entries in 
> the "Add or Remove Programs" section of Control Panel, but there is no 
> corresponding item in the Start Menu.  One entry says: Python 2.2.3 and the 
> other says: Python 2.2 pywin32 extensions (build203)..  The size for each is 
> 29.28mb.  I gather Python is a programming language, but I am wondering why 
> it was installed on my PC, and is it safe to remove it?

Don't ask us, ask whoever installed it.   Many of the big PC
vendors (e.g. IBM/lenovo, Dell, HP/Compaq) install all sorts of
software on PCs they ship.  About half of them install programs
that are written in Python.

> I have no intention of learning the program.

It's required to run some of the programs that came on your PC.


-- 
Grant Edwards   grante Yow!  Hey, I LIKE that
  at   POINT!!
   visi.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help Required for Choosing Programming Language

2007-02-17 Thread goodwolf
In your situation consider C# too.
If you like python then try IronPython for .NET.
I think that C++ is not ideal for you.

P.S.: VB6 is NOT a real OOP language.

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


Re: Help Required for Choosing Programming Language

2007-02-17 Thread Don Taylor
[EMAIL PROTECTED] wrote:
> I am VB6 programmer and wants to start new programming language but i
> am unable to deciced.
> 
> i have read about Python, Ruby and Visual C++. but i want to go
> through with GUI based programming language like VB.net
> 

By 'GUI based programming language' I think that you mean an integrated 
development environment that includes a visual designer that allows you 
to layout your GUI  and that generates a skeleton application for you to 
  complete.

If this is so then the nearest thing that I have found is Boa 
Constructor, although you will need to know more about the underlying 
windowing system (wxPython) than you would when using VB.net in Visual 
Studio.

Another system worth a close look is Pythoncard.

Other folks have already mentioned Dabo, but this is probably too early 
in its development for your needs.

As an alternative, you can make your own choice of editor/IDE and use a 
stand-alone visual designer for your GUI.  I like Pydev/Eclipse for an 
IDE and wxGlade for the visual designer.  Again, you will need to learn 
something about wxPython if you want avoid lots of frustration - Robin 
Dunn's book 'wxPython in Action' is good.

There are probably similar toolkits available for combinations of Python 
and other windowing systems (Tkinter, Qt).

Don.

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


download free computer books enjoy

2007-02-17 Thread [EMAIL PROTECTED]
Free Computer Education Ebooks,Tutorials and much more
  ASP, Business, C++, Careers, CISCO, e-books, Engineering, English,
Filmmaking, Finance, Health,
  Leadership, Management, Marketing, Mathematics, Mobile, Oracle,
Perl , Photography, PHP,
  Programming, VOIPand much more
visit
http://ebooks2download.blogspot.com
today

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


download free computer books enjoy

2007-02-17 Thread [EMAIL PROTECTED]
Free Computer Education Ebooks,Tutorials and much more
  ASP, Business, C++, Careers, CISCO, e-books, Engineering, English,
Filmmaking, Finance, Health,
  Leadership, Management, Marketing, Mathematics, Mobile, Oracle,
Perl , Photography, PHP,
  Programming, VOIPand much more
visit
http://ebooks2download.blogspot.com
today

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


Re: Help Required for Choosing Programming Language

2007-02-17 Thread Max Wilson
On Feb 17, 1:35 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> But I've done extensive, cross-platform development with Qt. And can
> assert that it is unmatched in productivity and feature richness,
> especially when combined with python. And certainly beat VB, and most
> probably even delphi (albeit I haven't done too much in that to really
> put all my weight behind these words). [snip]

Thanks for the pointer--my hobby right now is a GURPS-based wargame
and I'm still looking for a good front-end generator. pygsear seems
nice in a lot of ways, but it's possible Qt will require less
development on my part. (I need to have one window, but split into
separate panels in the style of old RPGs like Wizardry and Bard's
Tale.) I'll have a look.

-Maximilian

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


Re: f---ing typechecking

2007-02-17 Thread Paul Rubin
"Paul McGuire" <[EMAIL PROTECTED]> writes:
> This may be where the "tuple is like a struct" analogy isn't so good,
> and "tuple is like a list but immutable" is better.

Right, that's what I'm getting at.
-- 
http://mail.python.org/mailman/listinfo/python-list


Importing from upper directory

2007-02-17 Thread Harlin Seritt
I have a script that I want to import called upper.py. It is 2
directories above the script that will call it - i'll call that one
main.py. How am I able to import a script in a directory that is above
it?

Thanks,

Harlin

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


Re: WHAT IS THIS?

2007-02-17 Thread James Stroud
Captain wrote:
> Just bought a new PC with Windows XP Media Edition.  I have two entries in 
> the "Add or Remove Programs" section of Control Panel, but there is no 
> corresponding item in the Start Menu.  One entry says: Python 2.2.3 and the 
> other says: Python 2.2 pywin32 extensions (build203)..  The size for each is 
> 29.28mb.  I gather Python is a programming language, but I am wondering why 
> it was installed on my PC, and is it safe to remove it?  I have no intention 
> of learning the program.  Thanks in advance 
> 
> 

Better would be to remove windows xp and get another operating system.

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


Re: Help Required for Choosing Programming Language

2007-02-17 Thread Bruno Desthuilliers
Stef Mientki a écrit :
> Bruno Desthuilliers wrote:
> 
>> Stef Mientki a écrit :
>>
>>> [EMAIL PROTECTED] wrote:
>>>
 I am VB6 programmer and wants to start new programming language but i
 am unable to deciced.

 i have read about Python, Ruby and Visual C++. but i want to go
 through with GUI based programming language like VB.net

 so will you please guide me which GUI based language has worth with
 complete OOPS Characteristics
>>>
>>>
>>> Although the GUI of Python is not as good as VB,
>>
>>
>> "the GUI of Python" ? What's that ? Python is a *programming 
>> language*, not a GUI toolkit.
> 
> The final goal of programming language is (in most cases)
> meant to create functional things,
> that can assist people to perform their tasks.
> The UI of that resulting thing should be optimal adapted to the final 
> audience (and task).
> My audience is most comfortable with a intuitive GUI.
> In most of my applications,
> I need about 50% of the time for the GUI and 50% for the other 
> functional code.
> These estimates are for Delphi (is about identical as VB, which I used 
> previous).

Stef, I come from the Mac world, at a time where Windows didn't even 
exist. I learned programming on a Mac (by the System7 days), then, a few 
years later, became a professional Windows programmer - using VB, 
VisualC++, etc. My first steps with Python were about GUI apps on 
Windows. I've switched to Linux and web programming since, but I do know 
what Windows GUI programming with Python is.

> For what I've seen until now from Python,
> - designing the GUI will cost me about 2 .. 3 times as much in Python

Bullshit. You don't design the GUI with Python, but with one of the GUI 
designers coming with your GUI toolkit (that's, mostly, wxGlade for 
wxWidgets, Glade for GTK, and QTDesigner for QT). All these tools have 
all the needed features.

> - Python is not capable of doing everything I need
> (almost all interactive actions are very primitive and crashes a lot)

I've shipped some wxPython apps, and tehy were usually more stable than 
the VB ones.

> - designing my other functional code in Python,
> will reduce the development time with an estimated factor of 2
> So the combination of Delphi (or VB) and Python seems the optimal 
> combination for heavily GUI's.

My experience is that you *dont* need Delphi nor VB at all.

> - one of the big problems with Python is the version differences 
> (compatibility)

By itself, Python is very carefully designed for backward compat - 
you'll find that much of the code written by the 1.5.2 days still work 
as is. True, there are some compat requirements wrt/ which version of 
wxPython works with which versions of wxWidgets and Python, but nothing 
unusual here.

> Bruno, I think we've a different audience / target application,
> and at the moment we'll never agree about GUI,

cf above. When I was writing Windows GUI apps, my target audience was 
mostly people knowing how to use a professional app on Windows. Now I'm 
doing web apps, and my target audience may include my own mother - which 
is not specially computer savy (even MacOS is too complex for her...).

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


Re: why I don't like range/xrange

2007-02-17 Thread Bruno Desthuilliers
Roel Schroeven a écrit :
> Bruno Desthuilliers schreef:
> 
>> stdazi a écrit :
> 
> 
>>> for (i = 0 ; i < 10 ; i++)
>>>i = 10;
>>
>>
>> for i in range(10):
>>i = 10
>>
>> What's your point, exactly ?
> 
> 
> In the first iteration, i is set equal to 10. Then, before starting the 
> second iteration, i is incremented to 11; then the loop condition is 
> checked and results in false. So the loop terminates after the first 
> iteration.

oops - my bad. But why would one do so when a break would do the trick:
for i in range(10):
   break

> 
> So, the point is that in C you can influence the loop's behavior by 
> modifying the loop variable, while you cannot do that in Python (at 
> least not in a for-loop).

A good thing IMHO.

> In other words, the point is that you can't translate loops literally 
> from C to Python. Which is nothing new, and I fail to see how that is 
> supposed to be a disadvantage.
> 

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

Re: WHAT IS THIS?

2007-02-17 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, James Stroud wrote:

> Better would be to remove windows xp and get another operating system.

Yeah XP is sooo ooold, the OP should install Vista.  Or did you mean a
real OS instead of just another one?  ;-)

SCNR,
Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: f---ing typechecking

2007-02-17 Thread Donn Cave
Quoth Paul Rubin :
| Donn Cave <[EMAIL PROTECTED]> writes:
| > What this proves is that you can implement
| > an argument list at run time, but it by no means changes the
| > nature of the argument list as a sequence.
|
| Right, it's treated as a sequence rather than a record structure.
| So is that consistent with the "tuples are record structures" view,
| as opposed to the "tuples are immutable lists" view?

A struct is a sequence, and your stdargs example is a pretty good case
in point.

When I said the function implemented with stdarg (...) support needs
information about its parameters to simulate a normal function, that
applies not only to the order of parameters but also their type.
Because -- as with structs, but unlike arrays -- the parameter list
has variable alignment to accommodate different sized types.  So the
C parameter list really has every property of a struct -- naturally
contains mixed types, has variable alignment, normally accessed by name --
but it does have a defined order, and stdarg is a gimmick that uses it.

Order IS the struct property that you get from a tuple, so it is of
course important that the tuple is a sequence.  The point is not whether
it's a sequence or not, but what kind of order it represents.

What I'm saying with the evidently overly abstract discussion in previous
posts, is that in a struct-like application, a tuple's order is of a
different nature than a list.  Because in such application, that order
is absolute and in a sense atomic.  Like a struct.  Like an argument list.
That's why tuple has different applications than list, that's why it lacks
some of the sequential access features that lists have.

This must be more obvious in other languages that have a tuple type.
None that I know of support so many list or array sequence operations
on tuples, and in at least some the struct/record type is implemented
by adding names to a tuple but can still be treated as one (like Python's
mtime and stat types.)

Donn Cave, [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Importing from upper directory

2007-02-17 Thread Gary Herron
Harlin Seritt wrote:
> I have a script that I want to import called upper.py. It is 2
> directories above the script that will call it - i'll call that one
> main.py. How am I able to import a script in a directory that is above
> it?
>
> Thanks,
>
> Harlin
>   
You can control the directories from which Python imports by modifying 
the sys.path attribute. Something like this:

import sys
sys.path.append("../..") #That's two directories up from the current 
directory
import upper

If you're unsure what the current working directory is, try:

import os
print os.getcwd() # The current working directory

If it's not the current directory, but rather the directory containing 
the original script you want, then

import sys, os
path = sys.argv[0] #Initial script name
path0 = os.path.split(path)[0] #Initial script path
path1 = os.path.split(path0)[0] # Up one
path2 = os.path.split(path1)[0] # Up two
sys.append(path2)

Gary Herron



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


Re: Approaches of interprocess communication

2007-02-17 Thread Donn Cave
Quoth Steve Holden <[EMAIL PROTECTED]>:
| Ben Finney wrote:
...
| > If a programmer decides on behalf of the user that "localhost" should
| > be treated specially, that programmer is making an error.
|
| Inter-process TCP/IP communication between two processes on the same 
| host invariably uses the loopback interface (network 127.0.0.0). 
| According to standards, all addresses in that network space refer to the 
| local host, though 127.0.0.1 is conventionally used.
|
| The transmit driver for the loopback interface receives a datagram from 
| the local network layer and immediately announces its reception back to 
| the local network layer.

Are you saying, in that first paragraph, that if for example I telnet to
my local host's external IP address, to a service that bound explicitly to
the external interface -- I'll actually be going through the loopback
interface anyway, invariably regardless of host network implementation?

Donn Cave, [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


PyPy 0.99 released

2007-02-17 Thread Carl Friedrich Bolz
==
pypy-0.99.0: new object spaces, optimizations, configuration ...
==

Welcome to the PyPy 0.99.0 release - a major snapshot
and milestone of the last 8 months of work and contributions
since PyPy-0.9.0 came out in June 2006!

Main entry point for getting-started/download and documentation:

 http://codespeak.net/pypy/dist/pypy/doc/index.html

Further below you'll find some notes about PyPy,
the 0.99.0 highlights and our aims for PyPy 1.0.

have fun,

 the PyPy team,
 Samuele Pedroni, Carl Friedrich Bolz, Armin Rigo, Michael Hudson,
 Maciej Fijalkowski, Anders Chrigstroem, Holger Krekel,
 Guido Wesdorp

 and many others:
 http://codespeak.net/pypy/dist/pypy/doc/contributor.html


What is PyPy?


Technically, PyPy is both a Python Interpreter implementation
and an advanced Compiler, actually a framework for implementing
dynamic languages and generating virtual machines for them.
The Framework allows for alternative frontends and
for alternative backends, currently C, LLVM and .NET.
For our main target "C", we can can "mix in" different Garbage
Collectors and threading models, including micro-threads aka
"Stackless".  The inherent complexity that arises from this
ambitious approach is mostly kept away from the Python
interpreter implementation, our main frontend.

Socially, PyPy is a collaborative effort of many individuals
working together in a distributed and sprint-driven way since
2003.  PyPy would not have gotten as far without the coding,
feedback and general support from numerous people.

Formally, many of the current developers are involved in
executing an EU contract with the goal of exploring and
researching new approaches to Language/Compiler development and
software engineering.  This contract's duration is about to
end March 2007 and we are working and preparing the according
final review which is scheduled for May 2007.


Key 0.99.0 Features
=

* new object spaces:

   - Tainting: a 270-line proxy object space tracking
 and boxing sensitive information within an application.
 A tainted object is completely barred from crossing
 an I/O barrier, such as writing to files, databases
 or sockets.  This allows to significantly reduce the
 effort of e.g. security reviews to the few places where
 objects are "declassified" in order to send information
 across I/O barriers.

   - Transparent proxies: allow to customize both application and
 builtin objects from application level code.  Works as an addition
 to the Standard Object Space (and is translatable). For details see
 http://codespeak.net/pypy/dist/pypy/doc/proxy.html

* optimizations:

   - Experimental new optimized implementations for various built in
 Python types (strings, dicts, lists)

   - Optimized builtin lookups to not require any dictionary lookups if
 the builtin is not shadowed by a name in the global dictionary.

   - Improved inlining (now also working for higher level backends) and
 malloc removal.

   - twice the speed of the 0.9 release, overall 2-3 slower than CPython

* High level backends:

   - It is now possible to translate the PyPy interpreter to run on the
 .NET platform, which gives a very compliant (but somewhat slow)
 Python interpreter.

   - the JavaScript backend has evolved to a point where it can be used
 to write AJAX web applications with it. This is still an
 experimental technique, though. For demo applications see:
 http://play1.codespeak.net:8008/

* new configuration system:
   There is a new comprehensive configuration system that allows
   fine-grained configuration of the PyPy standard interpreter and the
   translation process.

* new and improved modules: Since the last release, the signal, mmap,
   bz2 and fcntl standard library modules have been implemented for PyPy.
   The socket, _sre and os modules have been greatly improved. In
   addition we added a the pypymagic module that contains PyPy-specific
   functionality.

* improved file implementation: Our file implementation was ported to
   RPython and is therefore faster (and not based on libc).

* The stability of stackless features was greatly improved. For more
   details see: http://codespeak.net/pypy/dist/pypy/doc/stackless.html

* RPython library: The release contains our emerging RPython library
   that tries to make programming in RPython more pleasant. It contains
   an experimental parser generator framework. For more details see:
   http://codespeak.net/pypy/dist/pypy/doc/rlib.html

* improved documentation:

   - extended documentation about stackless features:
 http://codespeak.net/pypy/dist/pypy/doc/stackless.html

   - PyPy video documentation: eight hours of talks, interviews and
 features: http://codespeak.net/pypy/dist/pypy/doc/video-in

handling secure attachments in email messages

2007-02-17 Thread Bernard Delmée
Hello,

We have a processing chain automatically handling email attachments
in python, which works well. We'd like to add support for encrypted
files. We're using python 2.3 on HP-UX. I've checked the online 2.5
documentation, and my understanding is that the standard library still
only has support for messages digests, not full encryption of content.
The stock answer seems to be to use the "Python Cryptography Toolkit"
by AM Kuchlin. It compiled alright on HPUX; I have a .sl extension
library which I cannot import for some reason. Ideally I'd want PGP
support/compatibility so senders could submit files with PGP integrated
to their mail system. Can anyone suggest a module that can help achieve
this goal? Any pointer or evidence of a working solution with or
without usage of the aforementioned libraries would be appreciated.

Thanks,

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


Re: why I don't like range/xrange

2007-02-17 Thread [EMAIL PROTECTED]
Bruno Desthuilliers wrote:
> Roel Schroeven a ecrit :
> > Bruno Desthuilliers schreef:
> >
> >> stdazi a ecrit :
> >
> >
> >>> for (i = 0 ; i < 10 ; i++)
> >>>i = 10;
> >>
> >>
> >> for i in range(10):
> >>i = 10
> >>
> >> What's your point, exactly ?
> >
> >
> > In the first iteration, i is set equal to 10. Then, before starting the
> > second iteration, i is incremented to 11; then the loop condition is
> > checked and results in false. So the loop terminates after the first
> > iteration.
>
> oops - my bad. But why would one do so when a break would do the trick:
> for i in range(10):
>break

After the C loop finishes, i is 11.  After the python loop-with-break
finishes, i is 0.  That may effect later code.

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


Getting a class name

2007-02-17 Thread Harlin Seritt
Hi,

How does one get the name of a class from within the class code? I
tried something like this as a guess:

self.__name__

Obviously it didn't work.

Anyone know how to do that?

Thanks,

Harlin

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


Re: Getting a class name

2007-02-17 Thread deelan
Harlin Seritt wrote:
> Hi,
> 
> How does one get the name of a class from within the class code? I
> tried something like this as a guess:
> 
> self.__name__

Get the class first, then inspect its name:

 >>> class Foo(object): pass
...
 >>> f = Foo()
 >>> f.__class__.__name__
'Foo'
 >>>

HTH


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


Re: Approaches of interprocess communication

2007-02-17 Thread Damjan
> | > If a programmer decides on behalf of the user that "localhost" should
> | > be treated specially, that programmer is making an error.
> |
> | Inter-process TCP/IP communication between two processes on the same
> | host invariably uses the loopback interface (network 127.0.0.0).
> | According to standards, all addresses in that network space refer to the
> | local host, though 127.0.0.1 is conventionally used.
> |
> | The transmit driver for the loopback interface receives a datagram from
> | the local network layer and immediately announces its reception back to
> | the local network layer.
> 
> Are you saying, in that first paragraph, that if for example I telnet to
> my local host's external IP address, to a service that bound explicitly to
> the external interface -- I'll actually be going through the loopback
> interface anyway, invariably regardless of host network implementation?

On linux at least, this is true, yes.


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


Re: how to use Dispatch to open an application in win32com.client

2007-02-17 Thread vithi
Hi
Since I haven't see any help or tutorial on com there is a application
is installed in the server I am login to the server then what code do
I have to implement to launch the application registered in a server.
how do I write a code to tell my computer to go in to the perticular
server and launch program "XYZ "

do you think this code alone enough to go and look for  xyz
application in the server, I don't get it
Give me any sample code or more help. It help me a lot.
 object = win32com.client.Dispatch("xyz.Application")


On Feb 16, 11:56 pm, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> En Fri, 16 Feb 2007 23:36:26 -0300, vithi <[EMAIL PROTECTED]> escribió:
>
> > I am trying to launch an application. When I try like that
> > When I try like that Excel is opening
> > import win32com.client
> > object = win32com.client.Dispatch("Excel.Application")
> > object.Visible = 1
>
> > But when I try my application which is QeepIt.exe
> > which is in the c:\ drive it is not running
> > Any body tell me how to give path to open an exectable application in
> > Dispatch modules
> > I try like that
> > object = win32com.client.Dispatch("c:\Folder\QeepIt.exe")
> > It give an error.
>
> The above code is used to launch a COM server registered under the name  
> "Excel.Application" and then control it. If you don't know what a COM  
> server is, surely your application can't be used this way.
>
> For launching another program, perhaps sending it some text, and capturing  
> its output, look at the subprocess module. If you are only interested in  
> executing it, with no additional communication, os.system() may be enough.
>
> --
> Gabriel Genellina


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


Re: message processing/threads

2007-02-17 Thread Aahz
In article <[EMAIL PROTECTED]>,
Jonathan Curran  <[EMAIL PROTECTED]> wrote:
>
>I need a program running in the background to process messages (FIFO order) 
>which I would send using soap/xmlrpc/pyro (haven't decided yet). According to 
>my thinking I would need to make this a threaded application. One thread to 
>process the messages and the other thread(s) would be used to listen for 
>messages and insert it into the message queue.
>
>Is my thinking correct? Is there a better way to do such a thing?

Well, that's one option.  Your other two options are to implent your
program with multiple processes or to use event-loop programming.  Your
basic design looks reasonably sound, though you might consider multiple
threads to process messages (which probably won't provide any performance
boost but could enhance response if you're using callbacks at all).
-- 
Aahz ([EMAIL PROTECTED])   <*> http://www.pythoncraft.com/

"I disrespectfully agree."  --SJM
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: message processing/threads

2007-02-17 Thread fumanchu
On Feb 11, 9:30 pm, Jonathan Curran <[EMAIL PROTECTED]> wrote:
> I need a program running in the background to process
> messages (FIFO order) which I would send using
> soap/xmlrpc/pyro (haven't decided yet). According to
> my thinking I would need to make this a threaded
> application. One thread to process the messages
> and the other thread(s) would be used to listen for
> messages and insert it into the message queue.

You just described a threaded HTTP server ;) (although they aren't
strictly FIFO). If you did decide on SOAP or XML-RPC, feel free to
grab CherryPy instead of writing your own listener. http://www.cherrypy.org


Robert Brewer
System Architect
Amor Ministries
[EMAIL PROTECTED]

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


Complex HTML forms

2007-02-17 Thread George Sakkis
I'd like to gather advice and links to any existing solutions (e.g.
libraries, frameworks, design patterns) on general ways of writing
complex web forms, as opposed to the typical {name:value} flat model.
A particular case of what I mean by complex is hierarchical forms. For
instance, a form that consists of a select list widget, where each
item of the list activates a distinct set of other widgets. Think for
example of a web frontend to CSV or SVN options and commands, where
each command has its own suboptions. The suboptions are hidden (or
even inexistent) until the user selects the specific command, and only
then they appear (typically by Javascript). When the form is
submitted, the selected options are passed in the server in some form
that preserves the hierarchy, i.e. not as a flat dict. Is there
anything close to such a beast around ?

George

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


Mensaje Eliminado por contener virus

2007-02-17 Thread Correo Ejercito Nacional de Colombia
Este es un aviso del servicio de ANTIVIRUS DEL EJERCITO NACIONAL DE COLOMBIA, 
informando que el mensaje (e-mail) adjunto, fue eliminado por contener algun 
clase de virus.

Cualquier inquietud por favor contactar el ÁREA DE SEGURIDAD INFORMATICA DEL 
EJERCITO. Email: [EMAIL PROTECTED]--- Begin Message ---
The message was undeliverable due to the following reason:

Your message was not delivered because the destination computer was
not reachable within the allowed queue period. The amount of time
a message is queued before it is returned depends on local configura-
tion parameters.

Most likely there is a network problem that prevented delivery, but
it is also possible that the computer is turned off, or does not
have a mail system running right now.

Your message was not delivered within 8 days:
Server 198.52.151.118 is not responding.

The following recipients could not receive this message:
<[EMAIL PROTECTED]>

Please reply to [EMAIL PROTECTED]
if you feel this message to be in error.



VIRUS_DETECTED_AND_REMOVED.TXT
Description: Binary data
--- End Message ---
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Help Required for Choosing Programming Language

2007-02-17 Thread Stef Mientki
>> - designing the GUI will cost me about 2 .. 3 times as much in Python
> 
> You mean delphi here I presume?
No, but if that's your believe ..
Some examples:
- Creating a treeview (like in the M$ explorer), with full edit capabilities 
and full drag & drop
facilities: Delphi takes about 40 lines of code (most of them even ^C ^V).
- Creating a graphical overview of relations between database tables, which can 
be graphical
manipulated by the user (like in M$ Access): Delphi 20 lines of code.
I wonder what this costs in Python ?

>> - Python is not capable of doing everything I need
>> (almost all interactive actions are very primitive and crashes a lot)
> 
> I'm not sure what you are talking about here, and I have the deep 
> impression you yourself don't as well.
I'm not an (educated) programmer, so I don't always use the right terms :-(
If I look at a well established program like DIA,
and see that it still can't repaint it's screen always correctly, ...
If I just look at MathPlotLib ;-)
But I also know one beautiful program based on wx: KICAD.

> 
> Matter of factly, there is no "the python GUI". There are quite a few 
> choices. The built-in tkinter, which - while limited in some senses - is 
> developed by Frederik Lundh, and while I personally haven't done too 
> much with it, his reputation as one of the most high profiled python 
> developers doesn't go along pretty well with your assertions above. So 
> -whatever you used as GUI-toolkit, you either used it wrong, or it 
> really wasn't good.
> 
> But then there are at least three major other toolkits available, wx, 
> gtk and Qt. The first two I've only dabbled a bit with and can't comment 
> on.
> 
> But I've done extensive, cross-platform development with Qt. And can 
> assert that it is unmatched in productivity and feature richness, 
> especially when combined with python. And certainly beat VB, and most 
> probably even delphi (albeit I haven't done too much in that to really 
> put all my weight behind these words).
> 
> And so I'm under the strong impression that your - undoubtedly correct 
> from a personal point of view, and I don't think your meaning evil here 
> - observations are wrong and are based on a lack of experience in python 
> and it's available gui-options.

I've been using Python for just 2 months, and didn't try any graphical design,
I've other priorities first.
I would love to see:
- a comparison between wx and gtk (QT doesn't have a very inviting license ;-)
- some Python applications that uses one of these graphical libraries.

To give you an impression of some features I'm after, I've prepared an 
animation (not completely
ready yet), of the program I've written in Delphi, with both embedded MatLab 
and embedded Python,
where MatLab or Python does all the real-time numerical analysis.
   http://oase.uci.kun.nl/~mientki/download/medilab_tot.htm
Writing this program, including teaching myself Python (with a lot of help of 
this group, thank you
all !!), and writing the bloodpressure analysis in both MatLab and Python, 
excluding the 
ADC-drivers, costed me about 150 .. 200 hours ...
... can that be done be an experienced programmer in Python.

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: cmd all commands method?

2007-02-17 Thread Bjoern Schliessmann
placid wrote:

> if i want to treat every cmdloop prompt entry as a potential
> command then i need to overwrite the default() method ?

Excuse me, what's a cmdloop prompt? What's the "default() method"?
 
> What i want to achieve is to be able to support global variable
> creation for example;
> 
> res = sum 1 2
> 
> this would create a variable res with the result of the method
> do_sum() ?
> 
> then would i be able to run;
> 
> sum a  5
> 
> this would return 8 or an error saying that res is not defined

Are you sure you're talking about Python here?

Regards,


Björn

-- 
BOFH excuse #7:

poor power conditioning

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


Re: how to use Dispatch to open an application in win32com.client

2007-02-17 Thread Gabriel Genellina
En Sat, 17 Feb 2007 17:47:23 -0300, vithi <[EMAIL PROTECTED]> escribió:

> Hi
> Since I haven't see any help or tutorial on com there is a application
> is installed in the server I am login to the server then what code do
> I have to implement to launch the application registered in a server.
> how do I write a code to tell my computer to go in to the perticular
> server and launch program "XYZ "

Try to explain a bit better what do you want to do.
What is "the server"?
Do you want to open and execute a program on "another" computer?
Or is it on the "same" computer?

> do you think this code alone enough to go and look for  xyz
> application in the server, I don't get it
> Give me any sample code or more help. It help me a lot.
>  object = win32com.client.Dispatch("xyz.Application")

Does the manual for "xyz" say that it is a COM application?
Did someone told you that "xyz" works that way?
Did you find "xyz" actually registered as a COM application?
If not, forget about that line, won't work at all.

-- 
Gabriel Genellina

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


Re: Complex HTML forms

2007-02-17 Thread Paul Boddie
George Sakkis wrote:
> When the form is submitted, the selected options are passed in the server in 
> some form
> that preserves the hierarchy, i.e. not as a flat dict. Is there anything 
> close to such a beast around ?

Yes, I have a framework called XSLForms which generates hierarchical
field names when rendering XML documents using XSL-based templates;
these field names are then interpreted in order to build XML documents
based on the encoded hierarchy information. When these activities are
successfully combined, the outcome is some kind of serialisation of
XML data in Web forms.

Take a look at the XSLTools distribution (which contains XSLForms):

http://www.python.org/pypi/XSLTools

Using the framework is not as easy as I'd like it to be, but there are
a few examples (as well as the code, of course) and that should give
you some ideas.

Paul

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


Re: WHAT IS THIS?

2007-02-17 Thread Captain
Thanks for the responses. I'll just leave it.  Sorry about uppercase subject 
line.
"Captain" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Just bought a new PC with Windows XP Media Edition.  I have two entries in 
> the "Add or Remove Programs" section of Control Panel, but there is no 
> corresponding item in the Start Menu.  One entry says: Python 2.2.3 and 
> the other says: Python 2.2 pywin32 extensions (build203)..  The size for 
> each is 29.28mb.  I gather Python is a programming language, but I am 
> wondering why it was installed on my PC, and is it safe to remove it?  I 
> have no intention of learning the program.  Thanks in advance
> 


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


How do I save the contents of a text buffer

2007-02-17 Thread google
Hi,

I'm using Python with pygtk and have this problem - I have read the
contents of a file into the text buffer with this code,

infile = open("mytextfile", "r")
if infile:
string = infile.read()
infile.close()
textbuffer.set_text(string)

As a test, I tried to write the buffer back to a file with this code
but did not work,

outfile = open("newbannedsitelist", "w")
outfile.write(textbuffer.get_text(0, 1000,
include_hidden_chars=True))
outfile.close()

What I want to know is how do I write the contents of the text buffer
back to a file?

Thanks

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


Re: message processing/threads

2007-02-17 Thread Irmen de Jong
Jonathan Curran wrote:
> I need a program running in the background to process messages (FIFO order) 
> which I would send using soap/xmlrpc/pyro (haven't decided yet). According to 
> my thinking I would need to make this a threaded application. One thread to 
> process the messages and the other thread(s) would be used to listen for 
> messages and insert it into the message queue.
> 
> Is my thinking correct? Is there a better way to do such a thing?

For your interest:
Pyro includes a "server" by itself that takes care of all of this.


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


'import dl' on AMD64 platform

2007-02-17 Thread John Pye
Hi all

I have a tricky situation that's preventing my Python/SWIG/C
application from running on the Debian Etch AMD64 platform.

It seems that the 'dl' module is not available on that platform. The
only reason I need the 'dl' module, however, is for the values of
RTLD_LAZY etc, which I use with sys.setdlopenflags() in order to make
my imported SWIG module share its symbols correctly with more deeply-
nested plugin modiles in my C-code layer.

I wonder if there is a workaround for this -- perhaps another way to
access the values of those RTLD flags?

Cheers
JP

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


Re: Help Required for Choosing Programming Language

2007-02-17 Thread Stef Mientki
> I would love to see:
> - a comparison between wx and gtk (QT doesn't have a very inviting 
> license ;-)
I just found this:
http://www.wxwidgets.org/wiki/index.php/WxWidgets_Compared_To_Other_Toolkits
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do I save the contents of a text buffer

2007-02-17 Thread Steven D'Aprano
On Sat, 17 Feb 2007 15:47:20 -0800, google wrote:

> As a test, I tried to write the buffer back to a file with this code
> but did not work,

Oooh, guessing games! I love guessing games!

Let me see... did it reboot your PC?

Did Python crash?

Did you get an exception? Maybe something about not being able to open
the file for reading? Or perhaps disk full?

Did you get something unexpected in the file? Maybe an empty file?

I'm guessing... it erased your hard disk. Do I win?



-- 
Steven.

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


Re: How do I save the contents of a text buffer

2007-02-17 Thread Gabriel Genellina
En Sat, 17 Feb 2007 20:47:20 -0300, <[EMAIL PROTECTED]> escribió:

> I'm using Python with pygtk and have this problem - I have read the
> contents of a file into the text buffer with this code,
>
> infile = open("mytextfile", "r")
> if infile:
> string = infile.read()
> infile.close()
> textbuffer.set_text(string)

Note that "if infile" does nothing: either the open succeeds and you get a  
file object which is *always* True, or the open fails and raises an  
exception and the code below never executes.

> As a test, I tried to write the buffer back to a file with this code
> but did not work,

"did not work" means...

-- 
Gabriel Genellina

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


Re: Help Required for Choosing Programming Language

2007-02-17 Thread Gabriel Genellina
En Sat, 17 Feb 2007 21:12:07 -0300, Stef Mientki  
<[EMAIL PROTECTED]> escribió:

>> I would love to see:
>> - a comparison between wx and gtk (QT doesn't have a very inviting
>> license ;-)
> I just found this:

> http://www.wxwidgets.org/wiki/index.php/WxWidgets_Compared_To_Other_Toolkits

But keep in mind that that comparison may be biased... A more impartial  
source would be better.

-- 
Gabriel Genellina

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


Help Parsing XML Namespaces with BeautifulSoup

2007-02-17 Thread [EMAIL PROTECTED]
I'm trying to parse out some XML nodes with namespaces using
BeautifulSoup. I can't seem to get the syntax correct. It doesn't like
the colon in the tag name, and I'm not sure how to refer to that tag.

I'm trying to get the attributes of this tag:



The only way I've been able to get it is by doing a findAll with
regex. Is there a better way?

--

from BeautifulSoup import BeautifulStoneSoup
import urllib2

url = 'http://weather.yahooapis.com/forecastrss?p=33609'
page = urllib2.urlopen(url)
soup = BeautifulStoneSoup(page)

print soup['yweather:forecast']

--

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


Re: How do I save the contents of a text buffer

2007-02-17 Thread google
I just included file opening code just to show how i read the file
into the text buffer - I have no issues with this as such. Problem is
only with the writing of the text buffer back to a file. When I try to
write the buffer to a file it gave the following,


Traceback (most recent call last):
  File "./configbox.py", line 78, in ?
TextViewExample()
  File "./configbox.py", line 53, in __init__
outfile.write(textbuffer.get_text(0,1000,
include_hidden_chars=True))
TypeError: start should be a GtkTextIter

How can I use outfile.write() to wite the contents of the text buffer
correctly?

Thanks


On Feb 18, 1:38 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote:
> En Sat, 17 Feb 2007 20:47:20 -0300, <[EMAIL PROTECTED]> escribió:
>
> > I'm using Python with pygtk and have this problem - I have read the
> > contents of a file into the text buffer with this code,
>
> > infile = open("mytextfile", "r")
> > if infile:
> > string = infile.read()
> > infile.close()
> > textbuffer.set_text(string)
>
> Note that "if infile" does nothing: either the open succeeds and you get a
> file object which is *always* True, or the open fails and raises an
> exception and the code below never executes.
>
> > As a test, I tried to write the buffer back to a file with this code
> > but did not work,
>
> "did not work" means...
>
> --
> Gabriel Genellina


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


Re: How do I save the contents of a text buffer

2007-02-17 Thread google
On Feb 18, 1:14 pm, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
> On Sat, 17 Feb 2007 15:47:20 -0800, google wrote:
> > As a test, I tried to write the buffer back to a file with this code
> > but did not work,
>
> Oooh, guessing games! I love guessing games!

Good

> Let me see... did it reboot your PC?

No

> Did Python crash?

No - it runs on nix

> Did you get an exception? Maybe something about not being able to open
> the file for reading? Or perhaps disk full?

File read ok for input, its the file write thats the problem

> Did you get something unexpected in the file? Maybe an empty file?

Yes, a rabbit popped out of the floppy slot - amazing!

> I'm guessing... it erased your hard disk. Do I win?

Sorry, you loseare you a Windows user?

> --
> Steven.


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


Game Programming Clinic and Online Gaming at PyCon

2007-02-17 Thread Jeff Rush
At PyCon this year we're going to have a multi-day game programming clinic and 
challenge.  This is a first-time event and an experiment to find those in the 
Python community who enjoy playing and creating games.  Python has several 
powerful modules for the creation of games among which are PyGame and PyOpenGL.

On Friday evening, Phil Hassey will give an introduction to his game Galcon, 
an awesome high-paced multi-player galactic action-strategy game.  You send 
swarms of ships from planet to planet to take over the galaxy.  Phil will be 
handing out free limited-time licenses to those present.  He will also be glad 
to talk about the development of Galcon using PyGame.

After the Friday PSF Members meeting lets out around 8:40pm, Richard Jones 
will give his 30-60 minute introduction to the PyGame framework so you too can 
get started writing games.

On Saturday evening, Lucio Torre and Alejandro J. Cura, who have come from 
Argentina to give the talk "pyweek: making games in 7 days" Friday afternoon, 
will help people develop their games in the clinic room with mini-talks on 
various game technologies.

On Sunday evening Lucio and Alejandro will be around to help with further 
development issues, and Richard Jones will be back to present more about 
PyGame and help reach a group concensus on what to work on during the 
GameSprint.  Richard also runs PyWeek, a bi-annual python game programming 
challenge online.

Phil will also be back helping people get into playing Galcon and everyone can 
get into multiplayer challenges against those who show up.

And then during the four days of sprinting, the group will compete to produce 
a working game meeting agreed upon requirements and then decide who has best 
achieved those.

This overall gaming track is informal, with people coming and going, and 
others are welcome to get involved in giving mini-talks or showing off their 
creations.

Specific rooms and times can be found on the birds-of-a-feature wiki page at:

 http://us.pycon.org/TX2007/BoF

The wiki page for collecting game clinic ideas is at:

 http://us.pycon.org/TX2007/GamingClinic

And the wiki page for the game sprint is at:

 http://us.pycon.org/TX2007/GameSprint

---
Want to get a head start?  Follow the online lectures about PyGame at:

 http://rene.f0o.com/mywiki/PythonGameProgramming

And to get your laptop ready, check out the installation and testing 
instructions about half way down the page at:

http://rene.f0o.com/mywiki/LectureOne#line-50

You can also check out the game Galcon at:

http://www.imitationpickles.org/galcon/index.html

See you later this week,

Jeff Rush
Co-Chair PyCon 2007
-- 
http://mail.python.org/mailman/listinfo/python-list


PyDev on Mac

2007-02-17 Thread Ahmer
I've been trying to set up PyDev on my new MacBook Pro, but i have not
had an success.

Could you please help!

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


Need an identity operator because lambda is too slow

2007-02-17 Thread Deron Meranda
This is an optimization problem, one that occurs deep inside a loop
that gets executed thousands of times.  I'm looking for something in
Python which would act like an identity operator, or I-combinator: a
do-nothing function.  The best I know of is:  (lambda x: x), but it is
not ideal.

Consider a much-simplified example of such an iteration where
sometimes you need to transform an item by some function, but most of
the time you don't:

if some_rare_condition:
func = some_transform_function
else:
func = lambda x: x
for item in some_sequence:
item2 = func(item)
. # more stuff

Now the "lambda x:x" acts suitably like an identity operator.  But it
is very slow, when compared to using more complex-looking code:

do_transform = some_rare_condition
for item in some_sequence:
if do_transform:
item2 = transform_function(item)
else:
item2 = item
. # more stuff

What python needs is something like a built-in "operator.identity"
function, which acts like "lambda x:x", but which the byte compiler
could recognize and completely optimize away so there is no function
call overhead.

Does this exist someplace in the corners of the language, or are there
any ideas about how best to do something like this without having to
push a bunch of ugly if-then-else constructs inside all the loops
rather than a more elegant function object?  (The need for this is
more obvious in my real-world code versus the simplified examples
above).

Thanks
--
Deron Meranda

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


Re: Need an identity operator because lambda is too slow

2007-02-17 Thread Paul Rubin
"Deron Meranda" <[EMAIL PROTECTED]> writes:
> do_transform = some_rare_condition
> for item in some_sequence:
> if do_transform:
> item2 = transform_function(item)
> else:
> item2 = item
> . # more stuff

This might be a little more direct:

from itertools import imap
if some_rare_condition:
   mapped_sequence = imap(transform_function, some_sequence)
else:
   mapped_sequence = some_sequence

for item in mapped_sequence:
# more stuff

I agree that an identity function would be useful.  I think I
suggested it a long time ago and didn't get much interest.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need an identity operator because lambda is too slow

2007-02-17 Thread Raymond Hettinger
[Deron Meranda
>]  I'm looking for something in
> Python which would act like an identity operator, or I-combinator: a
> do-nothing function.  The best I know of is:  (lambda x: x), but it is
> not ideal.

File a feature request on SourceForge and assign to me.  This has come
up a couple of times and would be trivial to implement in the operator
or functools modules.

Raymond

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


Re: How do I save the contents of a text buffer

2007-02-17 Thread Steven D'Aprano
On Sat, 17 Feb 2007 17:19:06 -0800, google wrote:

>> Did you get an exception? Maybe something about not being able to open
>> the file for reading? Or perhaps disk full?
> 
> File read ok for input, its the file write thats the problem

Well, duh. I know that -- that's what your first email said.

Don't tell us there's a problem. Tell us what the problem is. Duh.


>> Did you get something unexpected in the file? Maybe an empty file?
> 
> Yes, a rabbit popped out of the floppy slot - amazing!

You know how your teachers said "there are no stupid questions, only
stupid answers?" They lied.

Perhaps you should go away and read this before asking any further
questions.

http://catb.org/esr/faqs/smart-questions.html



>> I'm guessing... it erased your hard disk. Do I win?
> 
> Sorry, you loseare you a Windows user?


Sorry, you lose.

I really don't know why you're casting aspersions on the intelligence of
Windows users, when you're the one posting a stupid question. Do I really
need to spell it out? 

We can't tell you what the solution to the problem is if you won't tell us
what the problem is. If you get an exception, post the exception. If
something unexpected happens, tell us what it was. We're not mind-readers.


-- 
Steven.

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


Re: How do I save the contents of a text buffer

2007-02-17 Thread Steven D'Aprano
On Sat, 17 Feb 2007 17:10:50 -0800, google wrote:

> I just included file opening code just to show how i read the file
> into the text buffer - I have no issues with this as such. Problem is
> only with the writing of the text buffer back to a file. When I try to
> write the buffer to a file it gave the following,
> 
> 
> Traceback (most recent call last):
>   File "./configbox.py", line 78, in ?
> TextViewExample()
>   File "./configbox.py", line 53, in __init__
> outfile.write(textbuffer.get_text(0,1000,
> include_hidden_chars=True))
> TypeError: start should be a GtkTextIter


Ah, well there's your problem. start should be a GtkTextIter, just like
the exception says.

Question for you: in the line of code in the traceback, which function
takes an argument called "start"?


> How can I use outfile.write() to wite the contents of the text buffer
> correctly?

Your problem isn't with outfile.write(). 



-- 
Steven.

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


conver string to dictionary

2007-02-17 Thread mahdieh saeed
Hi
  I want to convert string to dictionary .what is the best solution for this ?
  for example string is like this:
   
  
'{"SalutationID":["primarykey",8388607,0,None],"CompanyID":[0,8388607,0,"index"],
 "SalutationName":["",255,0,None],"isDefault":["tinyint",1,1,None]}'
   
  and I want to convert this string to this dictionary:
   
  
{"SalutationID":["primarykey",8388607,0,None],"CompanyID":[0,8388607,0,"index"],
 "SalutationName":["",255,0,None],"isDefault":["tinyint",1,1,None]}
   
  please help me what is the best solution(faster solution) for this?
   
  thanks 
  regards
  saeed
   
   

 
-
8:00? 8:25? 8:40?  Find a flick in no time
 with theYahoo! Search movie showtime shortcut.-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Help Parsing XML Namespaces with BeautifulSoup

2007-02-17 Thread Paul McGuire
On Feb 17, 6:55 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I'm trying to parse out some XML nodes with namespaces using
> BeautifulSoup. I can't seem to get the syntax correct. It doesn't like
> the colon in the tag name, and I'm not sure how to refer to that tag.
>
> I'm trying to get the attributes of this tag:
>
>  text="Partly Cloudy/Wind" code="24">
>
> The only way I've been able to get it is by doing a findAll with
> regex. Is there a better way?
>
> --
>
> from BeautifulSoup import BeautifulStoneSoup
> import urllib2
>
> url = 'http://weather.yahooapis.com/forecastrss?p=33609'
> page = urllib2.urlopen(url)
> soup = BeautifulStoneSoup(page)
>
> print soup['yweather:forecast']
>
> --

If you are just trying to extract a single particular tag, pyparsing
can do this pretty readily, and the results returned make it very easy
to pick out the tag attribute values.

-- Paul


from pyparsing import makeHTMLTags
import urllib2

url = 'http://weather.yahooapis.com/forecastrss?p=78732'
page = urllib2.urlopen(url)
html = page.read()
page.close()

forecastTag = makeHTMLTags('yweather:forecast')[0]

for fc in forecastTag.searchString(html):
print fc.asList()
print "Date: %(date)s,  hi:%(high)s lo:%(low)s" % fc
print

Prints:

['yweather:forecast', ['day', 'Sat'], ['date', '17 Feb 2007'], ['low',
'34'], ['high', '67'], ['text', 'Clear'], ['code', '31'], True]
Date: 17 Feb 2007,  hi:67 lo:34

['yweather:forecast', ['day', 'Sun'], ['date', '18 Feb 2007'], ['low',
'42'], ['high', '65'], ['text', 'Sunny'], ['code', '32'], True]
Date: 18 Feb 2007,  hi:65 lo:42

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


Re: Getting a class name

2007-02-17 Thread goodwolf
I suppose that you wont get class name into its code (or before
definition end) but not into a method definition.


import sys

def getCodeName(deap=0):
return sys._getframe(deap+1).f_code.co_name


class MyClass (object):
name = getCodeName() + '!'


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


Re: Need an identity operator because lambda is too slow

2007-02-17 Thread Steven D'Aprano
On Sat, 17 Feb 2007 21:59:18 -0800, Deron Meranda wrote:

> Consider a much-simplified example of such an iteration where
> sometimes you need to transform an item by some function, but most of
> the time you don't:
> 
> if some_rare_condition:
> func = some_transform_function
> else:
> func = lambda x: x
> for item in some_sequence:
> item2 = func(item)
> . # more stuff

This does the test once, but does a function look-up every loop.


> Now the "lambda x:x" acts suitably like an identity operator.  But it
> is very slow, when compared to using more complex-looking code:
> 
> do_transform = some_rare_condition
> for item in some_sequence:
> if do_transform:
> item2 = transform_function(item)
> else:
> item2 = item
> . # more stuff

Despite doing the if..else comparison every loop, this is a little faster
for the case where some_rare_condition is false.

But I have to question whether this is a worthwhile optimization,
especially if some_rare_condition really is rare. Calling the identity
function "lambda x: x" one million times takes about half a second; or to
put it another way, each call to the identity function costs you about
half a microsecond. How much time does the rest of the loop processing
take? Are you sure you're optimizing something which needs to be optimized?

(E.g. if your main loop takes fifteen minutes to run, and you're trying to
shave off half a second, just don't bother.)

Compare the following, where I use an arbitrary small function as a
placeholder for whatever work you really want to do:

setup = """import time
identity = lambda x: x
do_work = lambda x: time.time() + x
x = 1
"""

Now use timeit to compare doing the work on its own with doing the work
together with an identity function:

>>> timeit.Timer("do_work(x)", setup).repeat()
[3.1834621429443359, 3.1083459854125977, 3.1382210254669189]
>>> timeit.Timer("do_work(identity(x))", setup).repeat()
[3.5951459407806396, 3.6067559719085693, 3.5801000595092773]

Is your "do_work" function really so fast that one second per two million
calls to identity() is a significant load?



If some_rare_condition really is rare, then a possible solution might
be:

if some_rare_condition:
some_sequence = [transform(item) for item in some_sequence]
# or modify in place if needed... see enumerate
for item in some_sequence:
do_something_with(item)

This should run as fast as possible in the common case, and slow down only
in the rare condition.

Another solution would be:

if some_rare_condition:
for item in some_sequence:
item = transform(item)
do_something_with(item)
else:
for item in some_sequence:
do_something_with(item)

This is probably going to be the fastest of all, but has the disadvantage
that you are writing the same code twice.




-- 
Steven.

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