Re: Pass and return

2012-12-21 Thread Steven D'Aprano
On Thu, 20 Dec 2012 21:23:58 -0800, iMath wrote: > Pass and return > Are these two functions the same ? They are neither functions, nor are they the same. Check if they are functions: - can you pass them arguments? - can you assign their result to a target? No. py> pass(23) File "", line 1

Re: Brython - Python in the browser

2012-12-21 Thread Rouslan Korneychuk
On 12/20/2012 04:37 AM, Pierre Quentel wrote: To create an element, for instance an HTML anchor : doc <= A('Python',href="http://www.python.org";) To me, that is a awful choice and I urge you to change it. '<=' is not just an operator, it is a comparison operator. It normally return False or

Python USB control on Windows 7?

2012-12-21 Thread Duncan Booth
In this year's Christmas Raffle at work I won a 'party-in-a-box' including USB fairy lights. They sit boringly on all the time, so does anyone know if I can toggle the power easily from a script? My work PC is running Win7. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pass and return

2012-12-21 Thread Duncan Booth
Mitya Sirenef wrote: > On 12/21/2012 12:23 AM, iMath wrote: >> Pass and return >> Are these two functions the same ? >> >> def test(): >> return >> >> def test(): >> pass > > > From the point of style, of course, the latter is > much better because that's the idiomatic way > to de

Re: Brython - Python in the browser

2012-12-21 Thread Terry Reedy
On 12/21/2012 3:31 AM, Rouslan Korneychuk wrote: Although I'm not really in favor of using an operator for this sort of thing either way, I can't help but notice the discussion seems to be limited to Python's operators. If you're implementing Python yourself, can't you define a new operator that

Oracle E-Business Suite Techno Functional Consultant Required for UAE

2012-12-21 Thread VAM SYSTEMS
VAM SYSTEMS is a Business Consulting, IT Solutions and Services company with operations in UAE, Qatar, Bahrain, USA, Australia, Singapore & India. VAM SYSTEMS is currently looking for Oracle E-Business Suite Techno Functional Consultant for our UAE operations with the following skill set and terms

Re: Brython - Python in the browser

2012-12-21 Thread Stefan Behnel
Pierre Quentel, 20.12.2012 10:42: > Le jeudi 20 décembre 2012 01:54:44 UTC+1, Ian a écrit : >> On Wed, Dec 19, 2012 at 5:07 PM, Terry Reedy wrote: To create an element, for instance an HTML anchor : doc <= A('Python',href="http://www.python.org";) >>> >>> To me, that is a awful choice and

Re: compile python 3.3 with bz2 support on RedHat 5.5

2012-12-21 Thread Ramchandra Apte
On Friday, 21 December 2012 12:05:57 UTC+5:30, Isml wrote: > hi, everyone: >     I want to compile python 3.3 with bz2 support on RedHat 5.5 but fail to > do that. Here is how I do it: >     1、download bzip2 and compile it(make、make -f Makefile_libbz2_so、make > install) >     2、chang to python 3

Re: how to detect the encoding used for a specific text data ?

2012-12-21 Thread Oscar Benjamin
On 20 December 2012 11:57, iMath wrote: > how to detect the encoding used for a specific text data ? Normally encoding is given in some way by the context of the data. Otherwise no general solution is possible. On a related note: how to answer question with no context on mailing list? -- http:

Re: Brython - Python in the browser

2012-12-21 Thread Pierre Quentel
> If that's your intention, then instead of coming up with something totally > new, unpythonic and ugly, why not take the normal Python route and > implement a subset of the ElementTree API? > > Stefan Because the tree implementation in ElementTree or other tree modules in Python require a lot of

Re: Brython - Python in the browser

2012-12-21 Thread Chris Angelico
On Fri, Dec 21, 2012 at 11:38 PM, Pierre Quentel wrote: > With the tree syntax proposed in Brython it would just be > > doc <= DIV('hello '+B('world')) > > If "pythonic" means concise and readable, which one is more pythonic ? Pythonic also means: If the implementation is hard to explain, it's a

Re: Brython - Python in the browser

2012-12-21 Thread Duncan Booth
Pierre Quentel wrote: >> If that's your intention, then instead of coming up with something >> totally new, unpythonic and ugly, why not take the normal Python >> route and implement a subset of the ElementTree API? >> >> Stefan > Because the tree implementation in ElementTree or other tree modu

Re: Brython - Python in the browser

2012-12-21 Thread Stefan Behnel
Duncan Booth, 21.12.2012 14:14: > Pierre Quentel wrote: >>> If that's your intention, then instead of coming up with something >>> totally new, unpythonic and ugly, why not take the normal Python >>> route and implement a subset of the ElementTree API? >> >> Because the tree implementation in Eleme

Re: redirect standard output problem

2012-12-21 Thread Hans Mulder
On 21/12/12 06:23:18, iMath wrote: > redirect standard output problem > > why the result only print A but leave out 888 ? > > import sys > class RedirectStdoutTo: > > def __init__(self, out_new): > self.out_new = out_new > def __enter__(self): > sys.stdout = self.out_new

Re: compile python 3.3 with bz2 support on RedHat 5.5

2012-12-21 Thread Chris Angelico
On Fri, Dec 21, 2012 at 5:35 PM, Isml <76069...@qq.com> wrote: > By the way, RedHat 5.5 has a built-in python 2.4.3. Would it be a problem? You may want to consider using 'make altinstall' rather than 'make install'. That way, you don't stomp all over the system Python (so system scripts that expe

Re: how to detect the encoding used for a specific text data ?

2012-12-21 Thread Dave Angel
On 12/21/2012 07:38 AM, Oscar Benjamin wrote: > > On a related note: how to answer question with no context on mailing > list? Depends on how you're reading/responding. I'll assume you're using an email client like Thunderbird, and that you do NOT subscribe in digest form. Most general way is

Re: redirect standard output problem

2012-12-21 Thread Dave Angel
On 12/21/2012 12:23 AM, iMath wrote: > redirect standard output problem > > why the result only print A but leave out 888 ? > > import sys > class RedirectStdoutTo: > > def __init__(self, out_new): > self.out_new = out_new > def __enter__(self): > sys.stdout = self.out_new >

Re: Build and runtime dependencies

2012-12-21 Thread Chen Qi
? 2012?12?21? 06:11, Jack Silver ??: I have two Linux From Scratch machine. On the first one (the server), I want to build install python 3.3.0 in a shared filesystem and access it from the second one (the client). These machines are fairly minimal in term of the number of software installed.

HTML - WEB FORM running PYTHON SCRIPT

2012-12-21 Thread Dimitrios Xenakis
Hi there, i would like to ask.. i need to create an html webpage and bring that live on the internet via my host service, and i would also like a conversion calculator being showed on this website. Concersion tool such as Cels. to Kelvin. I have the calculation formula and i would like to script

Re: HTML - WEB FORM running PYTHON SCRIPT

2012-12-21 Thread Chris Angelico
On Sat, Dec 22, 2012 at 2:00 AM, Dimitrios Xenakis wrote: > Hi there, i would like to ask.. i need to create an html webpage and bring > that live on the internet via my host service, and i would also like a > conversion calculator being showed on this website. Concersion tool such as > Cels. t

Re: Brython - Python in the browser

2012-12-21 Thread Pierre Quentel
> Pythonic also means: > If the implementation is hard to explain, it's a bad idea. > What, exactly, does the sum of a string and a bolded string produce? Can you > explain that easily and clearly? Yes : a+b returns the string a+str(b) It is exactly what you get in CPython with >>> class B: ..

Re: Brython - Python in the browser

2012-12-21 Thread Chris Angelico
On Sat, Dec 22, 2012 at 2:36 AM, Pierre Quentel wrote: >> doc.add(Tag('DIV').add('hello ').add(Tag('B').add('world'))) >> > No, with this syntax, the result of Tag('B').add('world') is below 'hello' in > the tree structure, not at the same level (just below Tag('DIV')) as it > should be No; loo

Re: Strange effect with import

2012-12-21 Thread Jens Thoms Toerring
Hans Mulder wrote: > Maybe something like this: > class ReqHandler(SocketServer.BaseRequestHandler): > def __init__(self, request, client_address, server, ham, spam) > super(SocketServer, self).__init__( > self, request, client_address, server) > se

Second try: non-blocking subprocess pipe and Tkinter in 2.7

2012-12-21 Thread Kevin Walzer
Yesterday I posted a question about keeping a Tkinter GUI during a long-running process, i.e. reading data from a pipe via the subprocess module. I think that question did not quite get at the heart of the issue because it assumed that Python, like Tcl which underlies Tkinter, supports non-bloc

Re: Build and runtime dependencies

2012-12-21 Thread Chris Angelico
On Fri, Dec 21, 2012 at 9:11 AM, Jack Silver wrote: > On the first one (the server), I want to build install python 3.3.0 in a > shared filesystem and access it from the second one (the client). Correct me if I'm wrong, but my understanding of your description is this: System #1 ("server"): Full

Re: Brython - Python in the browser

2012-12-21 Thread Pierre Quentel
> <= is a comparison expression operator, which is completely different. > It is just wrong for this usage. I am 99.9% sure you will come to regret > it eventually. Better to make the change now than in Brython2 or Brython3. I am 99.99% sure of the contrary, having used this syntax for more than

Re: Second try: non-blocking subprocess pipe and Tkinter in 2.7

2012-12-21 Thread Peter Otten
Kevin Walzer wrote: > Yesterday I posted a question about keeping a Tkinter GUI during a > long-running process, i.e. reading data from a pipe via the subprocess > module. I think that question did not quite get at the heart of the > issue because it assumed that Python, like Tcl which underlies T

Re: Brython - Python in the browser

2012-12-21 Thread Pierre Quentel
> Hmm. So when that gets added into a DIV, it has to get parsed for > tags? How does this work? This seems very odd. I would have expected > it to remain as DOM objects. In DIV(child) : - if child is a string, integer or float, a text node is added (addChild) to the DIV element, with the string

Re: Brython - Python in the browser

2012-12-21 Thread Stefan Behnel
Pierre Quentel, 21.12.2012 17:16: > So when you see a line like > > doc <= DIV('hello') > > it should be obvious that you are not *comparing* doc and DIV('hello'), > because if it was the case, the line would do nothing Yep, that's one of the main concerns - it looks like useless code, which is

Re: Pass and return

2012-12-21 Thread Mitya Sirenef
On 12/21/2012 03:52 AM, Duncan Booth wrote: Mitya Sirenef wrote: On 12/21/2012 12:23 AM, iMath wrote: Pass and return Are these two functions the same ? def test(): return def test(): pass From the point of style, of course, the latter is much better because that's the i

Re: help with making my code more efficient

2012-12-21 Thread larry.mart...@gmail.com
On Thursday, December 20, 2012 8:31:18 PM UTC-7, Dave Angel wrote: > On 12/20/2012 08:46 PM, larry.mart...@gmail.com wrote: > > > On Thursday, December 20, 2012 6:17:04 PM UTC-7, Dave Angel wrote: > > >> > > > Of course it's a fragment - it's part of a large program and I was just > > showing

Re: Brython - Python in the browser

2012-12-21 Thread Ian Kelly
On Fri, Dec 21, 2012 at 9:16 AM, Pierre Quentel wrote: >> <= is a comparison expression operator, which is completely different. >> It is just wrong for this usage. I am 99.9% sure you will come to regret >> it eventually. Better to make the change now than in Brython2 or Brython3. > > I am 99.99%

RE: Question regarding mod_python and a script for web.

2012-12-21 Thread John Pennington
Hi Ion thanks a bunch, for responding. The problem we seem to be running into is that When we change the forms to a post instead of a get I cannot pick up the post values using cgi: page_info = cgi.FieldStorage() is this a limitation of mod_python? Thanks. john Date: Thu, 20 Dec 2012 17:59:4

