I'm reading the part of the tutorial that talks about tab-completion, and
I think the docs are wrong.
http://docs.python.org/tutorial/interactive.html#key-bindings
The "more capable startup file" example given claims:
# Add auto-completion and a stored history file of commands to your Python
#
On 01/21/2012 02:44 AM, Andrea Crotti wrote:
I normally didn't bother too much when reading from files, and for example
I always did a
content = open(filename).readlines()
But now I have the doubt that it's not a good idea, does the file
handler stays
open until the interpreter quits?
It is n
Steven D'Aprano wrote:
> I'm reading the part of the tutorial that talks about tab-completion, and
> I think the docs are wrong.
>
> http://docs.python.org/tutorial/interactive.html#key-bindings
>
> The "more capable startup file" example given claims:
>
> # Add auto-completion and a stored his
I see sometimes in other people code "while 1" instead of "while True".
I think using True is more pythonic, but I wanted to check if there is
any difference in practice.
So I tried to do the following, and the result is surprising. For what
I can see it looks like the interpreter can optimize a
Actually there was the same question here (sorry should have looked before)
http://stackoverflow.com/questions/3815359/while-1-vs-for-whiletrue-why-is-there-a-difference
And I think the main reason is that 1 is a constant while True is not
such and can be reassigned.
--
http://mail.python.org/mai
On Sun, Jan 22, 2012 at 12:47 AM, Andrea Crotti
wrote:
> So I tried to do the following, and the result is surprising. For what
> I can see it looks like the interpreter can optimize away the 1 boolean
> conversion while it doesn't with the True, the opposite of what I
> supposed.
>
> Anyone can
I want to run a server side python script when a button on a web page
is clicked. This is on a LAMP server - apache2 on xubuntu 11.10.
I know I *could* run it as a CGI script but I don't want to change the
web page at all when the button is clicked (I'll see the effect
elsewhere on the screen any
Probably because of the fact it is possible to set True equal to False and
consequently then invalidate loop logic as presented below:
True = False
while True:
...
On the other hand `1' will always be evaluated as a constant.
Don't know, just guessing.
Matteo
On Jan/21, Andrea
On Sat, 2012-01-21 at 05:56 +0100, Stefan Behnel wrote:
> Adam Tauno Williams, 20.01.2012 21:38:
> > I'm using etree to perform XSLT transforms, such as -
> > from lxml import etree
> > source = etree.parse(self.rfile)
> > xslt = etree.fromstring(self._xslt)
> > transform = etree.XSLT(xslt)
> > res
On Sat, Jan 21, 2012 at 7:58 AM, wrote:
> I want to run a server side python script when a button on a web page
> is clicked. This is on a LAMP server - apache2 on xubuntu 11.10.
>
> I know I *could* run it as a CGI script but I don't want to change the
> web page at all when the button is click
Chris Angelico wrote:
On Sun, Jan 22, 2012 at 12:47 AM, Andrea Crotti
wrote:
So I tried to do the following, and the result is surprising. For what
I can see it looks like the interpreter can optimize away the 1 boolean
conversion while it doesn't with the True, the opposite of what I
supposed
Andrea Crotti wrote:
I see sometimes in other people code "while 1" instead of "while True".
I think using True is more pythonic, but I wanted to check if there is
any difference in practice.
No (with the exception of `True` and `False` being rebinable in Python
2). The idiomatic `while 1` no
On Sun, Jan 22, 2012 at 8:13 AM, Erik Max Francis wrote:
> Why this should concern anyone, I don't know; someone who's rebound `True`
> or `False` to evaluate to something other than true and false, respectively,
> is only doing so to be difficult (or very foolish). One of the principles
> of Pyt
I just installed 2.7... should have done this a while ago. pip finally works!
Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
Hi people!
I have asked myself the following thing.
How do I access the address of an object and later get the object from
that address ?!
I am heavily interisted.
thank you
Tamer
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, Jan 21, 2012 at 7:04 PM, Tamer Higazi wrote:
> Hi people!
> I have asked myself the following thing.
>
> How do I access the address of an object
id(obj) happens to do that in CPython, but it's a mere implementation detail.
> and later get the object from
> that address ?!
Not possible.
tinn...@isbd.co.uk wrote:
>
>I want to run a server side python script when a button on a web page
>is clicked. This is on a LAMP server - apache2 on xubuntu 11.10.
>
>I know I *could* run it as a CGI script but I don't want to change the
>web page at all when the button is clicked (I'll see the e
On Sun, Jan 22, 2012 at 3:36 PM, Tim Roberts wrote:
> It seems what you're after is AJAX. If you are using a Javascript
> framework like jQuery, it's easy to fire off an asynchronous request back
> to your server that leaves the existing page alone.
If you aren't using a framework, look up the X
On Sun, Jan 22, 2012 at 2:04 PM, Tamer Higazi wrote:
> Hi people!
> I have asked myself the following thing.
>
> How do I access the address of an object and later get the object from
> that address ?!
The problem with that sort of idea is that it mucks up garbage
collection. CPython, for example
On Sun, 22 Jan 2012 09:13:23 +1100, Chris Angelico wrote:
> On Sun, Jan 22, 2012 at 8:13 AM, Erik Max Francis
> wrote:
>> Why this should concern anyone, I don't know; someone who's rebound
>> `True` or `False` to evaluate to something other than true and false,
>> respectively, is only doing so
On Sun, 22 Jan 2012 04:04:08 +0100, Tamer Higazi wrote:
> Hi people!
> I have asked myself the following thing.
>
> How do I access the address of an object and later get the object from
> that address ?!
Use another language.
By design, Python does not provide pointers. This is a good thing,
Is this the expected behaviour?
When I run this script, it reads only once, but I expected once per line with
bufsize=1.
What I am trying to do is display the output of a slow process in a tkinter
window as it runs. Right now, the process runs to completion, then display the
result.
imp
On Sat, 21 Jan 2012 19:36:32 -0800, Chris Rebert wrote:
> On Sat, Jan 21, 2012 at 7:04 PM, Tamer Higazi
> wrote:
>> Hi people!
>> I have asked myself the following thing.
>>
>> How do I access the address of an object
>
> id(obj) happens to do that in CPython, but it's a mere implementation
> de
On Sat, Jan 21, 2012 at 9:45 PM, wrote:
> Is this the expected behavior?
Yes. `.read()` [with no argument] on a file-like object reads until
EOF. See http://docs.python.org/library/stdtypes.html#file.read
> When I run this script, it reads only once, but I expected once per line
> with bufsize=
24 matches
Mail list logo