On Sat, 15 Mar 2014 23:47:30 -0500, Mark H Harris wrote:
> The other thing I'm tempted to do is to find names (even new names) that
> read like English closely (whatever I mean by that) so that there is no
> question about what is going on to a non expert.
>
> for line in getnumline(file):
>
On Sun, Mar 16, 2014 at 5:19 PM, Mark H Harris wrote:
> On 3/16/14 12:41 AM, Chris Angelico wrote:
>> To be quite frank, yes I do think it's a nutty idea. Like most nutty
>> things, there's a kernel of something good in it, but that's not
>> enough to build a system on :)
>
>
>Thanks for your
On 3/16/14 12:41 AM, Chris Angelico wrote:
Good stuff Chris, and thanks for the footnotes, I appreciate it.
If getline() is doing nothing that the primitive doesn't, and
getnumline is just enumerate, then they're not achieving anything
beyond shielding you from the primitives.
Yes.
On Sun, Mar 16, 2014 at 3:47 PM, Mark H Harris wrote:
> On 3/15/14 10:48 PM, Chris Angelico wrote:
>>
>> There's a cost to refactoring. Suddenly there's a new primitive on the
>> board - a new piece of language . . . Splitting out all sorts of things
>> into
>>
>> generators when you could use wel
On 3/15/14 10:48 PM, Chris Angelico wrote:
There's a cost to refactoring. Suddenly there's a new primitive on the
board - a new piece of language . . . Splitting out all sorts of things into
generators when you could use well-known primitives like enumerate
gets expensive fast {snip}
[1] https:
On Sun, Mar 16, 2014 at 2:34 PM, Mark H Harris wrote:
> And you are right about another thing, I just want to use this thing over
> and over.
>
> for line in getnumline(filename):
> {whatever}
>
>There does seem to be just one way of doing this (file reads) but there
> are actually many w
On 3/15/14 9:01 PM, Steven D'Aprano wrote:
Reading from files is already pretty simple. I would expect that it will
be harder to learn the specific details of custom, specialised, file
readers that *almost*, but not quite, do what you want, than to just
write a couple of lines of code to do what
On 3/15/14 8:32 PM, Mark Lawrence wrote:
Start here
http://docs.python.org/3/library/stdtypes.html#context-manager-types
Thanks Mark. I have three books open, and that doc, and wading through.
You might like to know (as an aside) that I'm done with gg. Got back up
here with a real news read
On Sat, 15 Mar 2014 16:38:18 -0500, Mark H Harris wrote:
> hi folks, I am posting to share a File Reader Generator which I have
> been playing with, that simplifies reading of text files on-demand: like
> log files, config files, small record flat data-bases, &c.
Reading from files is already pre
On 16/03/2014 01:06, Mark H Harris wrote:
On 3/15/14 4:56 PM, MRAB wrote:
You can also shorten it somewhat:
Thanks, I like it... I shortened the fnName() also:
#-
# fn2Name(filename) generator: file reader iterable
#-
On 3/15/14 4:56 PM, MRAB wrote:
You can also shorten it somewhat:
Thanks, I like it... I shortened the fnName() also:
#-
# fn2Name(filename) generator: file reader iterable
#-
de
On 3/15/14 4:56 PM, MRAB wrote:
def fName(filename):
try:
with open(filename, 'r') as fh:
for linein in fh:
yield linein.strip('\n')
except FileNotFoundError as err_code:
print(err_code)
[snip]
The "with" confuses me because I am not sure s
On 3/15/14 4:56 PM, MRAB wrote:
I don't like how it always swallows the exception, so you can't tell
whether the file doesn't exist or exists but is empty, and no way to
specify the file's encoding.
Yes, the error handling needs more robustness/ and instead of printing
the errcode, my actual m
On 2014-03-15 21:38, Mark H Harris wrote:
hi folks, I am posting to share a File Reader Generator which I have
been playing with, that simplifies reading of text files on-demand:
like log files, config files, small record flat data-bases, &c.
I have two generators to share, one with & one withou
hi folks, I am posting to share a File Reader Generator which I have
been playing with, that simplifies reading of text files on-demand:
like log files, config files, small record flat data-bases, &c.
I have two generators to share, one with & one without "policy".
The idea is to have the generat
15 matches
Mail list logo