Re: [BangPypers] Truth Tests (bool)

2012-01-11 Thread Saager Mhatre
https://gist.github.com/1327614#file_truth.py

I hacked together this little script to cover (hopefully) all the cases for
my reference.

- d
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] [X-POST] Selenium Simple Test

2012-01-11 Thread Senthil Kumaran
On Wed, Jan 11, 2012 at 09:16:04AM +0530, Venkatraman S wrote:
 This does look super-simple! Linky :
 http://www.youtube.com/watch?v=qGPostUOAEI


Looks pretty simple. But the XPATH based expression language exposed
via selenium is not hard either. That ties with the browser well and
most often when we have to determine the correct DOM for the elements
in the path, anything browser based becomes more useful.

-- 
Senthil
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


[BangPypers] Is there any relation between web2py and webpy

2012-01-11 Thread Senthil Kumaran
Other than the fact that they are both web frameworks.

Given their levenshtein distance being 1, I am really curious if there
any social or historical relationship between then. 

-- 
Senthil
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Truth Tests (bool)

2012-01-11 Thread Senthil Kumaran
On Wed, Jan 11, 2012 at 09:49:58AM +0530, Noufal Ibrahim wrote:

  It is not clear what you want from your description.  To check if a
  list is empty, see if len( list ) is zero.
 
 You don't want to do that. Your list might be a generator (unless you
 check for type which is a bad idea anyway) and lening that will
 consume it which might be a potentially expensive operation. 

While the explaination on __nonzero__ is useful out of this context,
how can list be a generator? I am assuming that none are confusing the
terminologies.

In practical cases for testing boolean in lists, just use the list as
the test. Empty list is false.

-- 
Senthil

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Is there any relation between web2py and webpy

2012-01-11 Thread Anand Chitipothu
2012/1/11 Senthil Kumaran sent...@uthcode.com

 Other than the fact that they are both web frameworks.

 Given their levenshtein distance being 1, I am really curious if there
 any social or historical relationship between then.


No.

Anand
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers



Re: [BangPypers] Is there any relation between web2py and webpy

2012-01-11 Thread Senthil Kumaran
On Wed, Jan 11, 2012 at 06:34:14PM +0530, Anand Chitipothu wrote:
 
 No.

Ok. It's good coincidence.

-- 
Senthil
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Is there any relation between web2py and webpy

2012-01-11 Thread Gora Mohanty
On Wed, Jan 11, 2012 at 6:03 PM, Senthil Kumaran sent...@uthcode.com wrote:
 Other than the fact that they are both web frameworks.

 Given their levenshtein distance being 1,
[...]

Bah!

So is the distance between Gora and Gori (apply smileys
as needed).

Regards,
Gora
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Truth Tests (bool)

2012-01-11 Thread Noufal Ibrahim
Senthil Kumaran sent...@uthcode.com writes:

 On Wed, Jan 11, 2012 at 09:49:58AM +0530, Noufal Ibrahim wrote:

  It is not clear what you want from your description.  To check if a
  list is empty, see if len( list ) is zero.
 
 You don't want to do that. Your list might be a generator (unless you
 check for type which is a bad idea anyway) and lening that will
 consume it which might be a potentially expensive operation. 

 While the explaination on __nonzero__ is useful out of this context,
 how can list be a generator? I am assuming that none are confusing the
 terminologies.

A list can't be a generator but if you write a function to receive an
iterable x and then do a len(x) to check it it's True or False, it will
work fine for lists but passing a generator this function might have
unpredictable results. That's why I'm cautioning against using `len` to
check for whether an object is empty or not. 

 In practical cases for testing boolean in lists, just use the list as
 the test. Empty list is false.

Agreed. This is the right way to do it rather than using len.

-- 
~noufal
http://nibrahim.net.in

Why don't you pair `em up in threes? -Yogi Berra
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Is there any relation between web2py and webpy

2012-01-11 Thread Senthil Kumaran
On Wed, Jan 11, 2012 at 08:43:07PM +0530, Gora Mohanty wrote:
 
 So is the distance between Gora and Gori (apply smileys
 as needed).

Wow! And I believe that would make a dynamic programming pair.
(ditto)


-- 
Senthil
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] [X-POST] Selenium Simple Test

2012-01-11 Thread Baiju M
On Wed, Jan 11, 2012 at 9:16 AM, Venkatraman S venka...@gmail.com wrote:
 This does look super-simple! Linky :
 http://www.youtube.com/watch?v=qGPostUOAEI

Selenium Webdriver Python API is easy to understand.  The API doesn't
force to do in one style,
because it's not a framework.  It gives freedom to choose your testing
tools like nose, py.test etc.

BTW, I have written some docs for using the default API;
http://readthedocs.org/docs/selenium-python/en/latest/

Regards,
Baiju M
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers