Re: [Python-Dev] py3k buffered I/O - flush() required between read/write?

2011-05-12 Thread Antoine Pitrou

Hello,

On Thu, 12 May 2011 03:35:16 +0100
Genstein  wrote:
> 
> The following is the smallest code I can conjure which demonstrates the 
> issue I'm seeing:

This is a bug indeed. Can you report it on http://bugs.python.org ?

Thanks a lot for finding this,

Antoine.


___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] py3k buffered I/O - flush() required between read/write?

2011-05-12 Thread Genstein

On 12/05/2011 11:47, Antoine Pitrou wrote:

This is a bug indeed. Can you report it on http://bugs.python.org ?

Thanks a lot for finding this,

Antoine.


Duly reported as http://bugs.python.org/issue12062.

I'm glad it wasn't me being dumb(er than usual). It took a while to pin 
down to a small reproducible case.


Thanks for the fast and definite response, I'll cheerfully revert to 
lurking now ;)


All the best,

-eg.

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Could these restrictions be removed?

2011-05-12 Thread Skip Montanaro

A friend at work who is new to Python wondered why this didn't work with
pickle:

class Outer:

Class Inner:

...

def __init__(self):
self.i = Outer.Inner()

I explained:

> http://docs.python.org/library/pickle.html#what-can-be-pickled-and-unpickled 
> 
> 
>  From that:
> 
> # functions defined at the top level of a module
> # built-in functions defined at the top level of a module
> # classes that are defined at the top level of a module

I've never questions this, but I wonder, is this a fundamental restriction
or could it be overcome with a modest amount of work?

Just curious...

Skip

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Could these restrictions be removed?

2011-05-12 Thread Walter Dörwald
On 12.05.11 18:53, Walter Dörwald wrote:

> On 12.05.11 18:33, [email protected] wrote:
> 
>> A friend at work who is new to Python wondered why this didn't work with
>> pickle:
>>
>> class Outer:
>>
>> Class Inner:
>>
>> ...
>>
>> def __init__(self):
>> self.i = Outer.Inner()
>>
>> I explained:
>>
>>> http://docs.python.org/library/pickle.html#what-can-be-pickled-and-unpickled
>>>  
>>>
>>>
>>>  From that:
>>>
>>> # functions defined at the top level of a module
>>> # built-in functions defined at the top level of a module
>>> # classes that are defined at the top level of a module
>>
>> I've never questions this, but I wonder, is this a fundamental restriction
>> or could it be overcome with a modest amount of work?
> 
> This is related to http://bugs.python.org/issue633930

See also the thread started at:

   http://mail.python.org/pipermail/python-dev/2005-March/052454.html

Servus,
   Walter
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Could these restrictions be removed?

2011-05-12 Thread Antoine Pitrou
On Thu, 12 May 2011 11:33:37 -0500 (CDT)
Skip Montanaro  wrote:
> 
> A friend at work who is new to Python wondered why this didn't work with
> pickle:
> 
> class Outer:
> 
> Class Inner:
> 
> ...
> 
> def __init__(self):
> self.i = Outer.Inner()
> 
[...]
> 
> I've never questions this, but I wonder, is this a fundamental restriction
> or could it be overcome with a modest amount of work?

pickle uses heuristics to try to find out the "official name" of a
class or function. It would be a matter of improving these heuristics.

There are other cases in which pickle similarly fails:

>>> pickle.dumps(random.random)
b'\x80\x03crandom\nrandom\nq\x00.'
>>> pickle.dumps(random.randint)
Traceback (most recent call last):
  File "", line 1, in 
_pickle.PicklingError: Can't pickle : attribute lookup 
builtins.method failed

Regards

Antoine.


___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Could these restrictions be removed?

2011-05-12 Thread Walter Dörwald
On 12.05.11 18:33, [email protected] wrote:

> A friend at work who is new to Python wondered why this didn't work with
> pickle:
> 
> class Outer:
> 
> Class Inner:
> 
> ...
> 
> def __init__(self):
> self.i = Outer.Inner()
> 
> I explained:
> 
>> http://docs.python.org/library/pickle.html#what-can-be-pickled-and-unpickled 
>>
>>
>>  From that:
>>
>> # functions defined at the top level of a module
>> # built-in functions defined at the top level of a module
>> # classes that are defined at the top level of a module
> 
> I've never questions this, but I wonder, is this a fundamental restriction
> or could it be overcome with a modest amount of work?

This is related to http://bugs.python.org/issue633930

Servus,
   Walter
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com