Re: python module in webmin

2005-01-27 Thread moma
sam wrote:
Hi,
Had anyone written any python module for webmin?
Since  webmin is written in perl, but I want to write a python 
app/module used by webmin. If you know the detail of writing a python 
module for use in perl webmin, please drop me some guideline.

Perhaps It is better off to find/write a python version of webmin first.
Thanks
Sam.
Some tips.
0)
 Webmin API-spesification  (search for "Python" word)
 http://www.webmin.com/modules.html
1)
Read:
 http://www.cendio.se/~peter/python-webmin/
 Read README and Webmin.py.
 It says that 25% of API is converted to Python.
 It's normal CGI scripting and HTML. So you can easily
 write a real Webmin-module in Python.
 Maybe you can help to make Webmin.py more complete :)?
2)
Search for "Python" here
 http://webmin.thirdpartymodules.com/?page=Search
 Find any modules written in Python?
// moma
   http://www.futuredesktop.org/OpenOffice.html
   http://www.futuredesktop.org/hpc_linux.html





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


Re: Where can I find sample "beginner" programs to study?

2005-01-28 Thread moma
Todd_Calhoun wrote:
I'm trying to learn Python (and programming), and I'm wondering if there are 
any places where I can find small, simple programs to study.

Thanks. 

Hello,
http://www.python.org  (docs -> tutorial)
http://www.python.org/doc/ !
http://www.diveintopython.org
http://www.byteofpython.info
Eggs are here. Bring some bacon.
http://www.python-eggs.org/links.html

Cross platform GUI-programs:
http://www.wxPython.org
Widgets documentation: http://www.wxPython.org

IDEs (programmers Python editors, if you want one):
Eric
http://www.die-offenbachs.de/detlev/eric3.html
Dr.Python
http://drpython.sourceforge.net/
?
// moma
   http://www.futuredesktop.org/OpenOffice.html
   http://www.futuredesktop.org/hpc_linux.html
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python versus Perl ?

2005-02-06 Thread moma
Reinhold Birkenfeld wrote:
[EMAIL PROTECTED] wrote:
I've read some posts on Perl versus Python and studied a bit of my
Python book.
I'm a software engineer, familiar with C++ objected oriented
development, but have been using Perl because it is great for pattern
matching, text processing, and automated testing. Our company is really
fixated on risk managnemt and the only way I can do enough testing
without working overtime (which some people have ended up doing) is by
automating my testing. That's what got me started on Perl.
I've read that many people prefer Python and that it is better than
Perl. However, I want to ask a few other questions.

"Better than Perl" is a very general statement. In my personal opinion,
this is true for every project being larger than one file of ~200 LOC.

1. Perl seems to have alot of packaged utilities available through
CPAN, the comprehensive perl network. These can aid in building
parsers, web development, perl DBI is heavily used. This seems to be a
very important benifit. I'm not sure that Python is as extenive at all
in that regard ?

There are the Python Package Index (PyPI), the Vaults of Parnassus, and
when you don't find a needed package there, just come and ask here;
almost always a decent solution is found.
A thing similar to CPAN is being worked on by various people, though I
don't know when it will become mature.

Perl also has excellent pattern matching compared to
sed, not sure about how Python measures up,
but this seems to make perl ideally suited to text processing.

Python has regular expressions much like Perl. The only difference is
that Perl carries syntactic support for them, while in Python regular
expressions are ordinary objects with methods etc.

2. Python is apparantly better at object oriented. Perl has some kind
of name spacing, I have used that in a limited way. Does Perl use a
cheap and less than optimal Object oriented approach ?
That was what someone at work said, he advocates Python.
Is it likely that Perl will improve it's object oriented features
in the next few years ?

There is the Perl 6 movement, but when you read some of the docs at
http://dev.perl.org, you will come to the conclusion that
- Perl 6 lies at least 3-5 years in the future and
- it will be a huge mess. Someone here once said "Perl 6 is the ultimate
failure of Perl's philosophy". There may be split views about this...

3. Perl is installed on our system and alot of other systems.
You don't have to make sys admins go out of there way to make it
available. It's usualy allready there.

Same goes with Python; it is installed per default on most modern
Unices. Windows is a completely different chapter, however, Perl isn't
more widespread there.

I also did a search of job
postings on a popular website. 108 jobs where listed that require
knowledge of Perl, only 17 listed required Python. Becomeing more
familiar with Perl might then be usefull for ones resume ?

It doesn't harm, of course. Recent statistics about programmers'
salaries indicate, however, that Python ranks top (I somehow lost the URL).

If Python is better than Perl, I'm curious how really significant
those advantages are ?

Try to decide yourself. The Python tutorial and website are your friends.
Reinhold

