[email protected]
On Wed, Mar 23, 2005 at 06:39:41PM -0500, Fred L. Drake, Jr. wrote: > On Wednesday 23 March 2005 07:40, Oleg Broytmann wrote: > >While I'm working on webbrowser... Why do all graphical browsers are > > called with their stdout/stderr redirected to /dev/null? Do we really > > need to hide problems from the user? Browsers are usually silent beasts > > - they interact with the user using windows, not stdio. > > I don't remember why I did that I found one reason. For browsers that support remote commands the module runs two command - one to try to run the remote command, and another to run the browser in non-remote mode if the first command fails (there is no remote browser). If the remote command fails it reports the problem on stderr, but that's not an error from the module point of view, so the module hides it. But for the second command - browser + URL in non-remote mode - the module should not hide errors. I'll fix that. Oleg. -- Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED] Programmers don't die, they just GOSUB without RETURN. ___ 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] Re: webbrowser.py
On Wed, Mar 23, 2005 at 09:29:30PM +0300, Oleg Broytmann wrote: >I also added elinks support - currently it is very similar to links, > but I am going to extend its remote capabilities. (Yes, that small > text-mode broswer supports remoting, windows and tabs! Who'd think?!.) >Also I'm going to add "new-tab" support similar to "new-window" for > Mozilla/Firefox and elinks. I've reworked the patch once more. I moved some common functionality into the UnixBrowser class and added two new features - Elinks launcher class (elinks supports remote commands in a manner very similar to Mozilla) and new-tab functionality for browsers that support tabbed browsing (Mozilla and elinks); a user can now run "webbrowser -t URL" to open the URL a new tab. All classes in the module are now new-style classes (except for the Error class). All .open() methods accept "new" parameter: 0 - open the url in the same window, 1 - open in a new window (0 and 1 codes works as before), and new code 2 - open in a new tab if possible. These are probably the last features I wanted to add to the module. Oleg. -- Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED] Programmers don't die, they just GOSUB without RETURN. ___ 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] Shorthand for lambda
On Wed, 23 Mar 2005 10:33:53 -0600 (CST), Ka-Ping Yee <[EMAIL PROTECTED]> wrote: > Hey folks, > > >>> from placeholder import _ > >>> numbers = [5, 9, 56, 34, 1, 24, 37, 89] > >>> filter(_ < 30, numbers) > [5, 9, 1, 24] > >>> map(_ + 10, numbers) > [15, 19, 66, 44, 11, 34, 47, 99] > >>> > > Look ma, no lambdas! > > I bet someone has already done this before, right? > I tried it once before: ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/local-distfiles/perky/anonfunc-1.0.tar.gz >>> from anonfunc import * >>> f = (arg0 * arg1 + 3 * arg2) ** 2 >>> f(5, 6, 7) 2601 >>> f = kw1 and kw2 >>> f(kw1=False, kw2=True) True >>> f(kw2=False, kw1=True) False But there were some serious drawbacks to use it instead of lambda. * (a,b,c) is impossible * unable to use it with list comprehensions and generator expressions * can't call functions and use its return value * and many builtin functions as you described (such as len(), sorted()) Hye-Shik ___ 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] Re: webbrowser.py
On Thu, 24 Mar 2005 16:30:35 +0300 Oleg Broytmann <[EMAIL PROTECTED]> wrote: >I've reworked the patch once more. I moved some common functionality > into the UnixBrowser class and added two new features ... I do not want to abuse your generosity. However, if you could make the necessary changes to the documentation, since it will be easier to you than anyone else right know, I'll gladly check the consistency between code and docs. tchau, Senra -- Rodrigo Senra rsenra _at_ acm _dot_ org http://www.ic.unicamp.br/~921234 ___ 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] Re: webbrowser.py
On Thu, Mar 24, 2005 at 11:11:11AM -0300, Rodrigo Dias Arruda Senra wrote: > However, if you could make the necessary changes to the documentation, I'll try, but certainly not in TeX format... Oleg. -- Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED] Programmers don't die, they just GOSUB without RETURN. ___ 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] Re: webbrowser.py
On Thu, 24 Mar 2005 17:13:30 +0300 Oleg Broytmann <[EMAIL PROTECTED]> wrote: > On Thu, Mar 24, 2005 at 11:11:11AM -0300, Rodrigo Dias Arruda Senra wrote: > > However, if you could make the necessary changes to the documentation, > >I'll try, but certainly not in TeX format... Edit libwebbrowser.tex as you see fit, then send it to me and I'll TeXify it back to you. tchau, Rod -- Rodrigo Senra MSc Computer Engineer [EMAIL PROTECTED] GPr Sistemas Ltda http://www.gpr.com.br ___ 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] C API for the bool type?
On Monday 21 March 2005 04:54, Bo Thorsen wrote: > If this is not the correct place to post this problem, I apologize. In > that case, please be gentle and point me to a better mailing list. You should be able to get answers to this kind of question on comp.lang.python (aka python-list at python.org). But I'll give you this one for free. :-) > I'm coding a text editor in Qt that uses Python for macros. The problem I > have is that want to use the bool type introduced in 2.3, but I can't see > how to do this. On http://docs.python.org/api/arg-parsing.html the format > units are described, but no bool is there. There is no format character for boolean, and you don't actually need one. Recall that in Python, all objects have some interpretation as a truth value. The easiest way to check this from C code is to pass the object to PyObject_IsTrue() or PyObject_Not() (depending on the sense of the test you want, and how you want your code to read). The argument can be retrieved in your PyArg_ParseTuple*() call using the "O" format character. > If it doesn't exist, I guess I should use the int format unit and call the > http://docs.python.org/api/boolObjects.html functions to see if this is > actually a bool or not? In most cases, you really don't care if the object is actually a bool. The recipe above will also work in older versions of Python. That lets you use bools for the reason they were really introduced: to enhance readability. -Fred -- Fred L. Drake, Jr. ___ 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] @decoration of classes
Josiah Carlson: > I just noticed that decoration of classes was not included with the > @decoration syntax that made it into Python 2.4. ... > Is the fact that it didn't make it into 2.4 due to a pronouncement Yes, but it wasn't a permanent decision, and I don't think he used the magic word "pronounce". Adding class decoration later is not difficult. Retracting class decoration later would have been impossible. Therefore Guido decided for version 2.4, but left the question open for the unspecified future. Changing it would take arguments stronger than symmetry or "why not?", so it probably won't change for 2.5, but if you have a compelling use case ... (Mine have all been using an object as a callable -- basically replacing a function. The itch hasn't been strong enough to bother me.) -jJ ___ 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] @decoration of classes
Jim Jewett <[EMAIL PROTECTED]> wrote: > > Josiah Carlson: > > > I just noticed that decoration of classes was not included with the > > @decoration syntax that made it into Python 2.4. ... > > > Is the fact that it didn't make it into 2.4 due to a pronouncement > > Yes, but it wasn't a permanent decision, and I don't think > he used the magic word "pronounce". > > Adding class decoration later is not difficult. > > Retracting class decoration later would have been impossible. > > Therefore Guido decided for version 2.4, but left the question > open for the unspecified future. Changing it would take > arguments stronger than symmetry or "why not?", so it > probably won't change for 2.5, but if you have a compelling > use case ... > > (Mine have all been using an object as a callable -- basically > replacing a function. The itch hasn't been strong enough to > bother me.) I think of it like this; I learned restructured text because I wanted to learn a markup for writing things that didn't encumber the writing. At a certain point, it became necessary for me to learn TeX. Does that mean that reST has no use to me now that I know TeX? Of course not, reST still has its place, and when I write documentation, I write it in reST. When I begin to write academic papers, I write it in reST, then later translate it to TeX, because that is the language of typeset academic writings. I could write it first in TeX, but the notation can get cumbersome, and reST is still valid (whether or not it survives the decade; I still have the source, a python interpreter, and an emulator). While I have not used it often, I have done the equivalent of decorating classes; it is as natural (though perhaps not quite as useful initially) as decorating functions, and as simple as writing in reST. I also happen to know a bit about using metaclasses, though tend to shy away from it, because it feels cumbersome. Can you do everything with TeX that you can with reST? Of course. Does it make reST any less valid or desireable to use? Of course not. Can you use a metaclass to do anything you could do with class decorators? Probably (I don't know the corner cases that would make it not so). Does that mean that class decoration is any less valid or desireable to use? Of course not. Does that mean that it should have a syntax? That is the question. I personally choose class decoration over metaclasses (when possible) because I feel it is easier to use. However, as my use case has not been compelling enough in the past, I is certainly not compelling enough now. If someone cares more about this, who has more influence and wants to continue the conversation; feel free, but I'll still use Python tomorrow without class decoration syntax. - Josiah P.S. You know, it's kind of like putting sprinkles on a banana split. Some people like the sprinkles, some people don't. Some people complain when they are there, some people can't eat it without the sprinkles. But you know what? You've got the banana split already, enjoy it. If you get the sprinkles, so be it, but hassling the waitress for sprinkles is a pretty rude thing to do to a woman in an ice cream parlor. ___ 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
