On Wed, Jan 29, 2020 at 1:50 AM Random832 wrote:
>
> On Wed, Jan 22, 2020, at 02:34, Stephen Tucker wrote:
> > Oh dear, I am sorry. I have created quite a storm.
> >
> > Moreover, I am sorry because I misremembered what I had typed into Idle. My
> > original tuple only had two elements, not three,
On Wed, Jan 22, 2020, at 02:34, Stephen Tucker wrote:
> Oh dear, I am sorry. I have created quite a storm.
>
> Moreover, I am sorry because I misremembered what I had typed into Idle. My
> original tuple only had two elements, not three, so the slicing [:2] didn't
> affect the tuple at all - and s
On Tue, Jan 28, 2020 at 9:33 PM Daniel Haude wrote:
>
> Am 27.01.2020 15:23 schrieb Chris Angelico:
>
> > The way execution works in Python, you first evaluate the object, then
> > assign it to the target. The new object HAS to exist before the old
> > one is replaced. There's no such thing as "at
Am 27.01.2020 15:23 schrieb Chris Angelico:
The way execution works in Python, you first evaluate the object, then
assign it to the target. The new object HAS to exist before the old
one is replaced. There's no such thing as "atomic reassignment" that
simultaneously destroys the old object and a
On Tue, Jan 28, 2020 at 2:44 AM Souvik Dutta wrote:
>
> If the two objects have the same value that means that when called all of
> them will point to the same object rather than creating the same value -
> object pairs twice. Immutability is the characteristics that does not let you
> change t
On Tue, Jan 28, 2020 at 1:13 AM Musbur wrote:
>
> Am 21.01.2020 19:38 schrieb Chris Angelico:
> > Are you sure that it does? I can't reproduce this. When you slice the
> > first two from a tuple, you create a new tuple, and until the
> > assignment happens, both the new one and the original coexis
Am 21.01.2020 19:38 schrieb Chris Angelico:
On Wed, Jan 22, 2020 at 4:42 AM Stephen Tucker
wrote:
and even that the first id(mytup) returns the same address as the
second
one, I am left wondering exactly what immutability is.
Let's look at id()'s documentation:
id(object)
Return the
On 1/21/20 8:41 PM, Jon Ribbens via Python-list wrote:
Whether we call the link between 'foo' and (1, 2) a pointer or a
reference is almost entirely irrelevant, the difference is essentially
meaningless.
The issue is that in Python, objects and names are fairly distinct.
Unlike a language like
On 1/21/20, Jon Ribbens via Python-list wrote:
>
> Whether we call the link between 'foo' and (1, 2) a pointer or a
> reference is almost entirely irrelevant, the difference is essentially
> meaningless.
In programming terms, a "pointer" is always an address in memory, and,
at least to me, the te
Oh dear, I am sorry. I have created quite a storm.
Moreover, I am sorry because I misremembered what I had typed into Idle. My
original tuple only had two elements, not three, so the slicing [:2] didn't
affect the tuple at all - and so the second id() gave the same address as
the first one.
So, y
On 1/21/20 6:52 PM, Ethan Furman wrote:
> On 01/21/2020 10:55 AM, Michael Torrie wrote:
>
>> Slicing
>> returns a new object whether one is slicing a tuple, list, or a string,
>> the latter two are mutable objects.
>
> Strings are not mutable.
Yup I got my items in the wrong order. I meant to sa
On 2020-01-22 01:52, Ethan Furman wrote:
On 01/21/2020 10:55 AM, Michael Torrie wrote:
Slicing
returns a new object whether one is slicing a tuple, list, or a string,
the latter two are mutable objects.
Strings are not mutable.
In the case of tuples and strings, if the slicing encompasses th
On 01/21/2020 10:55 AM, Michael Torrie wrote:
Slicing
returns a new object whether one is slicing a tuple, list, or a string,
the latter two are mutable objects.
Strings are not mutable.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
On 2020-01-21, Chris Angelico wrote:
> On Wed, Jan 22, 2020 at 8:01 AM Jon Ribbens via Python-list
> wrote:
>> On 2020-01-21, Chris Angelico wrote:
>> > On Wed, Jan 22, 2020 at 4:42 AM Stephen Tucker
>> > wrote:
>> >> I am left concluding that mytup is not actually a tuple (even though type
>>
On 22Jan2020 09:15, Cameron Simpson wrote:
It doesn't say anything about the contents of the internal objects:
>>> mytup = (1, [2, 3], (4, 5))
[...]
>>> mytupl[1] = [7, 8]
Traceback (most recent call last):
File "", line 1, in
NameError: name 'mytupl' is not defined
Please igno
On 21Jan2020 17:40, Stephen Tucker wrote:
I am sure this has been answered many times before, but I need to ask
it
again.
Given that the following is valid Python 2.7.10 (when keyboarded into Idle):
mytup = ("q", "w", "e")
id(mytup)
mytup = mytup [:2]
id(mytup)
and even that the first id(myt
On Wed, Jan 22, 2020 at 8:01 AM Jon Ribbens via Python-list
wrote:
>
> On 2020-01-21, Chris Angelico wrote:
> > On Wed, Jan 22, 2020 at 4:42 AM Stephen Tucker
> > wrote:
> >> I am left concluding that mytup is not actually a tuple (even though type
> >> (mytup) tells me that it is).
> >
> > If
On 2020-01-21, Chris Angelico wrote:
> On Wed, Jan 22, 2020 at 4:42 AM Stephen Tucker wrote:
>> I am left concluding that mytup is not actually a tuple (even though type
>> (mytup) tells me that it is).
>
> If type(mytup) is tuple, then mytup really truly is a tuple. There is
> no other conclusio
On Wed, Jan 22, 2020 at 5:56 AM Michael Torrie wrote:
>
> On 1/21/20 11:38 AM, Chris Angelico wrote:
> > Are you sure that it does? I can't reproduce this. When you slice the
> > first two from a tuple, you create a new tuple, and until the
> > assignment happens, both the new one and the original
On 1/21/20 11:38 AM, Chris Angelico wrote:
> Are you sure that it does? I can't reproduce this. When you slice the
> first two from a tuple, you create a new tuple, and until the
> assignment happens, both the new one and the original coexist, which
> means they MUST have unique IDs.
And furthermo
On Wed, Jan 22, 2020 at 4:42 AM Stephen Tucker wrote:
>
> Hi Python-list folk,
>
> I am sure this has been answered many times before, but I need to ask it
> again.
>
> Given that the following is valid Python 2.7.10 (when keyboarded into Idle):
>
> mytup = ("q", "w", "e")
> id(mytup)
> mytup = my
On 2:59 PM, Bruce W. wrote:
So, this kind of notation would be different:
args[0][2]
verses args[[0][2]]
the latter is multidimensional. Can you think of example of using
this type of list?
I don't know why this had me a bit confused. I've got to get into
programming more... I had done mo
So, this kind of notation would be different:
args[0][2]
verses args[[0][2]]
the latter is multidimensional. Can you think of example of using this
type of list?
I don't know why this had me a bit confused. I've got to get into
programming more... I had done more in the past.
Bruce
Chriebe
On 9/29/2010 10:32 PM, Bruce Whealton wrote:
Would you, and could you combine a dictionary with a list in this fashion?
A python list is a mutable sequence of Python objects. Extremely mixed
example.
>>> mixed = [1, 1.0, '1', [1], (1,), {1:1}, set((1,)), list, list.append]
>>> mixed.append(m
On Wed, Sep 29, 2010 at 7:32 PM, Bruce Whealton
wrote:
> Hello all,
> I recently started learning python. I am a bit thrown by a certain
> notation that I see. I was watching a training course on lynda.com and this
> notation was not presented. For lists, when would you use what appears
Bruce Whealton wrote:
> For lists, when would
> you use what appears to be nested lists, like:
> [[], [], []]
> a list of lists?
Well, you'd use it when you'd want a list of lists ;)
There's nothing magical about a list of lists, it's just a list with
objects inside like any other, in this case
On 2010-09-30, Bruce Whealton wrote:
> Next, from the documentation I see and this is just an example (this
> kind of notation is seen elsewhere in the documentation:
> str.count(sub[, start[, end]])
> This particular example is from the string methods.
> Is this a nesting of two lists inside a
[EMAIL PROTECTED] (Alex Martelli) writes:
> > turn indicates that both implementations actually work about same and
> > your "O(n squared)" argument is irrelevant.
>
> It's indeed irrelevant when the behavior _isn't_ quadratic (as in the
> case of intersections) -- but unfortunately it _is_ needle
samwyse <[EMAIL PROTECTED]> wrote:
...
> > brain:~ alex$ python -mtimeit -s'sos=[set(range(x,x+4)) for x in
> > range(0, 100, 3)]' 'r=set()' 'for x in sos: r.update(x)'
> > 10 loops, best of 3: 18.8 usec per loop
> >
> > brain:~ alex$ python -mtimeit -s'sos=[set(range(x,x+4)) for x in
> > r
Alex Martelli wrote:
> Of course, hoisting the unbound method out of the loops can afford the
> usual small optimization. But my point is that, in Python, these
> operations (like, say, the concatenation of a sequence of lists, etc)
> are best performed "in place" via loops calling mutator method
samwyse <[EMAIL PROTECTED]> wrote:
...
> Finally, does anyone familar with P3K know how best to do the reduction
> without using 'reduce'? Right now, sets don't support the 'add' and
> 'multiply' operators, so 'sum' and (the currently ficticious) 'product'
> won't work at all; while 'any' and
On 17/08/07, Beema shafreen <[EMAIL PROTECTED]> wrote:
> hi everybody,
> i have a file with data separated by tab
> mydata:
> fhl1fkh2
> dfp1chk1
> mal3alp14
> mal3moe1
> mal3spi1
> mal3bub1
> mal3bub3
> mal3mph1
> mal3mad3
> hob1nak1
> hob1wsp1
> hob1
samwyse wrote:
> Scott David Daniels wrote:
>
>> lefts = set()
>> rights = set()
>> with open('sheet1', 'r') as fh:
>> for line in fh:
>> trimmed = line.strip()
>> if trimmed: # Skip blanks (file end often looks like that)
>> left, right = line.strip()
Scott David Daniels wrote:
> lefts = set()
> rights = set()
> with open('sheet1', 'r') as fh:
> for line in fh:
> trimmed = line.strip()
> if trimmed: # Skip blanks (file end often looks like that)
> left, right = line.strip().split('\t')
>
Laurent Pointal wrote:
> Thomas Jollans a écrit :
>> On Friday 17 August 2007, Beema shafreen wrote:
>>> hi everybody,
>>> i have a file with data separated by tab
>>> mydata:
>>> fhl1fkh2
>
>>> shows these two are separated by tab represented as columns
>>> i have to check the common data bet
Laurent Pointal a écrit :
[cleaning]
fh = open('sheet1')
for line in fh:
--
http://mail.python.org/mailman/listinfo/python-list
Thomas Jollans a écrit :
> On Friday 17 August 2007, Beema shafreen wrote:
>> hi everybody,
>> i have a file with data separated by tab
>> mydata:
>> fhl1fkh2
>> shows these two are separated by tab represented as columns
>> i have to check the common data between these two coloumn1 an coloumn
On Friday 17 August 2007, Beema shafreen wrote:
> hi everybody,
> i have a file with data separated by tab
> mydata:
> fhl1fkh2
> dfp1chk1
> mal3alp14
> mal3moe1
> mal3spi1
> mal3bub1
> mal3bub3
> mal3mph1
> mal3mad3
> hob1nak1
> hob1wsp1
> hob1rad3
>
On Aug 16, 2007, at 2:42 AM, Beema shafreen wrote:
hi every body,
i have compared two files:
code:
fh = open('HPRD_MAIN_20.txt','r')
for line in fh.readlines():
data = line.strip().split('#')
fh1 = open('NOMENCLATURE_MAIN_20.txt','r')
for line1 in fh1.readlines():
On 2007-01-05 03:46, tubby wrote:
> Is this the safest, most portable way to open files on any platform:
>
> fp = open(file_name, 'rb')
> fp.close()
>
> I understand that doing the following on Windows to a binary file (a
> jpeg or exe files for example) can cause file corruption, is that correct?
At Thursday 4/1/2007 23:46, tubby wrote:
I understand that doing the following on Windows to a binary file (a
jpeg or exe files for example) can cause file corruption, is that correct?
fp = open(file_name, 'r')
fp.close()
How can a simple open in read mode corrupt data???
You can't corrupt *
Greg Wogan-Browne wrote:
> I am having some trouble figuring out what is going on here - is this
a
> bug, or correct behaviour? Basically, when I create an XML document
with
> a namespace using xml.dom.minidom.parse() or parseString(), the
> namespace exists as an xmlns attribute in the DOM (fair e
What you are looking for are 2 apps:
1) Something to freeze your application into something
that resembles an installation like what comes on commercial
applications. On Windows a popular choice is py2exe. All
dependent .py, .pyd, etc. files can be included in the
distribution. It also includes
Eddie Parker wrote:
> What Im looking for, is a way to turn a python application, into a
> stand-alone application. i.e., you dont need the Python interpreter,
> libraries, etc, installed on your hard drive. (Im OK with .py files
> existing I just dont want to have to bother the user to
44 matches
Mail list logo