On Tue, 20 Feb 2007 22:03:43 +0100, Bruno Desthuilliers wrote:
[snip]
>>>And that's not cruft?
>>
>>
>> No. Why do you think it is crufty?
>
> Because it is ?
*shrug*
"Is not."
"Is too."
"Is not."
Why is converting a list of integers to a string all at once more crufty
than converting them
Steven D'Aprano a écrit :
> On Tue, 20 Feb 2007 07:08:02 -0800, John Machin wrote:
>
>
>>>def write_series(data, f):
>>>"""Write a time series data to file f.
>>>
>>>data should be a list of integers.
>>>f should be an already opened file-like object.
>>>"""
>>># Convert data
Steven D'Aprano <[EMAIL PROTECTED]> writes:
> Would it be less crufty if I wrote it as a cryptic one liner without
> comments?
>
> f.write(str(data)[1:-1].replace(',', '') + '\n')
That doesn't look terribly cryptic to me, but maybe I'm used to it.
> > Try this: f.write(' '.join(str(x) for x in d
On Tue, 20 Feb 2007 07:08:02 -0800, John Machin wrote:
>> def write_series(data, f):
>> """Write a time series data to file f.
>>
>> data should be a list of integers.
>> f should be an already opened file-like object.
>> """
>> # Convert data into a string for writing.
>>
On Feb 21, 12:22 am, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
> On Mon, 19 Feb 2007 22:17:42 -0800, hiro wrote:
> > Hey there, I'm currently doing data preprocessing (generating lagged
> > values for a time series) and I'm having some difficulties trying to
> > write a file to disk. A friend of
hiro kirjoitti:
> Hey there, I'm currently doing data preprocessing (generating lagged
> values for a time series) and I'm having some difficulties trying to
> write a file to disk. A friend of mine, wrote this quick example for
> me:
>
>
> tweaked code:
> ---
On Mon, 19 Feb 2007 22:17:42 -0800, hiro wrote:
> Hey there, I'm currently doing data preprocessing (generating lagged
> values for a time series) and I'm having some difficulties trying to
> write a file to disk. A friend of mine, wrote this quick example for
> me:
If that's a quick example (we
Hey there, I'm currently doing data preprocessing (generating lagged
values for a time series) and I'm having some difficulties trying to
write a file to disk. A friend of mine, wrote this quick example for
me:
---