On Jun 3, 2:17 pm, 7stud <[EMAIL PROTECTED]> wrote:
> On Jun 2, 10:31 pm, lialie <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi,
>
> > suppose i have a free_object list[Sample1, Smaple2]. when create a
> > new object sample(*args, **kwds), if free_object_list isn't empty, just
> > pop one from free_ob
On Jun 3, 12:50 am, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
> On Sat, 02 Jun 2007 23:25:49 -0700, 7stud wrote:
> > Oops. This line:
>
> >> temp = object.__new__(Sample, args, kwds)
>
> > should be:
>
> > temp = object.__new__(cls, args, kwds)
>
> > although it would seem that cls is always goin
On Sat, 02 Jun 2007 23:25:49 -0700, 7stud wrote:
> Oops. This line:
>
>> temp = object.__new__(Sample, args, kwds)
>
> should be:
>
> temp = object.__new__(cls, args, kwds)
>
> although it would seem that cls is always going to be Sample, so I'm
> not sure what practical difference that makes
On Jun 3, 12:17 am, 7stud <[EMAIL PROTECTED]> wrote:
> On Jun 2, 10:31 pm, lialie <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi,
>
> > suppose i have a free_object list[Sample1, Smaple2]. when create a
> > new object sample(*args, **kwds), if free_object_list isn't empty, just
> > pop one from free_o
On Jun 2, 10:31 pm, lialie <[EMAIL PROTECTED]> wrote:
> Hi,
>
> suppose i have a free_object list[Sample1, Smaple2]. when create a
> new object sample(*args, **kwds), if free_object_list isn't empty, just
> pop one from free_object_list instead of creating a new instance.
>
> any way to do this
I just noticed that in your code you used pop(0). It's not efficient
to pop an element off the front of a list because after doing so,
every other element in the list has to be moved over to the left one
position. If you pop() an element off the end of the list, then the
first element in the list
On Jun 2, 10:31 pm, lialie <[EMAIL PROTECTED]> wrote:
> Hi,
>
> suppose i have a free_object list[Sample1, Smaple2]. when create a
> new object sample(*args, **kwds), if free_object_list isn't empty, just
> pop one from free_object_list instead of creating a new instance.
>
> any way to do this
Hi,
suppose i have a free_object list[Sample1, Smaple2]. when create a
new object sample(*args, **kwds), if free_object_list isn't empty, just
pop one from free_object_list instead of creating a new instance.
any way to do this?
I do some work as follows:
class Sample(object):
used_object =