From: Kevin B. <jyt...@sa...> - 2005-06-11 16:48:32
|
>From: Brian Zimmer <bz...@zi...> > >The correct way I think would be either to open >up the constructors for PyFile beyond those allowed >by Python the language > +1 >or force popen2 to create a >new file-like class which delegates appropriately. > > -1 Creating file-like objects from streams is a very generic thing to want to do, so pushing it out into individual modules is inappropriate. I find I often want to construct file objects from streams - but as the author of the popen support, I may be a bit biased. ;-) I always felt a little guilty using the PyFile constructors, so we should make sure we define the canonical idiom. I'd actually prefer having something other than "org.python.core.PyFile" as the interface - I'm not sure where it would belong, however... kb |
From: Updike, C. <Cla...@jh...> - 2005-06-11 20:07:25
|
I submitted a patch that is a partial fix: <http://sourceforge.net/tracker/index.php?func=3Ddetail&aid=3D1218893&gro= up_ id=3D12867&atid=3D312867> It lets you call PyFile constructors and file()=20 but not open(). Look at the patch comment for=20 full details. If open is made to be a true alias of file, and thus go through new_impl like file does, then I think it will be a solution. And the approach will probably work for other classes too. I'm not sure why open and file operate differently. Hopefully someone knows why. -Clark > -----Original Message----- > From: Frank Wierzbicki [mailto:fwi...@gm...]=20 > Sent: Saturday, June 11, 2005 11:15 AM > To: brian zimmer > Cc: Updike, Clark; JythonDevelopers > Subject: Re: [Jython-dev] PyFile constructors in jython >=20 >=20 > I'm hoping that many cases can be solved by replacing the non-public > calls with calls into basic java api's (like we did in javashell.py).=20 > However, I haven't really looked into the Jython Lib code enough to > know the extent of the problem. In cases where replacement with java > api calls is too hard I like the idea of having special keywords for > internal class constructors like (perhaps) "jinputstream" and > "jreader" for PyFile. Anyhow, I'll start looking for PyFile and > PyString calls in jythons Lib files. I'll start on the cases that can > be easily replaced with java api calls while we are deciding what to > do in the more difficult cases. >=20 > Frank >=20 > On 6/11/05, brian zimmer <bz...@zi...> wrote: > > I wasn't going to actively fix it but rather I wanted to > > figure out how we'd handle these situations going > > forward. It's likely that other code is using non-public > > Jython API. > >=20 > > brian >=20 |
From: Frank W. <fwi...@gm...> - 2005-06-13 13:11:06
|
Clark, I'm planning to go through jython's Lib and use your fix to unbreak some of the testcases tonight, unless you want to do that. Just trying to avoid duplicating efforts. Thanks, Frank On 6/11/05, Updike, Clark <Cla...@jh...> wrote: > I submitted a patch that is a partial fix: > <http://sourceforge.net/tracker/index.php?func=3Ddetail&aid=3D1218893&gro= up_ > id=3D12867&atid=3D312867> |
From: Updike, C. <Cla...@jh...> - 2005-06-12 01:56:02
|
The approach I used in the patch seems to be a much cleaner solution, unless I'm missing something here. That is is only a partial=20 solution is only because I didn't invest the time to figure out why open() doesn't go=20 through new_impl (which seems odd to me=20 that it doesn't). And then there's the open methods on the __builtin__ class which don't seem to get called at all=20 (what are they for?). Perhaps the design changed but wasn't cleaned up. -Clark -----Original Message----- From: Frank Wierzbicki [mailto:fwi...@gm...] Sent: Sat 6/11/2005 8:04 PM To: brian zimmer Cc: Updike, Clark; JythonDevelopers Subject: Re: PyFile constructors in jython =20 If we do decide to use the new keyword approach, what about adding the keyword "filewrapper" and use PyFile.FileWrapper (and its subclasses) for the various streams. This would keep us from needing a new keyword to support RandomAccessFile, the nio channel stuff etc. Then we could write code like fw =3D PyFile.InputStreamWrapper(inputstream) pf =3D file(filewrapper(fw)) Thoughts? Frank |
From: Frank W. <fwi...@gm...> - 2005-06-12 12:50:42
|
I personally prefer the keyword approach, though my reasons might be a little pedantic. The approach in the patch would allow this to pull in the inputstream and treat it as a file: filehandle =3D file(inputstream) This would be very convenient, but my feeling is that the 1st arg to file() is a string or string-like object that indicates the name of the file to load, Someday, I'd like to see staments like this pull a string out of the inputstream and use it to look up a file by that name. In other words, I would expect jython to use any first arg to file in the same way as Python programmers would expect. Making the first arg to file behave so differently depending on type feels more like java style instead of being python style. Just my $.02. Frank On 6/11/05, Updike, Clark <Cla...@jh...> wrote: > The approach I used in the patch seems to > be a much cleaner solution, unless I'm missing > something here. That is is only a partial > solution is only because I didn't invest the > time to figure out why open() doesn't go > through new_impl (which seems odd to me > that it doesn't). And then there's the > open methods on the __builtin__ class > which don't seem to get called at all > (what are they for?). Perhaps the design > changed but wasn't cleaned up. >=20 > -Clark |
From: Updike, C. <Cla...@jh...> - 2005-06-13 13:27:30
|
Have at it--I'll be working on a fix to PyArray.__repr__(). Thanks for coordinating. -Clark > -----Original Message----- > From: jyt...@li...=20 > [mailto:jyt...@li...] On Behalf Of=20 > Frank Wierzbicki > Sent: Monday, June 13, 2005 9:11 AM > To: Updike, Clark > Cc: brian zimmer; Kevin Butler; JythonDevelopers > Subject: Re: [Jython-dev] PyFile constructors in jython >=20 >=20 > Clark, >=20 > I'm planning to go through jython's Lib and use your fix to unbreak > some of the testcases tonight, unless you want to do that. Just > trying to avoid duplicating efforts. >=20 > Thanks, > Frank >=20 > On 6/11/05, Updike, Clark <Cla...@jh...> wrote: > > I submitted a patch that is a partial fix: > >=20 > <http://sourceforge.net/tracker/index.php?func=3Ddetail&aid=3D1218 893&group_ > id=3D12867&atid=3D312867> ------------------------------------------------------- This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput a projector? How fast can you ride your desk chair down the office luge track? If you want to score the big prize, get to know the little guy. =20 Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20 _______________________________________________ Jython-dev mailing list Jyt...@li... https://lists.sourceforge.net/lists/listinfo/jython-dev |