Lie Ryan wrote:
Although I've said such, the terms are not actually that clear cut. Most
object-oriented languages also have a for-loop, while-loop, and
if-conditional of a structured programming. And not all object-oriented
languages have classes (e.g. javascript).
There is a lot of overlap
On 12/11/2011 04:04 AM, Alan Gauld wrote:
On 10/12/11 16:46, Steven D'Aprano wrote:
circumstances, regardless of which behaviour was choosen for append, it
would catch out some people some time.
Probably, although if returning 'self' were the default (which
of course only makes sense in a pure
On 12/10/2011 03:52 AM, Sarma Tangirala wrote:
Well, what I meant was the way you write things like list comprehension.
I agree, that comment gave a completely incorrect picture. Sorry about that.
list comprehension originated from Haskell, which is a language with a
very strong functional pa
>> Smalltalk's mechanism stands in stark contrast to the mixed
>> model in Python. (OTOH Smalltalk overall is a frustrating
>> experience for me, I would like to love it but never quite
>> get there... :-)
>
>Personally, I found that returning a copy of a seemed more logical- after all,
>if you
def __exit__(self, *args):
Thanks guys. This is the solution I implemented and it works great.
Mark :)
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On Dec 10, 2011, at 12:04 PM, Alan Gauld wrote:
> On 10/12/11 16:46, Steven D'Aprano wrote:
>
>> ...the alternative would also have caught out everybody at some point.
>> Consider a hypothetical Python where mutator methods returned a result:
>>
>> a = [1, 2, 3]
>> b = a.append(4)
>>
>> Does t
On 2011-12-10 20:22, Walter Prins wrote:
Is the example wrong, or is this something to do with how Windows
handles stdout that is causing this not to work as designed? I am
using Python 3.2 on Windows Vista Home Premium.
It seems the example may be wrong -- the __exit__ method, as stated
by th
Hi Mark,
On 10 December 2011 17:54, Mark Lybrand wrote:
>
> I am working on the Files chapter of Dive into Python 3, and have implemented
> the example script at the end of this message. The first input prints to the
> terminal as expected, the second value prints to the file as expected. The
I am working on the Files chapter of Dive into Python 3, and have
implemented the example script at the end of this message. The first input
prints to the terminal as expected, the second value prints to the file as
expected. Then the script tries to destroy in the class instance and bombs
with:
On 2011-12-10 18:12, Alan Gauld wrote:
On 10/12/11 16:29, Andreas Perstinger wrote:
Hmm, I just went to check the HISTORY file and I can't find it.
It used to come with the source tarball, but I haven't downloaded
the source for years!...
http://hg.python.org/cpython/file/e37a7dc8944e/Mis
On 10/12/11 16:29, Andreas Perstinger wrote:
Hmm, I just went to check the HISTORY file and I can't find it.
It used to come with the source tarball, but I haven't downloaded
the source for years!...
http://hg.python.org/cpython/file/e37a7dc8944e/Misc/HISTORY
Thanks Andreas. Now, how was I
Massimo Di Stefano wrote:
[...]
it just print out the list generated during the thread execution, while i'm tring to return it.
Since lista is a mutable global variable, you don't need to return it. Just
look at lista once the threads have completed its work and you will find the
content you
On 10/12/11 16:46, Steven D'Aprano wrote:
...the alternative would also have caught out everybody at some point.
Consider a hypothetical Python where mutator methods returned a result:
a = [1, 2, 3]
b = a.append(4)
Does this mean...?
* append 4 to a, then return a (and therefore a and b are
a
On 12/10/2011 8:46 AM Massimo Di Stefano said...
Hi All,
i'm tring to learn how to use threads in python to save a list of
object. i'm starting from this code :
Moving lista into the instance seems to do it...
Emile
#
import threading
import urllib
from tempfile import NamedTempora
Hi All,
i'm tring to learn how to use threads in python to save a list of object. i'm
starting from this code :
#
import threading
import urllib
from tempfile import NamedTemporaryFile
singlelock = threading.Lock()
class download(threading.Thread):
def __init__(self, sitecode, lista):
Alan Gauld wrote:
[...]
Because app() returns the result of append().
But append() returns None, since it modifies the list in place.
This is one of the few features of Python I dislike. It would not have
been difficult to make these modifier methods return the thing modified.
This style would
On 2011-12-09 20:46, Alan Gauld wrote:
On 09/12/11 19:24, Alan Gauld wrote:
In February 1991, after just over a year of development, I decided to
post to USENET. The rest is in the Misc/HISTORY file.
=
Hopefully that clarifies rather than condfusing! :-)
The H
lina wrote:
> On Sat, Dec 10, 2011 at 6:09 PM, Peter Otten <__pete...@web.de> wrote:
>> surya k wrote:
>>
>>> Finding factorial of 8 or 9 isn't big. If I would like to find factorial
>>> of 32327, how can I ?
>>
>> gmpy is a library designed for working with large numbers. Compare:
>>
> import
On Sat, Dec 10, 2011 at 6:09 PM, Peter Otten <__pete...@web.de> wrote:
> surya k wrote:
>
>> Finding factorial of 8 or 9 isn't big. If I would like to find factorial
>> of 32327, how can I ?
>
> gmpy is a library designed for working with large numbers. Compare:
>
import time
def bench(f,
Hi,
Does any of you use Pysces? I need to run some simulations and
unfortunately I cannot create plot. After importing Pysces it claims
that Matplotlib is not available, but it's installed for sure since I
can import matplotlib. When I try to do plot after simulation:
--
surya k wrote:
> Finding factorial of 8 or 9 isn't big. If I would like to find factorial
> of 32327, how can I ?
gmpy is a library designed for working with large numbers. Compare:
>>> import time
>>> def bench(f, *args):
... start = time.time()
... try:
... return f(*args)
Emeka wrote:
> Could someone explain " functools.update_wrapper" with simple examples?
Since this is not for the absolute beginner I'm assuming you are already
familiar with decorators. In their most common form these are functions that
take a function and wrap that function into another functi
On 10/12/11 07:41, sunil tech wrote:
/def app(x):/
/ return x.append(100)/
/
/p = app(a)/
/
/now list holds appended value [1,2,3,100]/
/but p is empty... why it is?/
Because app() returns the result of append().
But append() returns None, since it modifies the list in place.
This is one
On Sat, Dec 10, 2011 at 1:11 PM, sunil tech wrote:
> hi,
>
> Consider a list: a = [1,2,3]
>
> & a simple function, which when called it will append 100 to the list.
>
> def app(x):
> return x.append(100)
>
> p = app(a)
>
> now list holds appended value [1,2,3,100]
> but p is empty... why it i
24 matches
Mail list logo