Hi ironpython,

Here's your Daily Digest of new issues for project "IronPython".

In today's digest:ISSUES

1. [New issue] Strange inconsistency between CPython and IronPython regarding 
zip file reading
2. [New comment] ScriptScope.ContainsVariable throws MissingMemberException 
internally
3. [New comment] ScriptScope.ContainsVariable throws MissingMemberException 
internally
4. [New comment] ScriptScope.ContainsVariable throws MissingMemberException 
internally

----------------------------------------------

ISSUES

1. [New issue] Strange inconsistency between CPython and IronPython regarding 
zip file reading
http://ironpython.codeplex.com/workitem/32570
User Markell has proposed the issue:

"http://stackoverflow.com/questions/10123422/strange-inconsistency-between-cpython-and-ironpython-regarding-zip-file-reading

In short:
PS Z:\dev\poc\SDR> ipy64
IronPython 2.7.1 (2.7.0.40) on .NET 4.0.30319.225
Type "help", "copyright", "credits" or "license" for more information.
>>> from zipfile import ZipFile
>>> z=ZipFile('d:/aaa.zip')
>>> input=z.open(z.namelist()[0])
>>> next(input)
b'aaa,bbb\n'
>>> next(input)
'123,456\n'
>>>

Notice the difference in output between the first (aaa,bbb) and the second 
(123,456) lines."-----------------

2. [New comment] ScriptScope.ContainsVariable throws MissingMemberException 
internally
http://ironpython.codeplex.com/workitem/32530
User rumzeus has commented on the issue:

"Attached file ScriptHostContainsVariableMissingMemberException.cs is a very 
simple console application that demonstrates the issue. (When run in Visual 
Studio Debug mode with debugger attached.)

> so it's not completely crazy. :) 
It's not completely crazy, but I guess the CPython world has different accepted 
conventions than the .NET world. And the respective tools are suited more or 
less to code in these accepted conventions. So for IronPython it might be 
preferable to use conventions that work well with the .NET tools (like the 
Visual Studio debugger).

Python Documentation Glossary
http://docs.python.org/release/3.0/glossary.html#term-eafp
"EAFP
    Easier to ask for forgiveness than permission. This common Python coding 
style assumes the existence of valid keys or attributes and catches exceptions 
if the assumption proves false. This clean and fast style is characterized by 
the presence of many try and except statements. The technique contrasts with 
the LBYL style common to many other languages such as C."

vs.

.NET Design Guidelines for Exceptions
http://msdn.microsoft.com/en-us/library/ms229030.aspx
"Do not use exceptions for normal flow of control, if possible. Except for 
system failures and operations with potential race conditions, framework 
designers should design APIs so that users can write code that does not throw 
exceptions. For example, you can provide a way to check preconditions before 
calling a member so that users can write code that does not throw 
exceptions.""-----------------

3. [New comment] ScriptScope.ContainsVariable throws MissingMemberException 
internally
http://ironpython.codeplex.com/workitem/32530
User KeithJRome has commented on the issue:

"One more thought I had is that (I think) you could use one of the other 
overloads of CreateScope() that allows you to provide the storage medium and 
just bypass all of the IDMOP plumbing.

For example, you could have your own instance of a IDictionary<string, object> 
and pass that to the proper CreateScope() method. IronPython should be fine 
with this as far as I know, and your original reference to the IDictionary 
should still be valid too. So you can directly access Keys and Values as well 
as the indexer of the dictionary without going through any callsite or other 
dynamic dispatching.

At least, I believe that statement to be correct. I haven't actually tried it. 
Wouldn't this be viable?

  var storage = new Dictionary<string, object>();
  var scope = engine.CreateScope(storage);
  // .... use the scope to execute a script...
  var hasMember = storage.ContainsKey("foo");

Or is this just how the scope storage mechanism works?
"-----------------

4. [New comment] ScriptScope.ContainsVariable throws MissingMemberException 
internally
http://ironpython.codeplex.com/workitem/32530
User KeithJRome has commented on the issue:

"Actually, I just tried that and it indeed seems to work as expected and allows 
you to interrogate the scope directly through the static-typed IDictionary 
interface.

Of course, this might not be usable for all situations, but I am not sure what 
those cases might be.

I attached an amended copy of your sample to demonstrate. Does this solve the 
issues at hand?"
----------------------------------------------



----------------------------------------------
You are receiving this email because you subscribed to notifications on 
CodePlex.

To report a bug, request a feature, or add a comment, visit IronPython Issue 
Tracker. You can unsubscribe or change your issue notification settings on 
CodePlex.com.
_______________________________________________
Ironpython-users mailing list
Ironpython-users@python.org
http://mail.python.org/mailman/listinfo/ironpython-users

Reply via email to