import re
infile = open('document.txt','r')
outfile= open('output.txt','w')
copy = False
for line in infile:
if line.strip() == "--operation():":
bucket = []
copy = True
elif line.strip() == "StartOperation":
for strings in bucket:
outfile.write( strin
"If it walks like a duck, quacks like a duck,... "
so there is indeed precedence for this so-called 'duck typing'
but wouldn't it be more Pythonic to call this 'witch typing'?
"How do you know she is a witch?"
"She looks like one."
etc.
I do grant that ultimately, the duck does come into
This should go to Python ideas as it would involve a substantial change to the
docs.
Kindest regards.
Mark Lawrence.
--
https://mail.python.org/mailman/listinfo/python-list
On Saturday, August 27, 2016 at 5:50:30 AM UTC-4, ROGER GRAYDON CHRISTMAN wrote:
> "If it walks like a duck, quacks like a duck,... "
>
> so there is indeed precedence for this so-called 'duck typing'
>
>
> but wouldn't it be more Pythonic to call this 'witch typing'?
>
> "How do you know sh
Thanks for the lead. I have big log file nearly 2 GB.
Lets say I just want to extract the ;name' field only eg.
AutoAuthOSUserSubmit.The code is failing with errors. Can you just give a
tested code only for the name field. Other fields I will try to work out.
---
On Saturday, August 27,
On Fri, Aug 26, 2016 at 7:58 PM, ROGER GRAYDON CHRISTMAN wrote:
> "If it walks like a duck, quacks like a duck,... "
>
> so there is indeed precedence for this so-called 'duck typing'
>
>
> but wouldn't it be more Pythonic to call this 'witch typing'?
>
> "How do you know she is a witch?"
>
> "She
On 2016-08-18, ast wrote:
> Hello
>
> I wonder why calling a method on an integer
> doesn't work ?
>
123.bit_length()
> SyntaxError: invalid syntax
Becuase the parser thinks you've entered a floating point number with
a fractional part of "bit_length".
You need to enter the integer such tha
On Sat, Aug 27, 2016, at 13:24, Grant Edwards wrote:
> Becuase the parser thinks you've entered a floating point number with
> a fractional part of "bit_length".
123.+456 doesn't think that the fractional part is "+456".
(Of course, the real reason is "because it would be even more annoying
to ge
I have installed numpy using the command pip install numpy from command prompt
and I am getting the following error:
Traceback (most recent call last):
File "", line 1, in
import numpy
File
"C:\Users\GP\AppData\Local\Programs\Python\Python35\lib\site-packages\numpy\__init__.py",
line 18
Thank you for all your answers. After all, I am more confident with
the current syntax.
The most important reason for 'await' to me now is the fact you quite
_often_ need to prepare the 'awaitable' object to wait for it later
(like the ChrisA's example with print()), i.e. split the expression
into
Hi,
I'm using Python 3.5.1 with PyUSB 1.0 under Win 10 (64). We try to read
the USB output of a DMM 'UT61B'.
import usb.core
import usb.util
import usb.backend.libusb1
def Gosub():
dev = usb.core.find(idVendor=0x1a86, idProduct=0xe008) # Digital
Multimeter UT61B
if dev == None:
On 2016-08-27, Random832 wrote:
> On Sat, Aug 27, 2016, at 13:24, Grant Edwards wrote:
>> Becuase the parser thinks you've entered a floating point number with
>> a fractional part of "bit_length".
>
> 123.+456 doesn't think that the fractional part is "+456".
That's because the parser (or more t
On Saturday, August 27, 2016 at 5:45:58 PM UTC+1, GP wrote:
> I have installed numpy using the command pip install numpy from command
> prompt and I am getting the following error:
> Traceback (most recent call last):
> File "", line 1, in
> import numpy
> File
> "C:\Users\GP\AppData\Loc
On 8/26/2016 7:58 PM, ROGER GRAYDON CHRISTMAN wrote:
"If it walks like a duck, quacks like a duck,... "
so there is indeed precedence for this so-called 'duck typing'
but wouldn't it be more Pythonic to call this 'witch typing'?
"How do you know she is a witch?"
"She looks like one."
Given
On 8/27/2016 3:35 PM, Joe wrote:
Hi,
I'm using Python 3.5.1 with PyUSB 1.0 under Win 10 (64). We try to read
the USB output of a DMM 'UT61B'.
import usb.core
import usb.util
import usb.backend.libusb1
def Gosub():
dev = usb.core.find(idVendor=0x1a86, idProduct=0xe008) # Digital
Multimeter
On 26Aug2016 19:58, ROGER GRAYDON CHRISTMAN wrote:
"If it walks like a duck, quacks like a duck,... "
so there is indeed precedence for this so-called 'duck typing'
but wouldn't it be more Pythonic to call this 'witch typing'?
"How do you know she is a witch?"
"She looks like one."
etc.
I do g
On Sat, Aug 27, 2016 at 6:34 PM, Terry Reedy wrote:
> On 8/26/2016 7:58 PM, ROGER GRAYDON CHRISTMAN wrote:
>>
>> "If it walks like a duck, quacks like a duck,... "
>>
>> so there is indeed precedence for this so-called 'duck typing'
>>
>>
>> but wouldn't it be more Pythonic to call this 'witch typ
Your response is appreciated. I just thought I'd comment a little more on the
script:
Woman: I'm not a witch! I'm not a witch!
V: ehh... but you are dressed like one.
W: They dressed me up like this!
All: naah no we didn't... no.
W: And this isn't my nose, it's a false one.
(V lifts up
c...@zip.com.au writes:
> They want to burn her because she's supposedly a witch, but the
> scientific test was that she weighed as much as a duck. So I think
> your second example is also duck typing: functioning like a duck.
Excellent reasoning!
(Also, I agree that describing objects with “loo
2016-08-14 7:29 GMT-07:00 Steven D'Aprano :
> On Thu, 11 Aug 2016 06:33 am, Juan Pablo Romero Méndez wrote:
>
> > I've been trying to find (without success so far) an example of a
> > situation where the dynamic features of a language like Python provides a
> > clear advantage over languages with
On Sun, 28 Aug 2016 12:31 pm, Juan Pablo Romero Méndez wrote:
> 2016-08-14 7:29 GMT-07:00 Steven D'Aprano :
>
>> On Thu, 11 Aug 2016 06:33 am, Juan Pablo Romero Méndez wrote:
>>
>> > I've been trying to find (without success so far) an example of a
>> > situation where the dynamic features of a l
2016-08-27 21:30 GMT-07:00 Steve D'Aprano :
> On Sun, 28 Aug 2016 12:31 pm, Juan Pablo Romero Méndez wrote:
>
> > 2016-08-14 7:29 GMT-07:00 Steven D'Aprano :
> >
> >> On Thu, 11 Aug 2016 06:33 am, Juan Pablo Romero Méndez wrote:
> >>
> >> > I've been trying to find (without success so far) an exam
On Sun, Aug 28, 2016 at 2:30 PM, Steve D'Aprano
wrote:
> But the author of this piece ignores that standard distinction and invents
> his own non-standard one: to him, classes are merely different
> representations of the same data. E.g. his example of complex numbers,
> shown as Cartesian (x, y)
2016-08-27 21:30 GMT-07:00 Steve D'Aprano :
> On Sun, 28 Aug 2016 12:31 pm, Juan Pablo Romero Méndez wrote:
>
> > 2016-08-14 7:29 GMT-07:00 Steven D'Aprano :
> >
> >> On Thu, 11 Aug 2016 06:33 am, Juan Pablo Romero Méndez wrote:
> >>
> >> > I've been trying to find (without success so far) an exam
Chris Angelico writes:
> On Sun, Aug 28, 2016 at 2:30 PM, Steve D'Aprano wrote:
>> But in dynamic typing, the type information isn't associated with the
>> name "x", but with the value 1 currently assigned to it. Change the
>> assignment, and the type changes. As a consequence, it is necessary
>>
On Sun, Aug 28, 2016 at 4:13 PM, Jussi Piitulainen
wrote:
>> This is where I'm less sure. Sometimes a variable's type should be
>> broader than just one concrete type - for instance, a variable might
>> hold 1 over here, and 1.5 over there, and thus is storing either "int
>> or float" or "any numb
26 matches
Mail list logo