Re: help with making my code more efficient

2012-12-21 Thread larry.mart...@gmail.com
On Friday, December 21, 2012 10:57:19 AM UTC-7, larry@gmail.com wrote: > On Thursday, December 20, 2012 8:31:18 PM UTC-7, Dave Angel wrote: > > On 12/20/2012 08:46 PM, larry.mart...@gmail.com wrote: > > > On Thursday, December 20, 2012 6:17:04 PM UTC-7, Dave Angel wrote: > > >> > > > Of co

Re: Brython - Python in the browser

2012-12-21 Thread Pierre Quentel
> The interpreter, though, will be more than happy to treat that as a > comparison if the LHS is not the type that you think it is. For > example, maybe you've added it to a string at some point, and now it's > a string instead of an element. I guess that since doc is made a > keyword, that proba

Re: Brython - Python in the browser

2012-12-21 Thread Ian Kelly
On Fri, Dec 21, 2012 at 1:59 PM, Pierre Quentel wrote: >> By the way, what is Brython actually doing when you append a child to >> the document itself like that? Usually I would expect a div to be >> appended to the body or to another div. The above looks like it would >> attach the new div as a

Scrapy/XPath help

2012-12-21 Thread Always Learning
Hello all. I'm new to Python, but have been playing around with it for a few weeks now, following tutorials, etc. I've spun off on my own and am trying to do some basic web scraping. I've used Firebug/View XPath in Firefox for some help with the XPaths, however, I still am receiving errors when

Re: Scrapy/XPath help

2012-12-21 Thread Grant Rettke
You might have better luck if you share the python make, version, os, error message, and some unit tests demonstrating what you expect. On Fri, Dec 21, 2012 at 3:21 PM, Always Learning wrote: > Hello all. I'm new to Python, but have been playing around with it for a few > weeks now, following tu

Re: Scrapy/XPath help

2012-12-21 Thread Always Learning
Sorry about that. I'm using Python 2.7.3, 32 bit one Windows 7. The errors I get are >>File >>"C:\python27\lib\site-packages\scrapy-0.16.3-py2.7.egg\scrapy\selector\lxmlsel.py", >> line 47, in select >>raise ValueError("Invalid XPath: %s" % xpath) >>exceptions.ValueError: Invalid XPath: /span[@c

Re: Brython - Python in the browser

2012-12-21 Thread Chris Angelico
On Sat, Dec 22, 2012 at 3:36 AM, Pierre Quentel wrote: > >> Hmm. So when that gets added into a DIV, it has to get parsed for >> tags? How does this work? This seems very odd. I would have expected >> it to remain as DOM objects. > > In DIV(child) : > - if child is a string, integer or float, a te

Re: Brython - Python in the browser

2012-12-21 Thread Ian Kelly
On Fri, Dec 21, 2012 at 3:52 PM, Chris Angelico wrote: > On Sat, Dec 22, 2012 at 3:36 AM, Pierre Quentel > wrote: >> >>> Hmm. So when that gets added into a DIV, it has to get parsed for >>> tags? How does this work? This seems very odd. I would have expected >>> it to remain as DOM objects. >> >

Re: Brython - Python in the browser

2012-12-21 Thread Amirouche Boubekki
Héllo, > > doc <= 'blah blah x I will surely backlog latter or some crytologist from the futur will do and he will surely agree about the fact something strange happened around december 2012. Sorry for that, that's me trying to be funny. Last time I checked DOM manipulation is not the primary w

Re: Brython - Python in the browser

2012-12-21 Thread Ian Kelly
On Fri, Dec 21, 2012 at 4:45 PM, Ian Kelly wrote: > In Brython, the str builtin does not return strings? Oh, and repr is just a synonym of str, which makes it useless. -- http://mail.python.org/mailman/listinfo/python-list

Re: Brython - Python in the browser