I like Ruby because it inherits so many (best) features from Python and 
Perl ;)  Someday all these languages will compile to a common 
intermediate representation (ref. YAML: http://yaml.kwiki.org  || 
http://yaml.org )

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/79533
http://www.cs.washington.edu/homes/kd/courses/pythonruby.pdf
http://www.ntecs.de/old-hp/s-direktnet/rb/download_ruby.html
http://www.ruby-lang.org/en/
// moma
--
http://mail.python.org/mailman/listinfo/python-list


Re: feature suggestion

2004-12-24 Thread moma
Do not miss the discussion topic/thread:
  "Optional Static Typing"  (from 12/23/2004)
The referral article is very interesting, even for a newbie.
Introduction of (optional) types will "legitimate" the Python language 
even more, while it keeps the fast scripting nature unspoilt.


flexibal wrote:
hi there.
i didnt know if i should post it at python-dev or here, so i'll start
here. i'd like to suggest a new language feature for python that allows
you to explicitly declare a variable.
as we all know, just doing
v = 5
declares a new variable named 'v'... but we are people, and we do make
typos... and it's very disturbing to find your program crashing after
two weeks of operation, over a NameError... because a certain branch in
your code, that was previously never taken, had finally been taken.
i've written several large-scale projects in python by now... i find it
excellent for automated testing and other infrastructural needs... but
mistyped variable-, function-, class-, and module- names been a PITA
for me ever since i've started to use python.
python is a scripting language after all, and should preserve its
scripting nature. but adding features that help you verify your python
code should also be included.
BASIC has the "OPTION EXPLICIT" feature that forces you to explicitly
declare all variables, and i see no reason why python should have a
similar mechanism.
either you start python with some commandline switch, or with a
language construct, you should be able to turn on explicit variable
declaration.
first proposal:
===
import sys
sys.is_strict = True
decl("x")
x = 5
y = 6
StrictError: name 'y' not explicitly declared
the syntactic format can be debated, of course. here 'decl' is used as
a built-in function that adds the name 'x' to a list of
"explicitly-declared-variables", and when setattr is called, it makes
sure the variable's name is within this list.
this is also fit for dynamic code, but suffers from still having to
execute the code before it is enforced. problems will remain in things
like:
decl("x")
x = 5
if x == 6:
y = 7
second proposal:

syntactic verification, at parsing time. for example:
my-prog.py:
-
##decl x
##decl y, z
x = 5
y = 6
z = 8
a = 6
when this program will be ran with the -strict option, like 6th line
will generate a SyntaxError: name 'a' not explicitly declared.
this strategy can verify all sorts of dead-branches, as demonstrated
above, but is not fit for dynamic code.
---
personally, i like the second proposal more, because it adds no new
language constructs, only a new commandline switch and meta-comments,
and is totally backwards compatible.


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


Re: Optional Static Typing

2004-12-25 Thread moma
[EMAIL PROTECTED] wrote:
Adding Optional Static Typing to Python looks like a quite complex
thing, but useful too:
http://www.artima.com/weblogs/viewpost.jsp?thread=85551
I have just a couple of notes:
Boo (http://boo.codehaus.org/) is a different language, but I like its
"as" instead of ":" and "->", to have:
def min(a as iterable(T)) as T:
Instead of:
def min(a: iterable(T)) -> T:
I want to introduce a shorter syntax form:
Declare variables
a'int
a'int = 13  
s'string = "Santana"
d'float
def min(a'int,  b'int)'int:
   c'int# Declare a local variable c of type int
   c = a
   ...
*
The (template) notation is very useful.
def min(a'T, b'T)'T:
c'T
c = a

f'float = min(1.2, 2.2)
i'int = min(9, f)  ## of course: comiler adds int(f) type conversion
*
But these 2 should be syntactically wrong. The type of T is not obvious.
def max(a'int, b'int)'T:
   
def max(a, b)'T:
   
*
The big question is how to handle combound data types (container 
objects) ?  lists, tuples, maps...

Can a list contain various data types?
>>> h=['abc', 13, (9,8)]
# Declare h as list of ints
h'int[] = [1, 8, 991]
# These declarations produce syntax errors
h'int = [1, 8, 991]
error: h is a scalar not container
h'int[] = ['abc', 13, (9,8)]
 ^^
error: expecting int value
*
Tuples
A general sequence
t = 1, 3, 4,
A tuple of ints
t'int() = 1, 3, 4,
What about this?
u'int() = t, 6, 7,
Yes, it's OK.  because the basic_scalar_values are ALL ints.
>>>print u
((1,3,4), 6,7)
Maps
.
*
I think the compiler should allow typeless containers even you compile 
with --strict option.  Apply --strict (strictly) to scalar types only.

*
class A:
  pass
def func1(h'A)
 # Expects (instance) A or any subclass of A
  
*
// moma
   http://www.futuredesktop.org/OpenOffice.html

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


Re: Python for a 10-14 years old?

2005-03-24 Thread moma
> Well i don't know of any tutorials but i thought of a cool little
> "assignment" that might interest someone of that age assuming english
> is her first language.
Good idea.
1) Have u noticed that whn yu raed that srcamled text luodly, it sounds 
like spoken by a deaf person. (because severe loss of hearing makes it 
hard to learn correct pronunciation).

2) Is this the same fennomena like in the (ancient Hebrew language?) 
that in written form uses consonant letters only.  The reader then fills 
in the missing vowels (aeioyäö). Like: kck th bll nt wall nd ctch t bck.

hmm, maybe not!
3) Anyway, gnna love that srcmbled format simply because rerrors do not 
appear, show up ;-). (having English as a foreign language)


// moma
   http://www.futuredesktop.org/AsteriskPBX.html  <-
   http://www.futuredesktop.org/hpc_linux.html
   Why run one PC obi  when you can hvae a cluster ?

MyHaz wrote:
Its a neat little trick with english and the way
that we proccess letter combinations (or should i say permuations). But
a program that turned proper english into this, might be neat.
"""
Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn't mttaer in
waht oredr the ltteers in a wrod are, the olny iprmoetnt tihng is taht
the frist and lsat ltteer be at the rghit pclae. The rset can be a
toatl mses and you can sitll raed it wouthit porbelm. Tihs is bcuseae
the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a
wlohe.
"""
the algo whold be something like
openfile
for word in file
   tmp=word[0]
   tmp+=permut(tmp[1:-2])
   tmp+=word[-1]
   print word
She could enjoy sending letters like this, neat secrete codes for a
nine year old ;)
Linky http://www.mrc-cbu.cam.ac.uk/personal/matt.davis/Cmabrigde/
G'Luck
- Haz
P.S. I just had my friend read it and his native tongue is chinese, so
might work for other languages too.
--
http://mail.python.org/mailman/listinfo/python-list