Re: Favorite flavor of Linux? (for python or anything else)

2005-12-05 Thread Mohammad Jeffry
another vote for Gentoo. It's my production/main OS now.
On 4 Dec 2005 23:21:55 -0800, malv [EMAIL PROTECTED] wrote:
In theory, this would do. I have tried this several times in the pastand found it very impractical to have to live with two Python versionson the same system, given that Python, like also Perl, is used by somany components. I may have done many things wrong but experience
taught me to better simplify things and live with one python versiononly. It mainly depends on the (huge amount of) time you can afford tostraighten out avoidable problems.I must say that since python 
2.3 and 2.4 I never tried dual setupsanymore. Indeed, Debian would be my preferred distro if it weren't forpython 2.3.malv--http://mail.python.org/mailman/listinfo/python-list
-- And whoever does an atom's weight of evil will see it.
-- 
http://mail.python.org/mailman/listinfo/python-list

what's wrong with lambda x : print x/60,x%60

2005-12-04 Thread Mohammad Jeffry
Dear All,

Can't a lambda uses the input parameter more then once in the lambda body? 
eg: 
lambda x : print x/60,x%60

I tried with def and it works but got syntax error with lambda. Below is an interactive sample:

[EMAIL PROTECTED] ~ $ python
Python 2.4.2 (#1, Nov 18 2005, 19:32:15) 
[GCC 3.3.6 (Gentoo 3.3.6, ssp-3.3.6-1.0, pie-8.7.8)] on linux2
Type help, copyright, credits or license for more information.
 def func_hrs(x): print x/60,x%60
... 
 func_hrs(400)
6 40
 lambda_hrs = lambda x : print x/60,x%60
 File stdin, line 1
 lambda_hrs = lambda x : print x/60,x%60

^
SyntaxError: invalid syntax
 

My main concern is how can I do this in lambda?

-- And whoever does an atom's weight of evil will see it.
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: what's wrong with lambda x : print x/60,x%60

2005-12-04 Thread Mohammad Jeffry
without the print also gives me error:-

 lambda_hrs = lambda x : x/60,x%60
Traceback (most recent call last):
 File stdin, line 1, in ?
NameError: name 'x' is not defined

On 12/5/05, Mohammad Jeffry [EMAIL PROTECTED] wrote:
Dear All,

Can't a lambda uses the input parameter more then once in the lambda body? 
eg: 
lambda x : print x/60,x%60

I tried with def and it works but got syntax error with lambda. Below is an interactive sample:

[EMAIL PROTECTED] ~ $ python
Python 2.4.2 (#1, Nov 18 2005, 19:32:15) 
[GCC 3.3.6 (Gentoo 3.3.6, ssp-3.3.6-1.0, pie-8.7.8)] on linux2
Type help, copyright, credits or license for more information.
 def func_hrs(x): print x/60,x%60
... 
 func_hrs(400)
6 40
 lambda_hrs = lambda x : print x/60,x%60
 File stdin, line 1
 lambda_hrs = lambda x : print x/60,x%60
^
SyntaxError: invalid syntax
 

My main concern is how can I do this in lambda?

-- And whoever does an atom's weight of evil will see it.

-- And whoever does an atom's weight of evil will see it.
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: python speed

2005-11-30 Thread Mohammad Jeffry
I did a small test some time ago and I think python is faster then java:
http://linuxlah.blogspot.com/2005/11/swap-speed-for-python-c-c-and-java.html


On 11/30/05, Krystian [EMAIL PROTECTED] wrote:
Hiare there any future perspectives for Python to be as fast as java? iwould like to use Python as a language for writing games.best regardskrystian--
http://mail.python.org/mailman/listinfo/python-list-- And whoever does an atom's weight of evil will see it.
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Hot to split string literals that will across two or more lines ?

2005-11-23 Thread Mohammad Jeffry
I tried to use this method in my code like this:-
-
#!/usr/bin/python


def print_sql():
 sql = '''aaa
 bbb'''.replace(\n,)
 print sql

print_sql()

-

the ouput of this is spacetab..

I can always do this :-
-
#!/usr/bin/python




def print_sql():

 sql = '''aaa
bbb'''.replace(\n,)

 print sql



print_sql()



-
but it looks ugly

On 11/22/05, Mohammad Jeffry [EMAIL PROTECTED] wrote:
On 11/22/05, Paul McGuire [EMAIL PROTECTED] wrote:
Or for a large literal string:lots of text hundreds of characters long
more text on another line but we really don't want any line breaksin our final stringso we replace newlines in this multiline stringwith an empty string thus.replace('\n','')
-- Paul


I love your method. The only drawbacks for this method is I can't tell
whether there is blank space at the end of each lines. For EG: the
above string might be

lots of text hundreds of characters longmore text on another.
^
or

lots of text hundreds of characters long more text on another.

^ 


-- And whoever does an atom's weight of evil will see it.

-- And whoever does an atom's weight of evil will see it.
-- 
http://mail.python.org/mailman/listinfo/python-list

Would cgi be the only option if my webhosting doesn't have psp, zpt, cheetah or mod_python?

2005-11-23 Thread Mohammad Jeffry
If an webhosting doen't have these feature. Can I install them ? Any
experiences on this? I'm assuming that asking the webhosting system
admin. to install these framworks in not an option for now.-- And whoever does an atom's weight of evil will see it.
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Hot to split string literals that will across two or more lines ?

2005-11-21 Thread Mohammad Jeffry
On 11/22/05, Paul McGuire [EMAIL PROTECTED] wrote:
Or for a large literal string:lots of text hundreds of characters long
more text on another line but we really don't want any line breaksin our final stringso we replace newlines in this multiline stringwith an empty string thus.replace('\n','')-- Paul


I love your method. The only drawbacks for this method is I can't tell
whether there is blank space at the end of each lines. For EG: the
above string might be

lots of text hundreds of characters longmore text on another.

^
or

lots of text hundreds of characters long more text on another.

^ 


-- And whoever does an atom's weight of evil will see it.
-- 
http://mail.python.org/mailman/listinfo/python-list