On Sat, Feb 20, 2010 at 6:55 PM, marwie wrote:
> Now my question is
> if there's a similar thing for breaking a list into two parts. Let's
> say I want to remove from l1 everything from and including position 10
> and store it in l2. Then I can write
>
>l2 = l1[10:]
>del l1[10:]
With Py
On Sat, 20 Feb 2010 21:25:19 -0600, Michael Pardee wrote:
> I'm relatively new to python and I was very surprised by the following
> behavior:
[snip]
I don't see why. It's fairly unusual behaviour to want, and it would be
surprising if you did this:
def test():
x = 1
mylist = [2, 4, x]
Steven D'Aprano wrote:
[snip]
I'm sympathetic to your concern: I've often felt offended that doing
something like this:
x = SomeReallyBigListOrString
for item in x[1:]:
process(item)
has to copy the entire list or string (less the first item). But
honestly, I've never found a situation wh
On Sat, Feb 20, 2010 at 5:41 PM, Steven D'Aprano
wrote:
>
> What the OP wants is:
>
> (1) assign the name l2 to l1[:10] without copying
> (2) resize l1 in place to the first 10 items without affecting l2.
>
For ten items, though, is it really faster to muck around with array
lengths than just cop
On Sat, Feb 20, 2010 at 7:25 PM, Michael Pardee
wrote:
>
> But what would be "the python way" to accomplish "list of variables"
> functionality?
>
You're looking for namespaces, AKA dicts.
>>> vars = {}
>>> vars['a'] = 1
>>> vars['b'] = 2
>>> mylist = ['a', 'b']
>>> print [vars[i] for i in mylis
On Sat, Feb 20, 2010 at 5:53 PM, Vincent Davis wrote:
>> On Sat, Feb 20, 2010 at 6:44 PM, Jonathan
>> Gardner wrote:
>>
>> With this kind of data set, you should start looking at BDBs or
>> PostgreSQL to hold your data. While processing files this large is
>> possible, it isn't easy. Your time i
On Sat, Feb 20, 2010 at 5:53 PM, Steven D'Aprano
wrote:
> On Sat, 20 Feb 2010 17:34:15 -0800, Jonathan Gardner wrote:
>> In terms of "global", you should only really use "global" when you are
>> need to assign to a lexically scoped variable that is shared among other
>> functions. For instance:
>>
On Feb 20, 7:25 pm, Michael Pardee wrote:
> I'm relatively new to python and I was very surprised by the following
> behavior:
>
> >>> a=1
> >>> b=2
> >>> mylist=[a,b]
> >>> print mylist
> [1, 2]
> >>> a=3
> >>> print mylist
>
> [1, 2]
>
> Whoah! Are python lists only for literals? Nope:
>
> >>
come and join www.pakdub.com a social network with full features like
games, classifieds, forums, blogs and a lot more
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 20, 4:55 pm, marwie wrote:
> Hello,
>
> I recently read about augmented assignments and that (with l1, l2
> being lists)
>
> l1.extend(l2)
>
> is more efficient than
>
> l1 = l1 + l2
>
> because unnecessary copy operations can be avoided. Now my question is
> if there's a similar th
On Sat, 20 Feb 2010 21:21:47 -0800, Jonathan Gardner wrote:
> On Sat, Feb 20, 2010 at 5:41 PM, Steven D'Aprano
> wrote:
>>
>> What the OP wants is:
>>
>> (1) assign the name l2 to l1[:10] without copying (2) resize l1 in
>> place to the first 10 items without affecting l2.
>>
>>
> For ten items,
On Sat, 20 Feb 2010 22:31:44 -0800, Carl Banks wrote:
> The one place where Python does have references is when accessing
> variables in an enclosing scope (not counting module-level).
What makes you say that?
> But these
> references aren't objects, so you can't store them in a list, so it
>
Steven D'Aprano wrote:
On Wed, 17 Feb 2010 02:00:59 -0500, geremy condra quoted Banibrata Dutta
:
BTW for people who are non-believers in something being worth stealing
needing protection, need to read about the Skype client.
Pardon me for breaking threading, but the original post has not com
On Feb 20, 10:50 pm, Steven D'Aprano wrote:
> On Sat, 20 Feb 2010 22:31:44 -0800, Carl Banks wrote:
> > The one place where Python does have references is when accessing
> > variables in an enclosing scope (not counting module-level).
>
> What makes you say that?
>
> > But these
> > references a
On Feb 20, 9:58 pm, John Nagle wrote:
> sjdevn...@yahoo.com wrote:
> > On Feb 18, 2:58 pm, John Nagle wrote:
> >> Multiple processes are not the answer. That means loading multiple
> >> copies of the same code into different areas of memory. The cache
> >> miss rate goes up accordingly.
>
>
101 - 115 of 115 matches
Mail list logo