2012-12-21 Thread Ian Kelly
On Fri, Dec 21, 2012 at 4:45 PM, Ian Kelly wrote: > In my playing around with it just now, the addition doesn't seem to > actually return a string. >From the code, it appears that adding two nodes together *actually* returns a $AbstractTag object, which seems to be just a container for a list of

Re: Pigeon Computer 0.1 Initial (BETA) release

2012-12-21 Thread Amirouche Boubekki
Héllo, 2012/12/22 Simon Forman > Pigeon Computer 0.1 Initial (BETA) release > > Summary > > > The Pigeon Computer is a simple but sophisticated system for learning > and exploring the fundamentals of computers and programming. > > It is written to support a course or class (as yet

Re: Brython - Python in the browser

2012-12-21 Thread Chris Angelico
On Sat, Dec 22, 2012 at 10:57 AM, Ian Kelly wrote: > From the code, it appears that adding two nodes together *actually* > returns a $AbstractTag object, which seems to be just a container for > a list of child nodes with no parent, that automagically gets removed > from the hierarchy when appende

Re: Brython - Python in the browser

2012-12-21 Thread Chris Angelico
On Sat, Dec 22, 2012 at 10:50 AM, Amirouche Boubekki wrote: > Last time I checked DOM > manipulation is not the primary way for js devs to do DOM manipulation > anymore, or is it ? Javascript template engines do DOM manipulation but this > is almost invisible for the user... Not sure how most of

Re: Brython - Python in the browser

2012-12-21 Thread Steven D'Aprano
On Fri, 21 Dec 2012 12:25:01 +0100, Stefan Behnel wrote: > If that's your intention, then instead of coming up with something > totally new, unpythonic and ugly, why not take the normal Python route > and implement a subset of the ElementTree API? Yo mean something old, unpythonic and ugly? :-P

Re: Second try: non-blocking subprocess pipe and Tkinter in 2.7

2012-12-21 Thread Terry Reedy
On 12/21/2012 10:52 AM, Kevin Walzer wrote: Yesterday I posted a question about keeping a Tkinter GUI during a long-running process, i.e. reading data from a pipe via the subprocess module. I think that question did not quite get at the heart of the issue because it assumed that Python, like Tcl

Re: Scrapy/XPath help

2012-12-21 Thread Dave Angel
On 12/21/2012 04:58 PM, Always Learning wrote: > Sorry about that. I'm using Python 2.7.3, 32 bit one Windows 7. > > The errors I get are > >>> File >>> "C:\python27\lib\site-packages\scrapy-0.16.3-py2.7.egg\scrapy\selector\lxmlsel.py", >>> line 47, in select >>> raise ValueError("Invalid XPath:

Re: help with making my code more efficient

2012-12-21 Thread Dave Angel
On 12/21/2012 03:36 PM, larry.mart...@gmail.com wrote: > On Friday, December 21, 2012 10:57:19 AM UTC-7, larry@gmail.com wrote: >> >> Didn't know about bisect. Thanks. I thought it would be my savior for sure. >> But unfortunaly when I added that, it blows up with out of memory. > The out of

Re: help with making my code more efficient

2012-12-21 Thread larry.mart...@gmail.com
On Friday, December 21, 2012 8:19:37 PM UTC-7, Dave Angel wrote: > On 12/21/2012 03:36 PM, larry.mart...@gmail.com wrote: > > > On Friday, December 21, 2012 10:57:19 AM UTC-7, larry@gmail.com wrote: > > >> > > >> Didn't know about bisect. Thanks. I thought it would be my savior for > >> su

Re: help with making my code more efficient

2012-12-21 Thread Dave Angel
On 12/21/2012 11:47 PM, larry.mart...@gmail.com wrote: > On Friday, December 21, 2012 8:19:37 PM UTC-7, Dave Angel wrote: >> On 12/21/2012 03:36 PM, larry.mart...@gmail.com wrote: >> > I think you're misunderstanding what I need to do. I have a set of rows from > the database with tool, time