Re: python equivalent to access reports
"flupke" <[EMAIL PROTECTED]> a écrit dans le message de news:[EMAIL PROTECTED] > a lot of applications here a made with access. Tables, forms, reports > and the like. Now i rather use Python to do this but i'm not sure how to > proceed. I can use wxPython for a gui via wxGlade for rapid testing and > design (forms), MySQL as db (tables) but the report part is what's > bothering me. > > Any other ideas? Hello, You can use wxwindows (http://www.wxpython.org/) which have some very nice report classes. If you want to know more, you just have to download and try the demo. ++jm -- http://mail.python.org/mailman/listinfo/python-list
Re: goto, cls, wait commands
Harlin wrote: > No goto needed. If this makes no sense (which it may not if all you've > been exposed to is BASIC) it wouldn't be a bad idea to Google why you > should never use a goto statement. "GOTO" isn't even needed in QBasic (except for "ON ERROR GOTO"). -- http://mail.python.org/mailman/listinfo/python-list
Re: goto, cls, wait commands
"BOOGIEMAN" <[EMAIL PROTECTED]> a écrit dans le message de news:[EMAIL PROTECTED] > I've just finished reading Python turtorial for non-programmers > and I haven't found there anything about some usefull commands I used in > QBasic. First of all, what's Python command equivalent to QBasic's "goto" ? > Secondly, how do I clear screen (cls) from text and other content ? > And last, how do I put program to wait certain amount of seconds ? > If I remeber correctly I used to type "Wait 10" and QBasic waits > 10 seconds before proceeding to next command. Hi all, I saw a lot of comments saying GOTO is not usefull, very bad, and we should'nt use it because we don't need it. I think that's true, but only if you *create* programs. But if the goal is to provide some kind of converter to automatically take an old application written with an old language (using GOTO), and generating python code, it would certainly a great help to have this (unclean) feature in native python. Best regards jm -- http://mail.python.org/mailman/listinfo/python-list
Re: PyINI : Cross-Platform INI parser
SeSe wrote: > hi, every one, > > I started a opensource project PyINI for corss-platform *.ini parsing > at http://sourceforge.net/projects/pyini/ > > I have released a simple alpha version, which can read *.ini, with > some extended features such as "key=value1,value2,value3". I also > made a c++ binding to PyINI with elmer toolkit. The most useful feature would be to be able to write INI files back without affecting their formatting, without removing user commands, etc. This is what Windows APIs do, and it is what I am missing from most INI parsing libraries out there. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list
Re: OT: Anyone want a GMail account?
[Chris] > I've got 50 so if you want a GMail invite reply directly to me and > I'll send our an invite. You can share your GMail invites here: http://isnoop.net/gmailomatic.php "This page offers a place for people with Gmail invites and those who want them to come together with minimal effort and fuss. Currently, we have 1,500,443 invites available to share. Thanks to the generosity of folks like you, we've distributed 248,204 invites since this page went up on Sep 13, 2004." Hitting Reload a couple of times, they seem to be accumulating and distributing several invites per second. Shame it's written in PHP 8-) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: PyINI : Cross-Platform INI parser
Hello, > I started a opensource project PyINI for corss-platform *.ini parsing at > http://sourceforge.net/projects/pyini/ How it is different from http://docs.python.org/lib/module-ConfigParser.html? Dalius -- http://mail.python.org/mailman/listinfo/python-list
Re: lambda and for that matter goto not forgetting sugar
[Christos] > *Three* requests --check the thread "goto, cls, wait commands". I saw that too, and was too freaked out to respond. > BTW, my sincere congratulations for what I presume best computer related > April's > Fool joke of all time; I love double-bluffs. The worst of all is I've often > referenced your joke when advocating python... :) Thanks! I think the fact that it was possible at all is a *genuine* advert for Python's power and flexibility. (Though modifying Python itself in order to make the joke possible was quite a lot of work: http://sf.net/tracker/?func=detail&atid=305470&aid=643835&group_id=5470 8-) [John] > from goto.py ( http://entrian.com/goto/ ): > .# Label: "label .x" XXX Computed labels. > > :-) Yay! I've been waiting nearly a year for someone to spot that. 8-) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: sre is broken in SuSE 9.2
On 10 Feb 2005 11:49:33 -0800 "Serge Orlov" <[EMAIL PROTECTED]> wrote: > This thread is about problems only with LANG=C or LANG=POSIX, it's not > about other locales. Other locales are working as expected. You are not right. I have LANG=de_DE.UTF-8, and the Python test_re.py doesn't pass. $LANG doesn't matter if I don't call setlocale. Fortunately setting any non-C locale solves the problem for all (I believe) unicode character: >>> re.compile(ur'\w+', re.U).findall(u'\xb5\xba\xe4\u0430') [u'\xb5\xba\xe4\u0430'] -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list
Re: passing arguments like -JOB
Thanks...it worked perfectly. Brilliant!! JL Duncan Booth <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > John Leslie wrote: > > > I am porting a script from Korn Shell to python and want to pass named > > parameters like -JOB 123456 -DIR mydir > > > > I can get it to work passing --JOB and --DIR but not -JOB and -DIR > > > > Any ideas? > > > Unfortunately (for you), I think you will find most or all of the existing > ways to parse command line options in Python follow the POSIX convention > for arguments, i.e. single letter options are introduced with a single - > and multi-letter options are introduced with --. > > My guess is that if you can't change whatever generates the command lines > to conform to this convention you will have to write your own code to do > the processing. > > Alternatively you might get by by hacking the command line in your Python > code: > >for i, opt in enumerate(sys.argv): >if opt in ('-JOB','-DIR', '-ERR', '-GRP', '-TST', '-JNM', '-DAT'): > sys.argv[i] = '-'+opt > >... and then use getopt or optparse here ... > > It isn't pretty, but so long as those values don't turn up elsewhere in the > command line it ought to work. -- http://mail.python.org/mailman/listinfo/python-list
Re: PyINI : Cross-Platform INI parser
"Giovanni Bajo" <[EMAIL PROTECTED]> writes: > SeSe wrote: > >> hi, every one, >> >> I started a opensource project PyINI for corss-platform *.ini parsing >> at http://sourceforge.net/projects/pyini/ >> >> I have released a simple alpha version, which can read *.ini, with >> some extended features such as "key=value1,value2,value3". I also >> made a c++ binding to PyINI with elmer toolkit. > > > The most useful feature would be to be able to write INI files back without > affecting their formatting, without removing user commands, etc. This is what > Windows APIs do, and it is what I am missing from most INI parsing libraries > out there. You can easily access the windows apis either with pywin32, or with ctypes for those functions that aren't wrapped in pywin32. Thomas -- http://mail.python.org/mailman/listinfo/python-list
Python in Makefile Question
Hello, I'd like to ask a question concerning a python script in a makefile. Suppose I have a C++ project (sorry for raising this in a Python newsgroup), with some makefile for it. Before compiling the code, I'd like to check that there are no C++ convention violations (e.g., identifiers beginning with an underscore). So my makefile looks something like this: target: ... verify.py $(CC) ... verify.py is a python script that checks for convention violations, i.e., its first line is #! /usr/bin/env python I can't figure out the following: 1. How can I get the python script to return a value to make, so that if it decides that there are convention violations make will fail? 2. How can I pass information from the makefile to the python script, e.g., the base directory to check? Thanks, Efrat -- http://mail.python.org/mailman/listinfo/python-list
Re: [N00B] What's %?
[EMAIL PROTECTED] (administrata) wrote in message news:<[EMAIL PROTECTED]>... > Hi! it's been about a week learning python! > I've read 'python programming for the absolute begginer' > I don't understand about % like... > > 107 % 4 = 3 > 7 % 3 = 1 > > I'm confused with division :/ > Please help me... > > thx 4 reading. sry, i don't know much about maths What is % used for? such as? -- http://mail.python.org/mailman/listinfo/python-list
Re: [N00B] What's %?
administrata wrote: sry, i don't know much about maths What is % used for? such as? Among many other things, you can use it to test whether one integer evenly divides another integer. For example, to test if a number is odd: def isodd(x): return bool(x % 2) -- Robert Kern [EMAIL PROTECTED] "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter -- http://mail.python.org/mailman/listinfo/python-list
Re: PyINI : Cross-Platform INI parser
Giovanni Bajo wrote: > SeSe wrote: > > > hi, every one, > > > > I started a opensource project PyINI for corss-platform *.ini parsing > > at http://sourceforge.net/projects/pyini/ > > > > I have released a simple alpha version, which can read *.ini, with > > some extended features such as "key=value1,value2,value3". I also > > made a c++ binding to PyINI with elmer toolkit. > > > The most useful feature would be to be able to write INI files back without > affecting their formatting, without removing user commands, etc. This is what > Windows APIs do, and it is what I am missing from most INI parsing libraries > out there. > -- > Giovanni Bajo ConfigObj easily writes back, files but doesn't *yet* support the full 'ini' file spec (empty values and split lines it doesn't yet support). These are targetted for next release. What aspects of formatting do you want to keep, and I'll try and include them ? http://www.voidspace.org.uk/python/configobj.html Regards, Fuzzy http://www.voidspace.org.uk/python/index.shtml -- http://mail.python.org/mailman/listinfo/python-list
Re: pyFMOD writing a callback function in Python
Hi, I was only able to find fmodapi374.zip (for windows), and that version doesn't > seem to work with the pyFMOD release I found. I found that too. But I could easily fix pyFMOD to use the FMOD 374. A few of the exports have been renamed and parameters have been added to others. As the total size of all parameters are encoded in the exported names all of these errors are caught when importing so you can fix them one by one by looking it up in the FMOD-Docs. All in all, it should look similar (I can't test it!) to this code: I will try that when I get around to playing with the stuff again. You should also be aware that you have to keep the callback_function object alive *as long as the FMOD library is using it*! While very obvious I am prone to forget that sometime :-). Ciao, MM -- Marian Aldenhövel, Rosenhain 23, 53123 Bonn. +49 228 624013. http://www.marian-aldenhoevel.de "Wir brauchen keine Opposition, wir sind bereits Demokraten." -- http://mail.python.org/mailman/listinfo/python-list
Re: [perl-python] combinatorics fun
YYUsenet wrote: Xah Lee wrote: (snip insanities) Why are you posting this to comp.lang.python? This obviously has nothing to do with python at all. If you are trying to teach people python, claiming that "...let's do a python version. I'll post my version later today." Isn't really the proper way to do it. An even better method would be to set up a website dedicated to nothing but it, and stop posting here with garbage code that no one wants to read, and that helps no one. Please, consider others a little bit when you go off on your wild hope that you might be able to teach other people what you obviously know nothing about, teaching people from a language that you know nothing about. *PLEASE STOP POSTING*!! *NOBODY WANTS YOU TO POST*!! The guy is an obvious, well-known and self-proclaimed troll. Dont feed the troll. -- bruno desthuilliers ruby -e "print '[EMAIL PROTECTED]'.split('@').collect{|p| p.split('.').collect{|w| w.reverse}.join('.')}.join('@')" -- -- http://mail.python.org/mailman/listinfo/python-list
Re: PyINI : Cross-Platform INI parser
SeSe schrieb: I started a opensource project PyINI for corss-platform *.ini parsing at http://sourceforge.net/projects/pyini/ I have released a simple alpha version, which can read *.ini, with some extended features such as "key=value1,value2,value3". I also made a c++ binding to PyINI with elmer toolkit. I suggest that you have a look at Tim Daneliuk's tconfpy serving a similar purpose. Perhaps you can join forces. I'd like to see a configuration tool that for Python programmers is as easy as config.py, i.e. you you have config object and can write/read it to/from some storage, e.g. - .ini files - Java config files - xml files - LDAP server - win32 registry - ... It would be nice to make this not a Python only thing but accessible by other languages like Perl, Ruby, Java, C/C++ ... I think that a new config utility is worth the effort if it has the potential to put an end to roll-your-own config formats and parsers. -- --- Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0 E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64') --- -- http://mail.python.org/mailman/listinfo/python-list
Re: namespaces module (a.k.a. bunch, struct, generic object, etc.) PEP
BJörn Lindqvist wrote: I like it alot! My only minor complaint is that the name is to long. Also I *really wish* the Namespace could do this: r, g, b = col = Namespace(r = 4, g = 3, b = 12) But alas, I guess that's not doable within the scope of the Namespace PEP. You can almost spell that already, it just won't do what you want: r, g, b = col = dict(r = 4, g = 3, b = 12).values() The dict-based implementation means named tuples they ain't :) However, the namespaces module *would* provide a natural location for a NamedTuple class. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list
Testing web applications
Hi, I'm looking for frameworks to make testing web applications - i.e. parsing and filling out forms - easier. I found Puffin, which looks good but not very usable in the current state. I know that I once read about other nice frameworks, but could not find one via google. Any hints? regards, Achim -- http://mail.python.org/mailman/listinfo/python-list
Re: Python in Makefile Question
Efrat Regev wrote: > Hello, > > I'd like to ask a question concerning a python script in a makefile. > Suppose I have a C++ project (sorry for raising this in a Python newsgroup), > with some makefile for it. Before compiling the code, I'd like to check that > there are no C++ convention violations (e.g., identifiers beginning with an > underscore). So my makefile looks something like this: > > target: ... > verify.py > $(CC) ... > > verify.py is a python script that checks for convention violations, i.e., > its first line is > > #! /usr/bin/env python > > I can't figure out the following: > 1. How can I get the python script to return a value to make, so that if it > decides that there are convention violations make will fail? raise SystemExit(1) > 2. How can I pass information from the makefile to the python script, e.g., > the base directory to check? Use command-line arguments. The Python equivalent of "argv" is "sys.argv". -- http://mail.python.org/mailman/listinfo/python-list
Re: Python in Makefile Question
Efrat Regev wrote: 1. How can I get the python script to return a value to make, so that if it decides that there are convention violations make will fail? You can set the return code of your Python script through sys.exit (3) 2. How can I pass information from the makefile to the python script, e.g., the base directory to check? Python side: Commandline arguments can be read through the list sys.argv. Parsing of commandline options can be done with the module optparse. Makefile side: I don't know if there is a special variable in GNU make for the directory of the current target. Why don't you set the default for the directory option to the current directory? Most Makefiles won't work anyway if they are called from a different directory. Daniel -- http://mail.python.org/mailman/listinfo/python-list
Re: lambda and for that matter goto not forgetting sugar
Nick Coghlan wrote: > Anyway, check out AlternateLambdaSyntax on the python.org Wiki It's an interesting page: http://www.python.org/moin/AlternateLambdaSyntax Some days ago I suggested something different: maybe def can become a function, then it can work as lambda (and still as the old def) too. Something like: original : lambda a, b, c:f(a) + o(b) - o(c) lambda x: x * x lambda : x lambda *a, **k: x.bar(*a, **k) ==> def(a, b, c): return f(a) + o(b) - o(c) fun1 = def(x): return x * x def(): return x def(*a, **k): return x.bar(*a, **k) Such def can be used as the lambda inside expressions too. fun1 = def(a, b, c): return f(a) + o(b) - o(c) This is the same as the old: def fun1(a, b, c): return f(a) + o(b) - o(c) (That use of "return" in the middle is a little verbose to use it for functions inside expressions.) That Ruby syntax at the end of page is cute. {a,b,c | return f(a) + o(b) - o(c)} {a,b,c | f(a) + o(b) - o(c)} def(a, b, c | f(a) + o(b) - o(c) ) fun(a, b, c | f(a) + o(b) - o(c) ) (etc. there are lots of other possibilities). If def becomes a function like that, then beside this syntax: fun1 = def(a, b, c): return f(a) + o(b) - o(c) This other one can be interesting for expressions only: def(a, b, c | f(a) + o(b) - o(c) ) (Both can be acceptable at the same time). Bye, Bearophile -- http://mail.python.org/mailman/listinfo/python-list
Re: namespaces module (a.k.a. bunch, struct, generic object, etc.) PEP
Jeremy Bowers <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > On Thu, 10 Feb 2005 11:56:45 -0700, Steven Bethard wrote: > > > In the "empty classes as c structs?" thread, we've been talking in some > > detail about my proposed "generic objects" PEP. Based on a number of > > suggestions, I'm thinking more and more that instead of a single > > collections type, I should be proposing a new "namespaces" module instead. > > Context: I've never been excited by this proposal. > > But I am intrigued to note that with a couple of differences, you've now > converged on a module I've already written for my own use, which I called > a Registry. I actually subclassed 'dict', added some methods to use > dotted-access as you describe, and added some methods for accessing and > initializing a deeper key (basically a "get" that can handle hierarchy) > and a couple of other things. > > There are worse things for application config storing than a pickled > Namespace. (Not human readable, but if you don't care about that, as I > generally don't, it's close to usable.) FWIW, you can count me about the people who (re)wrote this same thing (actually with some difference, since I wanted to keep the order, so I used nested lists instead of nested dictionaries, but the idea was similar). I would welcome some module in the standard library to store hierarchical data. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list
Re: convert list of tuples into several lists
Peter Hansen wrote: Is there some unexpected limit to the number of arguments that may be passed with the *args format (say, "256 function arguments maximum are supported by Python"), or is this concern just because of the raw memory inherently used by the tuple? In other words, if one is confident that one can whip tuples of the required size around without using up available memory, would there still be such a concern about the *args "abuse"? I'm not aware of any arbitrary limits in that code, since it does pass real tuple objects around. Then again, it's not an area of the code I'm particularly familiar with. . . However, if there was a limit other than the amount of available memory though, I expect Guido would have said so explicitly. As it is, the concern seems to be that there is a potentially large copy operation triggered by an innocent looking function call. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and version control
On Thu, 10 Feb 2005 23:03:43 +, Alan Kennedy <[EMAIL PROTECTED]> wrote: > In my circles, VSS is most often referred to as Visual Source Unsafe. I always find it amusing that VSS's icon is a safe - with the door wide open. -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/mailman/listinfo/python-list
Multi-Platform installer generator
Hello list, On windows my company uses Inno Setup to generate installers for our products, and on Linux we usually use a simple shell script, but we would like to use the same installer generator for both platforms. Searching google turned up some multi-platform installers (mostly in Java), but I gather that they require a Java VM installed in the target system, and that is undesirable for us, since most system don't come with a Java VM ready (or am I completely wrong in this aspect?). So does anyone know if a multi-platform installer generator, that generates installers with GUI and has no requirements on the target system, exists? Best Regards, Nicodemus. -- http://mail.python.org/mailman/listinfo/python-list
Re: Testing web applications
Hi Achim, I'm looking for frameworks to make testing web applications - i.e. parsing and filling out forms - easier. I found Puffin, which looks good but not very usable in the current state. I know that I once read about other nice frameworks, but could not find one via google. Any hints? Zope + Formulator is a nice combination to validating and designing forms and add some functionality. If you want a more complicated content management framework, then you can additionally install plain CMF or Plone, which is based on CMF. There is also something called Silva, but it doesn't have many products as the other two; however, it is also nice. I have heard also about CherryPy, Quixote, Twisted Matrix and Webware, but I haven't tested them. Once I saw that somebody posted a link, which compares some of them, but I lost that thread :-( Regards, Josef -- http://mail.python.org/mailman/listinfo/python-list
Re: Python in Makefile Question
"Efrat Regev" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > I'd like to ask a question concerning a python script in a makefile. > ... Many thanks for the very useful (and very quick) answers! Efrat -- http://mail.python.org/mailman/listinfo/python-list
Re: Testing web applications
Zope + Formulator is a nice combination to validating and designing forms and add some functionality. If you want a more complicated content management framework, then you can additionally install plain CMF or Plone, which is based on CMF. There is also something called Silva, but it doesn't have many products as the other two; however, it is also nice. I have heard also about CherryPy, Quixote, Twisted Matrix and Webware, but I haven't tested them. Once I saw that somebody posted a link, which compares some of them, but I lost that thread :-( I found it: http://www.cmsmatrix.org/ -- http://mail.python.org/mailman/listinfo/python-list
Re: deepcopy chokes with TypeError on dynamically assigned instance method
Kanenas wrote: On Thu, 10 Feb 2005 00:54:04 -0800, Kanenas wrote: When an instance has a dynamically assigned instance method, deepcopy throws a TypeError with the message "TypeError: instancemethod expected at least 2 arguments, got 0". I forgot to mention that the TypeError is thrown only when constructing an instance from another instance in the same class, e.g. Foo('bar') is fine but Foo(Foo('bar')) will fail. Interesting. The problem appears to be that bound methods are not copyable: >>> x = Foo('bar') >>> x Foo([b,a,r]) >>> x.bar >>> copy(x.bar) Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\lib\copy.py", line 95, in copy return _reconstruct(x, rv, 0) File "C:\Python24\lib\copy.py", line 320, in _reconstruct y = callable(*args) File "C:\Python24\lib\copy_reg.py", line 92, in __newobj__ return cls.__new__(cls, *args) TypeError: instancemethod expected at least 2 arguments, got 0 >>> x.__repr__ >>> copy(x.__repr__) Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\lib\copy.py", line 95, in copy return _reconstruct(x, rv, 0) File "C:\Python24\lib\copy.py", line 320, in _reconstruct y = callable(*args) File "C:\Python24\lib\copy_reg.py", line 92, in __newobj__ return cls.__new__(cls, *args) TypeError: instancemethod expected at least 2 arguments, got 0 Normally, the methods live in the class dictionary, so they don't cause a problem with copying the instance. It turns out this exception actually makes sense, since you *don't* want to copy these atributes to the new instance. If you actually copied them, they'd be bound to the *old* instance, rather than the new one. So I expect you'll need to provide a __deepcopy__ in order to correctly generate the instancemethods bound to the new instance. I also realised that the reason the use of a mutable default is OK here is because you're deepcopying it. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt documentation
> The docs of the Riverbank site is poor, and I have found separate > tutorials on the net. > > I know that the Kompany have made a "Qtdoc"-like to PyQt. But it is not > free doc. You can use the qt c++ doc from trolltech. The pyqt bindings are so close to the original that you usually can simply use that. Additionally, there is a book from boudewijn rempt about coding in python+qt which is for qt2, but it covers all the signal slot basics and is completely available online. > > Does anybody know anything about any project for making PyQt > development more easy? There is an python-based ide which has the same name as your first name - try that. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list
[NooB] Using Escape Sesquences with Strings...
Hello! :) I've reading 'Python Programmin for the Absolute beginner'. I got questions which is... print "\t - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " rock = """ Igneous Sedimentary Metamorphic Lava Grains Marble Ramdom crystals LayerBands Granite Salt Schist IntrusiveWeathering Heat + Pressure Deposition Change""" print \trock print "\t - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " error occurs! I don't know how to \t The variable. Help! -- http://mail.python.org/mailman/listinfo/python-list
Re: Unit Testing in Python
> put it) PyUnit project. I'm sorry if this is a obvious question or one > that has already been answered, but unit-testing sounds interesting and > I'm not sure where to start. Hi Ryan. I belive this (http://www.xp123.com/xplor/xp0201/index.shtml) is a good way to learn about unit testing by practice if you already know the basics of it. It is written in Java but is easy to translate to Python. Unittesting really is great in Python, I try to use it for anything but simple and dirty hacks. -- mvh Björn -- http://mail.python.org/mailman/listinfo/python-list
Re: [NooB] Using Escape Sesquences with Strings...
administrata wrote: > print \trock Your problem lies in this line. The escape sequence \t is not a variable, so to speak. It is just that, an escape sequence, so it must be located inside of a string: print "\t" + rock -- Daniel Bickett dbickett at gmail.com http://heureusement.org/ -- http://mail.python.org/mailman/listinfo/python-list
Re: namespaces module (a.k.a. bunch, struct, generic object, etc.) PEP
Steven Bethard wrote: In the "empty classes as c structs?" thread, we've been talking in some detail about my proposed "generic objects" PEP. Based on a number of suggestions, I'm thinking more and more that instead of a single collections type, I should be proposing a new "namespaces" module instead. Some of my reasons: (1) Namespace is feeling less and less like a collection to me. Even though it's still intended as a data-only structure, the use cases seem pretty distinct from other collections. Particularly since the collections module is billed as a location for purpose-specific optimised data structures where some general-purpose features have been dropped in order to make other aspects faster. All the ideas here relate to conveniently manipulating namespaces, and are independent enough to make sense as separate classes. I think a new module is a good call. It also allows a Python implementation :) >>> ns = Namespace(eggs=1) >>> Namespace.update(ns, [('spam', 2)], ham=3) >>> ns Namespace(eggs=1, ham=3, spam=2) Note that update should be used through the class, not through the instances, to avoid the confusion that might arise if an 'update' attribute added to a Namespace instance hid the update method. I'd like to see the PEP text itself encourage the more inheritance friendly style used in the __init__ method: type(ns).update(ns, [('spam', 2)], ham=3) Accessing the class directly means that you may get incorrect behaviour if ns is actually an instance of a subclass of Namespace that overrides update. It may also be worth mentioning that the standard library applies this technique in order to reliably access the magic methods of an instance's type, rather than the versions shadowed in the instance (this is important when trying to pickle or copy instances of 'type' for example). Note that support for the various mapping methods, e.g. __(get|set|del)item__, __len__, __iter__, __contains__, items, keys, values, etc. was intentionally omitted as these methods did not seem to be necessary for the core uses of an attribute-value mapping. If such methods are truly necessary for a given use case, this may suggest that a dict object is a more appropriate type for that use. The 'vars' builtin also makes it trivial to use dictionary style operations to manipulate the contents of a Namespace. class Namespace(object): def __eq__(self, other): """x.__eq__(y) <==> x == y Two Namespace objects are considered equal if they have the same attributes and the same values for each of those attributes. """ return (other.__class__ == self.__class__ and self.__dict__ == other.__dict__) Hmm, the exact class check strikes me as being rather strict. Although I guess it makes sense, as the loose check is easily spelt: if vars(ns1) == vars(ns2): pass *shrug* I'll let other people argue about this one :) def update(*args, **kwargs): """Namespace.update(ns, [ns|dict|seq,] **kwargs) -> None Same comment as above about encouraging the inheritance friendly style. Open Issues === What should the types be named? Some suggestions include 'Bunch', 'Record', 'Struct' and 'Namespace'. Where should the types be placed? The current suggestion is a new "namespaces" module. If there aren't any objections to the current answers to these questions in this thread, you may finally get to move them to a 'Resolved Issues' section :) Should namespace chaining be supported? One suggestion would add a NamespaceChain object to the module:: This does have the advantage of keeping the basic namespace simple. However, it may also be worth having native chaining support in Namespace: class Namespace(object): def __init__(*args, **kwds): if not 1 <= len(args) <= 3: raise TypeError('expected 1 to 3 non-keyword arguments,' 'got %i' % len(args)) self = args[0] # Set __fallback__ first, so keyword arg can override if len(args) > 2: self.__fallback__ = args[2] else: self.__fallback__ = None # Update __dict__. OK to use normal method calls, since dict hasn't # been updated yet if len(args) > 1 and args[1] is not None: self.update(args[1], **kwds) elif kwds: self.update(**kwds) def __getattr__(self, attr): if self.__fallback__ is not None: return getattr(self.__fallback__, attr) raise AttributeError("No attribute named " + attr) # Otherwise unchanged class NamespaceChain(object): """NamespaceChain(*objects) -> new attribute lookup chain The new NamespaceChain object's attributes are defined by the attributes of the provided objects. When an attribute is request
Statement coverage tools revisited
Yow, For most of you folks Gareth Rees' excellent python code coverage tool - /statement/ coverage tool to be more precise - is familiar, but there are probably many TDD-fans out there who are not yet aware of this wonderful program. I use the tool a lot, even though it is good to be aware of common false conceptions regarding tools counting number of visited and unvisited lines (100% line coverage means exactly what it says and nothing more; see [1] for more information). However, statement coverage tools are not useless. They are very handy for catching those blocks of code you never execute in your tests, but as mentioned above, you shouldn't feel too secure for having 100% line coverage for your passed unit tests. I've only had one minor gripe with the tool, and that is the notation used for marking visited ('>') and unvisited ('!') lines; it is not handy to grep for '>' or '!' in annotated version, because both characters occur often in python code. Of course you could avoid that using '^!', but it's two keystrokes more :) and stands out less clearly in the code. That's why I did a very simple patch for the tool, attached below [2] (it is small diff, don't fret :), so you can even add overly-verbose line prefixes like this: ./pycoverage -a -u '>>> WARNING: NEVER VISITED' -v '>' xmlkit.py resulting in >class VLANRange(RangeEntry): >"""Class for VLAN ID range nodes""" >def __init__(self, min_vlan_id, max_vlan_id): ... >>> WARNING: NEVER VISITEDRangeEntry.__init__(self, ... ... By the way, there's an interesting comment block in the heading of the code, saying , | The coverage dictionary is called "c" and the trace function | "t". The reason for these short names is that Python looks up variables | by name at runtime and so execution time depends on the length of | variables! In the bottleneck of this application it's appropriate to | abbreviate names to increase speed. ` It was written when 2.1 was the most recent stable version. I wonder if it still applies for 2.2 and later? According to my hasty tests it doesn't seem to be so. I didn't have very large unit test files at hand, though. Footnotes: [1] http://www.garethrees.org/2001/12/04/python-coverage/ [2] --- pycoverage-orig 2005-02-11 13:41:38.0 +0200 +++ pycoverage 2005-02-11 13:00:32.0 +0200 @@ -33,14 +33,18 @@ Report on the statement coverage for the given files. With the -m option, show line numbers of the statements that weren't executed. -coverage.py -a [-d dir] FILE1 FILE2 ... +coverage.py -a [-v char] [-u char] [-d dir] FILE1 FILE2 ... Make annotated copies of the given files, marking statements that are executed with > and statements that are missed with !. With the -d option, make the copies in that directory. Without the -d option, make each copy in the same directory as the original. +-v and -u let you specify characters to use for marking visited and +unvisited lines instead of '>' and '!'. + Coverage data is saved in the file .coverage by default. Set the -COVERAGE_FILE environment variable to save it somewhere else.""" +COVERAGE_FILE environment variable to save it somewhere else. +""" import os import re @@ -63,15 +67,16 @@ # information so the data in the coverage dictionary is transferred to # the 'cexecuted' dictionary under the canonical filenames. # -# The coverage dictionary is called "c" and the trace function "t". The -# reason for these short names is that Python looks up variables by name -# at runtime and so execution time depends on the length of variables! -# In the bottleneck of this application it's appropriate to abbreviate -# names to increase speed. + +# The coverage dictionary is called "coverage_dict" and the trace function +# "t". The reason for these short names is that Python looks up variables +# by name at runtime and so execution time depends on the length of +# variables! In the bottleneck of this application it's appropriate to +# abbreviate names to increase speed. # A dictionary with an entry for (Python source file name, line number # in that file) if that line has been executed. -c = {} +coverage_dict = {} # t(f, x, y). This method is passed to sys.settrace as a trace # function. See [van Rossum 2001-07-20b, 9.2] for an explanation of @@ -80,7 +85,7 @@ # objects. def t(f, x, y): -c[(f.f_code.co_filename, f.f_lineno)] = 1 +coverage_dict[(f.f_code.co_filename, f.f_lineno)] = 1 return t the_coverage = None @@ -133,6 +138,8 @@ '-i': 'ignore-errors', '-m': 'show-missing', '-r': 'report', +'-v:': 'visited-prefix=', +'-u:': 'unvisited-prefix=', '-x': 'execute', } short_opts = string.join(map(lambda o: o[1:], optmap.keys()), '') @@ -178,6 +185,9 @@ execfile(sys.argv[0], __main__.__dict__) if not args: args = self.cexecuted.keys() +
Speed of IDLE output degrades to 'unusable' after upgrade to Python 2.4
Upgraded from 2.2.2 to 2.4 and all seems to work as before except the output to the IDLE window is now twenty times slower than it was before. The statement for i in range (100): print i now takes about forty-five seconds to complete! It used to be two seconds. Python 2.4 on Windows ME. Hints will be received gratefully by Frederic -- http://mail.python.org/mailman/listinfo/python-list
Re: namespaces module (a.k.a. bunch, struct, generic object, etc.) PEP
Michele Simionato wrote: FWIW, you can count me about the people who (re)wrote this same thing (actually with some difference, since I wanted to keep the order, so I used nested lists instead of nested dictionaries, but the idea was similar). I would welcome some module in the standard library to store hierarchical data. This is one of the reasons why Steven's idea of switching to proposing a new module is a good one. It then provides a natural location for any future extensions of the idea such as Records (i.e. namespaces with a defined set of legal fields) and NamedTuples and NamedLists (i.e. namespaces with a defined field order) Cheers, Nick -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list
THREAD_STACK_SIZE and python performance?
Hi, I've been googling for any info on the (possible) effects on python and python applications with varying values on the THREAD_STACK_SIZE with respect to performance etc. The default 0x2 is way to low when running a Zope 2.7.4 and Plone 2.0.5 site. The FreeBSD patch, setting the value to 0x10 seems to be enough for most of our zope servers, however, I've noticed that we get an occasional server death even with this value. This is on normal load, but handling many and large CMS operations in zope/plone. So, any thoughts on even larger thread stacks? On beforehand, thank you Stein M. Sandbech --sms -- http://mail.python.org/mailman/listinfo/python-list
Re: Multi-Platform installer generator
Nicodemus wrote: Hello list, On windows my company uses Inno Setup to generate installers for our products, and on Linux we usually use a simple shell script, but we would like to use the same installer generator for both platforms. Searching google turned up some multi-platform installers (mostly in Java), but I gather that they require a Java VM installed in the target system, and that is undesirable for us, since most system don't come with a Java VM ready (or am I completely wrong in this aspect?). Hello, You can install the JavaVM to use to run the installer (if there isn't a JVM present on the system - common in windows boxes), installing JRE is a minimal effort and can be done silently - you can remove it the same way after if you wish but often Java installers are used to install Java programs so you don't want to bother doing that. Cheers, Neil -- Neil Benn Senior Automation Engineer Cenix BioScience BioInnovations Zentrum Tatzberg 46 D-01307 Dresden Germany Tel : +49 (0)351 4173 154 e-mail : [EMAIL PROTECTED] Cenix Website : http://www.cenix-bioscience.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Is this a bug? BOM decoded with UTF8
pekka niiranen wrote: I have two files "my.utf8" and "my.utf16" which both contain BOM and two "a" characters. Contents of "my.utf8" in HEX: EFBBBF6161 Contents of "my.utf16" in HEX: FEFF6161 This is not true: this byte string does not denote two "a" characters. Instead, it is a single character U+6161. Correct, I used hexeditor to create those files. Is there a trick to read UTF8 encoded file with BOM not decoded? It's very easy: just drop the first character if it is the BOM. I know its easy (string.replace()) but why does UTF-16 do it on its own then? Is that according to Unicode standard or just Python convention? The UTF-8 codec will never do this on its own. Never? Hmm, so that is not going to change in future versions? Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: Big development in the GUI realm
You can distribute GPL'ed code in binary form, you just have to make the sources available as well. And, yes I would use this as a test: if your program needs gpl-ed code for some of it's functionality, you have to licence your program according to the GPL - unless you distribute the GPL'ed parts separately and your program is still basically functioning without the GPL'ed code. Now, if you are unsure about these questions and are serious about writing a program using GPL'ed code, the FSF is probably willing to help you with your questions. Besides this, why not putting your code under the GPL? - Josef -- http://mail.python.org/mailman/listinfo/python-list
Re: Unit Testing in Python
I've had great experience doing Test Driven Development. Ideally you would do it from the start, but it is great for refactoring as well. In any language. One of the pitfalls to look out for is to not get too hung up on it. In the end it's just a tool you use at your discretion. When I first started doing it, I would get hung up on how the test framework should look etc... almost as if I was architecting a system. It really slowed me down. I now take this approach... 1. what is the smallest piece of functionality that I want? (What to test) 2. what test will confirm I have this functionality?(How to test it) 3. how will I access this functionality.(Define the API) 4. write test 5. write code 6. run test. 7. repeat 4,5,6 until you're happy. Frameworks like xUnit etc... just enhance the experience but are in no way required in my opinion. Another nice side effect is that your architecture design then comes naturally and it is exactly what you need nothing more, nothing less. I recently converted a very problematic data migration routine that was written in Transact SQL by a consultant who liked to push the limits of their chosen tool. I wrote it in Python because I was predicting that no one could nail down all the possible permutations of data that might come through. I needed the ability for the routine to be flexible. Anywho, using python and TDD I was able to get functionality running/tested from minute 1 using only XEmacs and ipython. On Fri, 11 Feb 2005 12:39:07 +0100, BJörn Lindqvist <[EMAIL PROTECTED]> wrote: > > put it) PyUnit project. I'm sorry if this is a obvious question or one > > that has already been answered, but unit-testing sounds interesting and > > I'm not sure where to start. > > Hi Ryan. I belive this (http://www.xp123.com/xplor/xp0201/index.shtml) > is a good way to learn about unit testing by practice if you already > know the basics of it. It is written in Java but is easy to translate > to Python. Unittesting really is great in Python, I try to use it for > anything but simple and dirty hacks. > > -- > mvh Björn > -- > http://mail.python.org/mailman/listinfo/python-list > -- Thomas G. Willis http://paperbackmusic.net -- http://mail.python.org/mailman/listinfo/python-list
Re: a sequence question
David Isaac wrote: "Nick Coghlan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Using zip(*[iter(l)]*N) or zip(*(iter(l),)*N) simply extends the above to the general case. Clearly true. But can you please go into much more detail for a newbie? I see that [iter(l)]*N produces an N element list with each element being the same iterator object, but after that http://www.python.org/doc/2.3.5/lib/built-in-funcs.html just didn't get me there. See if the following interactive examples clear things up at all: # The unclear version Py> itr = iter(range(10)) Py> zipped = zip(*(itr,)*3) # How does this bit work? Py> print "\n".join(map(str, zipped)) (0, 1, 2) (3, 4, 5) (6, 7, 8) # Manual zip, printing as we go Py> itr = iter(range(10)) Py> try: ... while 1: print (itr.next(), itr.next(), itr.next()) ... except StopIteration: ... pass ... (0, 1, 2) (3, 4, 5) (6, 7, 8) # Manual zip, actually behaving somewhat like the real thing Py> itr = iter(range(10)) Py> zipped = [] Py> try: ... while 1: zipped.append((itr.next(), itr.next(), itr.next())) ... except StopIteration: ... pass ... Py> print "\n".join(map(str, zipped)) (0, 1, 2) (3, 4, 5) (6, 7, 8) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Is this a bug? BOM decoded with UTF8
> I know its easy (string.replace()) but why does UTF-16 do > it on its own then? Is that according to Unicode standard or just > Python convention? BOM is microsoft-proprietary crap. UTF-16 is defined in the unicode standard. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list
Re: Python versus Perl ?
Alex Martelli wrote: > URK -- _my_ feeling is that we have entirely *too many* options for > stuff like web application frameworks, GUI toolkits, XML processing, ... > > > Alex I entirely second that. More, I'd heartily welcome an authoritative word on which to focus on for each category... I hate to see scarce resources wasted. Mauro -- http://mail.python.org/mailman/listinfo/python-list
Re: Loading functions from a file during run-time
Bryant Huang wrote: Hello! I would like to read in files, during run-time, which contain plain Python function definitions, and then call those functions by their string name. In other words, I'd like to read in arbitrary files with function definitions, using a typical 'open()' call, but then have those functions available for use. The 'import' keyword is not appropriate, AFAIK, because I want to be able to open any file, not one that I know ahead of time (and thus can import at design-time). This usage is one of the reasons why the __import__ function exists (despite what its docs say). It's right there at the top of the library reference's 'builtin functions' section: http://www.python.org/dev/doc/devel/lib/built-in-funcs.html Instead of writing "import foo as mod" you can write "mod = __import__('foo')". The first is better when you do know the name of the module you want at coding time, but the latter is handy when you want to be dynamic about it. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt documentation
Eric Jardim wrote: > Hi, > > Is there any site that gather all the documentation about PyQt? > > The docs of the Riverbank site is poor, and I have found separate > tutorials on the net. > Check out http://www.opendocs.org/pyqt/ > I know that the Kompany have made a "Qtdoc"-like to PyQt. But it is not > free doc. > > Does anybody know anything about any project for making PyQt > development more easy? > Someone else already referred you to the excellent Eric IDE. > thanks, > > [Eric Jardim] -- Website: www DOT jarmania FULLSTOP com -- http://mail.python.org/mailman/listinfo/python-list
Re: Testing web applications
Achim Domma (Procoders) wrote: Hi, I'm looking for frameworks to make testing web applications - i.e. parsing and filling out forms - easier. I found Puffin, which looks good but not very usable in the current state. I know that I once read about other nice frameworks, but could not find one via google. Any hints? regards, Achim I've used Jython and a java package called httpunit to great effect. It even supports javascript on your pages. Huy -- http://mail.python.org/mailman/listinfo/python-list
Re: Statement coverage tools revisited
Edvard Majakari wrote: , | The coverage dictionary is called "c" and the trace function | "t". The reason for these short names is that Python looks up variables | by name at runtime and so execution time depends on the length of | variables! In the bottleneck of this application it's appropriate to | abbreviate names to increase speed. ` It was written when 2.1 was the most recent stable version. I wonder if it still applies for 2.2 and later? According to my hasty tests it doesn't seem to be so. I didn't have very large unit test files at hand, though. It's no longer correct (if it ever was correct). Python internalises 'short' strings (including identifiers) so that comparison can generally be done by means of identity checks. Py> long_and_really_complicated_var_name = 1 Py> "long_and_really_complicated_var_name" is "long_and_really_complicated_var_n ame" True Py> "long_and_really_complicated_non_var_name" is "long_and_really_complicated_n on_var_name" True Py> "long_and_really_complicated_non_var_name" * 20 is "long_and_really_complica ted_non_var_name" * 20 False Ah, the wonderful efficiencies of immutable types. . . Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Big development in the GUI realm
Josef Dalcolmo wrote: You can distribute GPL'ed code in binary form, you just have to make the sources available as well. And, yes I would use this as a test: if your program needs gpl-ed code for some of it's functionality, you have to licence your program according to the GPL - unless you distribute the GPL'ed parts separately and your program is still basically functioning without the GPL'ed code. Besides this, why not putting your code under the GPL? GPL is not suitable for all kinds of software. It's nice if you are sharing code with others, but if you are developing something like a desktop application that you want to sell for money, using the GPL is a bad idea. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list
Re: Is this a bug? BOM decoded with UTF8
Diez B. Roggisch wrote: I know its easy (string.replace()) but why does UTF-16 do it on its own then? Is that according to Unicode standard or just Python convention? BOM is microsoft-proprietary crap. Uh, no. BOM is part of the Unicode standard. The intent is to allow consumers of Unicode text files to disambiguate UTF-8, big-endian UTF-16 and little-endian UTF-16. See http://www.unicode.org/faq/utf_bom.html#BOM Kent -- http://mail.python.org/mailman/listinfo/python-list
Re: PyINI : Cross-Platform INI parser
Peter Maas wrote: I think that a new config utility is worth the effort if it has the potential to put an end to roll-your-own config formats and parsers. http://www.python.org/moin/ConfigParserShootout Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Is this a bug? BOM decoded with UTF8
Diez B. Roggisch wrote: I know its easy (string.replace()) but why does UTF-16 do it on its own then? Is that according to Unicode standard or just Python convention? BOM is microsoft-proprietary crap. UTF-16 is defined in the unicode standard. What are you talking about? The BOM and UTF-16 go hand-and-hand. Without a Byte Order Mark, you can't unambiguosly determine whether big or little endian UTF-16 was used. If, for example, you came across a UTF-16 text file containing this hexidecimal data: 2200 what would you assume? That is is quote character in little-endian format or that it is a for-all symbol in big-endian format? For more details, see: http://www.unicode.org/faq/utf_bom.html#BOM Cheers, Brian -- http://mail.python.org/mailman/listinfo/python-list
Re: Testing web applications
news.sydney.pipenetworks.com wrote: I've used Jython and a java package called httpunit to great effect. It even supports javascript on your pages. Thanks, that is the option I'm currentyl testing. Works great so far! regards, Achim -- http://mail.python.org/mailman/listinfo/python-list
Re: Python versus Perl ?
"Mauro Cicognini" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > > Alex Martelli wrote: > >> URK -- _my_ feeling is that we have entirely *too many* options >> for stuff like web application frameworks, GUI toolkits, XML >> processing, > ... >> >> >> Alex > > I entirely second that. > > More, I'd heartily welcome an authoritative word on which to > focus on for each category... I hate to see scarce resources > wasted. > Alex also suggested that a revival of the anygui interface would be a Good Thing. I would certainly love to see that. It seems to me that Python should in fact include either anygui or an equivalent to it as part of its core. Then to interface with a given GUI package, it would be necessary to create a wrapper that maps the wrapper's API to that standard Pythonic API. More work for the package maintainers, and not easy to do in some cases, but for the Python community it would be a huge gain. The same argument could be made for the anydbm interface. In both cases, the interface should not hinder the ability of a developer to access any part of the package API, which implies that parameters must be flexible. Maybe this is a strong use case for bunch/data/namespace arguments and return values. -- rzed -- http://mail.python.org/mailman/listinfo/python-list
Re: Is this a bug? BOM decoded with UTF8
> What are you talking about? The BOM and UTF-16 go hand-and-hand. > Without a Byte Order Mark, you can't unambiguosly determine whether big > or little endian UTF-16 was used. If, for example, you came across a > UTF-16 text file containing this hexidecimal data: 2200> > what would you assume? That is is quote character in little-endian > format or that it is a for-all symbol in big-endian format? I'm well aware of the need of a bom for fixed-size multibyte-characters like utf16. But I don't see the need for that on an utf-8 byte sequence, and I first encountered that in MS tool output - can't remember when and what exactly that was. And I have to confess that I attributed that as a stupidity from MS. But according to the FAQ you mentioned, it is apparently legal in utf-8 too. Neverless the FAQ states: """ Q: Can a UTF-8 data stream contain the BOM character (in UTF-8 form)? If yes, then can I still assume the remaining UTF-8 bytes are in big-endian order? A: Yes, UTF-8 can contain a BOM. However, it makes no difference as to the endianness of the byte stream. UTF-8 always has the same byte order. An initial BOM is only used as a signature ? an indication that an otherwise unmarked text file is in UTF-8. Note that some recipients of UTF-8 encoded data do not expect a BOM. Where UTF-8 is used transparently in 8-bit environments, the use of a BOM will interfere with any protocol or file format that expects specific ASCII characters at the beginning, such as the use of "#!" of at the beginning of Unix shell scripts. [AF] & [MD] """ So they admit that it makes no sense - especially as decoding a utf-8 string given any 8-bit encoding like latin1 will succeed. So in the end, I stand corrected. But I still think its crap - But not MS crap. :) -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list
Re: Python v.s. c++
xiaobin yang wrote: Hi, if i am already skillful with c++. Is it useful to learn python? thanks! Q : If I'm already skillfull with driving a big truck, is it useful to learn driving a motorcycle? (tip : Have you ever tried driving a big truck in a big city at rush hour?-) -- bruno desthuilliers ruby -e "print '[EMAIL PROTECTED]'.split('@').collect{|p| p.split('.').collect{|w| w.reverse}.join('.')}.join('@')" -- -- http://mail.python.org/mailman/listinfo/python-list
Re: [NooB] Using Escape Sesquences with Strings...
administrata wrote: Hello! :) I've reading 'Python Programmin for the Absolute beginner'. I got questions which is... print "\t - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " rock = """ Igneous Sedimentary Metamorphic Lava Grains Marble Ramdom crystals LayerBands Granite Salt Schist IntrusiveWeathering Heat + Pressure Deposition Change""" print \trock print "\t - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " error occurs! I don't know how to \t The variable. see Daniel's answer for the why. Now for the how, I guess you want a tab on each line so you have two solutions : 1/ putting the tabs in the string: rock = """ \tIgneous Sedimentary Metamorphic \tLava Grains Marble \tRamdom crystals LayerBands \tGranite Salt Schist \tIntrusiveWeathering Heat + Pressure \t Deposition Change""" print rock 2/ adding the tabs before printing: rock = """ Igneous Sedimentary Metamorphic Lava Grains Marble Ramdom crystals LayerBands Granite Salt Schist IntrusiveWeathering Heat + Pressure Deposition Change""" for line in rock.split("\n"): print "\t%s" % line HTH, -- bruno desthuilliers ruby -e "print '[EMAIL PROTECTED]'.split('@').collect{|p| p.split('.').collect{|w| w.reverse}.join('.')}.join('@')" -- -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt documentation
> You can use the qt c++ doc from trolltech. > The pyqt bindings are so close to he original that > you usually can simply use that. Yes, I currently use it. > Additionally, there is a book from boudewijn rempt > about coding in python+qt which is for qt2, but > it covers all the signal slot basics and is completely > available online. I know the book, too. But It would be more practical to have a Qtdoc-like for python, don't you think? > There is an python-based ide which has the same > name as your first name - try that. Sure, I use it too. It's great. The point is that if someone is familiar just to Python and not Qt, or the reverse, familiar to Qt and not to Python, it is difficult to see the *little* details of implementation. I say this because I am familiar to Qt and not much to Python, and there are simple little mistake I do, that could be avoided if a simple example explained it. And a searchable API with examples would be perfect for rapid development. Think about more *new* people using PyQt. I think PyQt if a great (actually the gratest ever, IMO) development "enviroment" and as more people use it, better it gets. Thats the reason I want to know if there is a "Qtdoc-like" PyQt doc. If it does not exists, let's make it :) Wanna join? [Eric Jardim] -- http://mail.python.org/mailman/listinfo/python-list
Re: Testing web applications
The Jython / HttpUnit combination worked well for me too. There's also maxq (http://maxq.tigris.org/), which looks promising, but I haven't used it yet. Grig http://agiletesting.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Unit Testing in Python
A great place to start for TDD-related stuff is testdriven.com. On the topic of Python-specific unit testing, there's also a recent thread on the newly-created extreme-python google group: http://groups-beta.google.com/group/extreme-python/browse_thread/thread/f39844c4cf6c844f?tvc=2 Grig http://agiletesting.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt documentation
> The point is that if someone is familiar just to Python and not Qt, or > the reverse, familiar to Qt and not to Python, it is difficult to see > the *little* details of implementation. > > I say this because I am familiar to Qt and not much to Python, and > there are simple little mistake I do, that could be avoided if a simple > example explained it. And a searchable API with examples would be > perfect for rapid development. > > Think about more *new* people using PyQt. I think PyQt if a great > (actually the gratest ever, IMO) development "enviroment" and as more > people use it, better it gets. > > Thats the reason I want to know if there is a "Qtdoc-like" PyQt doc. If > it does not exists, let's make it :) > > Wanna join? No. I did do some heavy qt development the last fall, and I never ran into troubles because of lack of documentation. So at least for me, there is no need for such a kind of documentation. Above that I think that your desire for that docs stems from the need for getting into pythonesque programming whilst developing a qt-app, I have to say that I don't think that that's a too viable approach in general. Think of trying to learn C++ using Qt. It's hard enough to grasp the gist of the language itself - let alone the complications a elaborated - and in this case even with special preprocessors equipped - library as qt. So maybe a better way for you would be to learn python by its own, then trying to use it in conjunction with qt. Apart from that, I personally found that nearly _no_ python specific stuff was necessary for my doings - at least out of my head I can't come up with an example, except name clashes (exec renamed to exec_loop, as its a keyword in python). All I had to do to make e.g. examples given in C++ work was to strip curly braces and type declarations. So again: I don't see the need for that doc. But that's IMHO, of course. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list
Re: is there a safe marshaler?
Irmen de Jong <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > Pierre Barbier de Reuille wrote: > > Irmen de Jong a écrit : > > > >> Pickle and marshal are not safe. They can do harmful > >> things if fed maliciously constructed data. > >> That is a pity, because marshal is fast. > >> I need a fast and safe (secure) marshaler. > >> Is xdrlib the only option? > >> I would expect that it is fast and safe because > >> it (the xdr spec) has been around for so long. > >> > >> Or are there better options (perhaps 3rd party libraries)? > >> > >> Thanks > >> > >> Irmen. > > > > > > What exactly do you mean by "safe" ? Do you want to ensure your objects > > cannot receive corrupted data ? Do you want to ensure no code will be > > evaluated during the unmarshalling ? > > "safe (secure)" > But to be more precise, let's look at the security warning that > is in the marshal documentation: > "The marshal module is not intended to be secure against erroneous or > maliciously constructed data. Never unmarshal data received from an > untrusted or unauthenticated source." > > So essentially I want the opposite of that ;-) > > I want a marshalar that is okay to use where the data it processes > comes from unknown, external sources (untrusted). It should not crash > on corrupt data and it should not execute arbitrary code when > unmarshaling, so that it is safe against hacking attempts. > > Oh, preferrably, it should be fast :) > Some XML-ish thing may be secure but is likely to be not fast at all. > > Ideally it should be able to transfer user defined Python types, > but if it is like marshal (can only marshal builtin types) that's > okay too. > > --Irmen I'm just curious, but can't effbot's fast cElementree be used for PYROs XML_PICKLE and would it be safe and fast enough? Carl -- http://mail.python.org/mailman/listinfo/python-list
Re: Is this a bug? BOM decoded with UTF8
Diez B. Roggisch wrote: So they admit that it makes no sense - especially as decoding a utf-8 string given any 8-bit encoding like latin1 will succeed. So in the end, I stand corrected. But I still think its crap - But not MS crap. :) Oh, good. I'm not the only person who went "A BOM in UTF-8 data? WTF do you need a byte order marker for when you have 8-bit data?" It also clarifies Martin's comment about the UTF-8 codec ignoring the existence of this piece of silliness :) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Python in Makefile Question. try A.A.P
Another option would be to move from Makefiles to AAP, the build mechanism for vim. We did just that, and are very happy with it. Aap is python based, so the kind of question you have is very easily handled within the 'aap' file. http://www.a-a-p.org/ Aap has the advantage that you don't need to define the dependencies yourself, it understands C files, and does the work for you. Our Makefile shrunk by a factor of 5 after converting to aap. Highly recommended. Bart van Deenen. -- http://mail.python.org/mailman/listinfo/python-list
Re: Install MySQLdb on Mac OS X (10.3)
Skip Montanaro wrote: TK> I can't install MySQLdb on Mac OS X (Ver. 10.3) properly. Here's my TK> environment: TK> 1. MySQL-python-1.0.0 ... Try a more recent version of mysql-python. I think 1.1.7 is the latest. Skip Hi Skip, > Try a more recent version of mysql-python. I think 1.1.7 is the latest. It now works with MySQL-python-1.2.0 And I have to set: export PATH=$PATH:/usr/local/mysql-standard-4.1.9-apple-darwin7.7.0-powerpc/bin Thanks for the hint. o-o Thomas -- http://mail.python.org/mailman/listinfo/python-list
Re: sre is broken in SuSE 9.2
Denis S. Otkidach wrote: > On 10 Feb 2005 11:49:33 -0800 > "Serge Orlov" <[EMAIL PROTECTED]> wrote: > > > This thread is about problems only with LANG=C or LANG=POSIX, it's not > > about other locales. Other locales are working as expected. > > You are not right. I have LANG=de_DE.UTF-8, and the Python test_re.py > doesn't pass. I meant "only with C or POSIX locales" when I wrote "only with LANG=C or LANG=POSIX". My bad. > $LANG doesn't matter if I don't call setlocale. Sure. > Fortunately setting any non-C locale solves the problem for all (I > believe) unicode character: > > >>> re.compile(ur'\w+', re.U).findall(u'\xb5\xba\xe4\u0430') > [u'\xb5\xba\xe4\u0430'] I can't find the strict definition of isalpha, but I believe average C program shouldn't care about the current locale alphabet, so isalpha is a union of all supported characters in all alphabets Serge. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is this a bug? BOM decoded with UTF8
Diez B. Roggisch wrote: I'm well aware of the need of a bom for fixed-size multibyte-characters like utf16. But I don't see the need for that on an utf-8 byte sequence, and I first encountered that in MS tool output - can't remember when and what exactly that was. And I have to confess that I attributed that as a stupidity from MS. But according to the FAQ you mentioned, it is apparently legal in utf-8 too. Neverless the FAQ states: [snipped] So they admit that it makes no sense - especially as decoding a utf-8 string given any 8-bit encoding like latin1 will succeed. They say that it makes no sense as an byte-order indicator but they indicate that it can be used as a file signature. And I'm not sure what you mean about decoding a UTF-8 string given any 8-bit encoding. Of course the encoder must be know: >>> u'T\N{LATIN SMALL LETTER U WITH DIAERESIS}r' ... .encode('utf-8').decode('latin1').encode('latin1') 'T\xc3\xbcr' I can assume you that most Germans can differentiate between "Tür" and "Tã¼r". Using a BOM with UTF-8 makes it easy to indentify it as such AND it shouldn't break any probably written Unicode-aware tools. Cheers, Brian -- http://mail.python.org/mailman/listinfo/python-list
Injecting a C side object into the local dict
Hello, How do you go about taking a variable which was declared in C and pass that through to a Python script? I have tried doing this by adding a simple string which is a PyObject from C into the local dictionary and retrieving it from script via a locals()["myCvar"] print statement. This however does not seem to work. It would seem that when the scripts are ran the local dictionary with the added item is wiped clean and a new local dictionary is instead used. Any direction or help would be appreciated. Cheers, Jamie. -- http://mail.python.org/mailman/listinfo/python-list
Re: Install MySQLdb on Mac OS X (10.3)
Skip Montanaro <[EMAIL PROTECTED]> wrote: >Try a more recent version of mysql-python. I think 1.1.7 is the latest. 1.2.0 -- it appears to be moving extremely rapidly (especially given how long it was at 0.9.2 -- although "Waiting for MySQL 4.1 to become stable" would be a good explanation for that). -- \S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/ ___ | "Frankly I have no feelings towards penguins one way or the other" \X/ |-- Arthur C. Clarke her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump -- http://mail.python.org/mailman/listinfo/python-list
MDaemon Warning - virus found: Returned mail: Data format error
*** WARNING ** Este mensaje ha sido analizado por MDaemon AntiVirus y ha encontrado un fichero anexo(s) infectado(s). Por favor revise el reporte de abajo. AttachmentVirus name Action taken -- mxs.zip Email-Worm.Win32.Mydoom.m Removed ** The message was not delivered due to the following reason: Your message was not delivered because the destination computer was unreachable within the allowed queue period. The amount of time a message is queued before it is returned depends on local configura- tion parameters. Most likely there is a network problem that prevented delivery, but it is also possible that the computer is turned off, or does not have a mail system running right now. Your message could not be delivered within 6 days: Host 196.50.210.36 is not responding. The following recipients could not receive this message: Please reply to [EMAIL PROTECTED] if you feel this message to be in error. -- http://mail.python.org/mailman/listinfo/python-list
Re: THREAD_STACK_SIZE and python performance?
>The FreeBSD patch, setting the value to 0x10 >seems to be enough for most of our zope servers,... Is that value in /bytes/? In modern solaris implementations of posix threads, the default stack size is 2 megabytes fo 64 bit machines. I can't fathom what your performance consideration would be; I'd think there'd not be one, with any reasonable amount of memory on your server. C// -- http://mail.python.org/mailman/listinfo/python-list
Alternative to raw_input ?
I need something like "Press any key to continue" code for my program. Currently I use : raw_input("Press Enter to continue ") but it's lame. -- http://mail.python.org/mailman/listinfo/python-list
Re: Alternative to raw_input ?
On Fri, 11 Feb 2005 17:26:04 +0100, BOOGIEMAN <[EMAIL PROTECTED]> wrote: > I need something like "Press any key to continue" code for my program. > Currently I use : raw_input("Press Enter to continue ") but it's lame. Err, why? -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Alternative to raw_input ?
On Fri, 11 Feb 2005 16:35:19 +, Simon Brunning wrote: > Err, why? It looks to ugly this way. I want to press any key without ENTER to continue -- http://mail.python.org/mailman/listinfo/python-list
Postgres and SSL
I'm on a Linux box running python 2.3 and would like to connect to a postgres database via SSL, but have not been able to find a module to do this (or haven't figured out the syntax). Can anyone help me out? Thanks, --greg -- Greg Lindstrom 501 975.4859 Computer Programmer [EMAIL PROTECTED] NovaSys Health Little Rock, Arkansas "We are the music makers, and we are the dreamers of dreams." W.W. Confidentiality Notice -- This email and any attachments to it are privileged and confidential and are intended solely for use of the individual or entity to which they are addressed. If the reader of this message is not the intended recipient, any use, distribution, or copying of this communication, or disclosure of all or any part of its content to any other person, is strictly prohibited. If you have received this communication in error, please notify the sender by replying to this message and destroy this message and delete any copies held in your electronic files. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: Big development in the GUI realm
On Fri, 11 Feb 2005 13:57:47 +0100, Josef Dalcolmo wrote: > You can distribute GPL'ed code in binary form, you just have to make the > sources available as well. And, yes I would use this as a test: if your > program needs gpl-ed code for some of it's functionality, you have to > licence your program according to the GPL - unless you distribute the > GPL'ed parts separately and your program is still basically functioning > without the GPL'ed code. The problem with this is what I've called the "patch hole" in another context [1]. The problem with this definition is that I can *always* distribute GPL'ed parts separately and re-combine them arbitrarily upon execution, and it's not even particularly hard. Write your code with the GPL'ed code embedded. At the end, before you distribute, extract it and record the extraction so your program can "rewind it"; you're left with nothing in your code that is GPLed. Later, the user will go get the GPL software, and you software "rewinds" the extraction process, and the user is left with something that is byte-for-byte identical to what you weren't allowed to distribute by the GPL so what good was the GPL? (Compiling issues can of course be extracted away, which is what a linker does.) If this is all the protection that the GPL provides, than it is utterly useless. But truly nailing down what it means is even harder. Nobody really knows what the GPL means when it gets down to it; the entire copyright-based model is broken and unrepairable in a software context. It's like nailing jello to a wall, you just can't hold it up there. [1]:http://www.jerf.org/writings/communicationEthics/node10.html#SECTION000105000 -- http://mail.python.org/mailman/listinfo/python-list
Re: Alternative to raw_input ?
On 2005-02-11, BOOGIEMAN <[EMAIL PROTECTED]> wrote: > On Fri, 11 Feb 2005 16:35:19 +, Simon Brunning wrote: > >> Err, why? > > It looks to ugly this way. I want to press > any key without ENTER to continue Like somebody already said: use the WConio module. Somebody already posted a link. I suggest you go look at it. -- Grant Edwards grante Yow! ... the MYSTERIANS at are in here with my visi.comCORDUROY SOAP DISH!! -- http://mail.python.org/mailman/listinfo/python-list
Re: namespaces module (a.k.a. bunch, struct, generic object, etc.) PEP
On Fri, 11 Feb 2005 22:23:58 +1000, Nick Coghlan wrote: > This is one of the reasons why Steven's idea of switching to proposing a > new module is a good one. It then provides a natural location for any > future extensions of the idea such as Records (i.e. namespaces with a > defined set of legal fields) and NamedTuples and NamedLists (i.e. > namespaces with a defined field order) I'm not very good at reading Guido's mind, but it might be worth feeling out whether mentioning this will improve the chances of this passing or not, because while I do not know, can not know, and am not trying to predict, it is at least possible that Guido may feel as I have been: That this proposal on its own isn't that exciting, but as the foundation of some *other* standard functionality as described it might be very good. In that case that should be emphasized. See, now it still doesn't make me jump up and down because I can write what I need fairly easily, but it would be a great boon to beginners or people who just want to do work and re-write this again, but slightly differently, and would also provide some standardization where otherwise we all roll our not-quite-similar-enough implementations, which would help us read each other's code. Y'all are bringing me around, slowly but surely :-) -- http://mail.python.org/mailman/listinfo/python-list
Re: a sequence question
> Alan Isaac wrote: > > I see that [iter(l)]*N produces an N element list with each element being > > the same iterator object, but after that > > http://www.python.org/doc/2.3.5/lib/built-in-funcs.html > > just didn't get me there. "Nick Coghlan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Py> itr = iter(range(10)) > Py> zipped = zip(*(itr,)*3) # How does this bit work? > # Manual zip, actually behaving somewhat like the real thing > Py> itr = iter(range(10)) > Py> zipped = [] > Py> try: > ... while 1: zipped.append((itr.next(), itr.next(), itr.next())) > ... except StopIteration: > ... pass http://www.python.org/doc/2.3.5/lib/built-in-funcs.html says: "This function returns a list of tuples, where the i-th tuple contains the i-th element from each of the argument sequences." So an "argument sequence" can in fact be any iterable, and these in turn are asked *in rotation* for their yield, right? So we pass the (identical) iterables in a tuple or list, thereby allowing a variable number of arguments. We unpack the argument list with '*', which means we have provided three iterables as arguments. And then zip works as "expected", once we have learned to expect zip to "rotate" through the arguments. Is that about right? If that is right, I still cannot extract it from the doc cited above. So where should I have looked? Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list
Re: Performance Issues of MySQL with Python
Well, it does more than that. It converts each column from a string (because MySQL returns all columns as strings) into the appropriate Python type. Then you were converting all the Python types back into strings. So it's no mystery that using the command line client is faster, since it would take the string results and write them out directly. (I assume it does this; there's no rational reason for it to do otherwise.) -- http://mail.python.org/mailman/listinfo/python-list
Re: namespaces module (a.k.a. bunch, struct, generic object, etc.) PEP
Jeremy Bowers <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > On Fri, 11 Feb 2005 22:23:58 +1000, Nick Coghlan wrote: >> This is one of the reasons why Steven's idea of switching to >> proposing a new module is a good one. It then provides a >> natural location for any future extensions of the idea such as >> Records (i.e. namespaces with a defined set of legal fields) >> and NamedTuples and NamedLists (i.e. namespaces with a defined >> field order) > > I'm not very good at reading Guido's mind, but it might be worth > feeling out whether mentioning this will improve the chances of > this passing or not, because while I do not know, can not know, > and am not trying to predict, it is at least possible that Guido > may feel as I have been: That this proposal on its own isn't > that exciting, but as the foundation of some *other* standard > functionality as described it might be very good. In that case > that should be emphasized. > > See, now it still doesn't make me jump up and down because I can > write what I need fairly easily, but it would be a great boon to > beginners or people who just want to do work and re-write this > again, but slightly differently, and would also provide some > standardization where otherwise we all roll our > not-quite-similar-enough implementations, which would help us > read each other's code. > > Y'all are bringing me around, slowly but surely :-) Yes, it seems that the main benefit is to provide a Python-standard way of doing something that many individuals see as useful. Like many others, I've implemented my own variation (a class I call Data) to do essentially the same thing as the bunch/namespace proposal. If there had already been an existing standard way to do it, I would at most have needed to subclass the standard method. I would bet that subclassing is *still* going to be common, though, as each of us individually roll our own version to get that one vital feature the standard doesn't cover (for me, it's update with numerous other types), so the net effect may actually not be all that different from what happens now. Still, I could happily give up some features as long as the functionality is still available and presuming I intended the code for public consumption, and for that, Namespace would be most useful. Though I'd like it to have a shorter name. I'm lazy. -- rzed -- http://mail.python.org/mailman/listinfo/python-list
Concurrent Python
I've created a few classes to support some concurrent programming concepts in Python: AsyncResult represents the state of a process currently running in a separate thread. MultiEvent allows listeners to wait for any one of a list of events to be signalled. MultiQueue allows listeners to wait for an item to be added to any one of a list of queues. DataflowObject can be used to block while waiting for a single-assignment variable to be bound. The code can be found here: http://www.codepoetics.com/code/concurrent.py Comments and constructive criticism welcome. regards, Dominic -- http://mail.python.org/mailman/listinfo/python-list
Re: Is this a bug? BOM decoded with UTF8
> They say that it makes no sense as an byte-order indicator but they > indicate that it can be used as a file signature. > > And I'm not sure what you mean about decoding a UTF-8 string given any > 8-bit encoding. Of course the encoder must be know: That every utf-8 string can be decoded in any byte-sized encoding. Does it make sense? No. But does it fail (as decoding utf-8 frequently does)? No. So if you are in a situation where you _don't_ know the encoding, a decoding can only be based on a heuristic. And a utf-8 BOM can be part of that heuristic - but it still is only a hint. Besides that, lots of tools don't produce it. E.g. everything that produces/consumes xml doesn't need it. > >>> u'T\N{LATIN SMALL LETTER U WITH DIAERESIS}r' > ... .encode('utf-8').decode('latin1').encode('latin1') > 'T\xc3\xbcr' If the encoder is to be known, using the BOM becomes obsolete. > I can assume you that most Germans can differentiate between "Tür" and > "Tã¼r". Oh, germans can. Computers oth can't. You could try and use common words like "für" and so on for a heuristic. But that is no guarantee. > Using a BOM with UTF-8 makes it easy to indentify it as such AND it > shouldn't break any probably written Unicode-aware tools. As the faq states, that can very well happen. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list
Re: Alternative to raw_input ?
On Fri, Feb 11, 2005 at 05:37:19PM +0100, BOOGIEMAN wrote: > On Fri, 11 Feb 2005 16:35:19 +, Simon Brunning wrote: > > > Err, why? > > It looks to ugly this way. I want to press > any key without ENTER to continue read the documentation on readline. Hmm! it says "Availability: Unix". Any particular reason? readline should be fine on OSX and Win32 -- John Lenton ([EMAIL PROTECTED]) -- Random fortune: sugar daddy, n.: A man who can afford to raise cain. signature.asc Description: Digital signature -- http://mail.python.org/mailman/listinfo/python-list
Re: convert list of tuples into several lists
Pierre Quentel wrote: Could someone explain why this doesn't work : Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> def f(*args,**kw): ... print args, kw ... >>> f(*[1,2]) (1, 2) {} >>> f(*[1,2],x=1) File "", line 1 f(*[1,2],x=1) ^ SyntaxError: invalid syntax >>> http://docs.python.org/ref/calls.html Steve -- http://mail.python.org/mailman/listinfo/python-list
Re: Alternative to raw_input ?
BOOGIEMAN wrote: On Fri, 11 Feb 2005 16:35:19 +, Simon Brunning wrote: Err, why? It looks to ugly this way. I want to press any key without ENTER to continue Did you try this: import msvcrt msvcrt.getch() -- http://mail.python.org/mailman/listinfo/python-list
Re: Big development in the GUI realm
> The problem with this is what I've called the "patch hole" in another > context [1]. The problem with this definition is that I can *always* > distribute GPL'ed parts separately and re-combine them arbitrarily upon > execution, and it's not even particularly hard. Write your code with the > GPL'ed code embedded. At the end, before you distribute, extract it and > record the extraction so your program can "rewind it"; you're left with > nothing in your code that is GPLed. Later, the user will go get the GPL > software, and you software "rewinds" the extraction process, and the user > is left with something that is byte-for-byte identical to what you weren't > allowed to distribute by the GPL so what good was the GPL? What you described is not ok according to the GPL - since you distributed a binary thats derived from GPL software (and you didn't publish it source code under the GPL too). > Nobody really knows what the GPL means when it gets down to it; If you don't know, you should ask the person whose GPL code you are using. -- damjan -- http://mail.python.org/mailman/listinfo/python-list
Re: Efficient checksum calculating on lagre files
Christos TZOTZIOY Georgiou <[EMAIL PROTECTED]> wrote: > On 09 Feb 2005 10:31:22 GMT, rumours say that Nick Craig-Wood > <[EMAIL PROTECTED]> might have written: > > >But you won't be able to md5sum a file bigger than about 4 Gb if using > >a 32bit processor (like x86) will you? (I don't know how the kernel / > >user space VM split works on windows but on linux 3Gb is the maximum > >possible size you can mmap.) > > Indeed... but the context was calculating efficiently checksums for large > files > to be /served/ by a webserver. I deduce it's almost certain that the files > won't be larger than 3GiB, but ICBW :) You are certainly right ;-) However I did want to make the point that while mmap is extremely attractive for certain things, it does limit you to files < 4 Gb which is something that people don't always realise. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list
Re: Postgres and SSL
Greg Lindstrom wrote: > I'm on a Linux box running python 2.3 and would like to connect to a > postgres database via SSL, but have not been able to find a module to do > this (or haven't figured out the syntax). Can anyone help me out? With both psycopg and pypgsql it depends on how your libpq was compiled. If the libraries from your PostgreSQL installation were compiled to support SSL, then you can connect to the server without any problems. Be seeing you, Godoy. -- http://mail.python.org/mailman/listinfo/python-list
1998 CNRI license compatibility
I'm interested in updating the very old kerberos extension module. However, the code dates to 1998 and is licensed under what appears to be a pre-python-1.6 CNRI license. Does anyone have recommendations on whether additions and changes to the old code can be licensed under a newer OSI-approved license? There is information on GPL, CNRI 1.6, and python license compatibility, as well as a history of the python licenses in the current python license file. But I can't find suggestions on what to do with such an old version of the CNRI license. http://www.python.org/ftp/python/contrib-09- Dec-1999/System/krb5module-0.1.tar.gz http://www.python.org/ftp/python/contrib-09- Dec-1999/System/krb5module.README Any ideas will be appreciated. Many thanks, -John R. -- http://mail.python.org/mailman/listinfo/python-list
Re: is there a safe marshaler?
cmkl wrote: but can't effbot's fast cElementree be used for PYROs XML_PICKLE and would it be safe and fast enough? ElementTree's not a marshaler. Or has it object (de)serialization included? --Irmen -- http://mail.python.org/mailman/listinfo/python-list
Partnership Opportunity
Partnership Opportunity Hello, I am with a manufacturer of fine jewelry and am currently looking for those interested in forming a partnership to sell jewelry on eBay or anywhere else. I work for Elie International, a manufacturer of fine jewelry located in the heart of the diamond district in New York City. We have been in the jewelry business for over 23 years and are registered with the Jewelers Board of Trade (JBT registration # 0107) and Dunne & Bradstreet. For the first time in our company's history we are looking to build partnerships with individual sellers. We hold an extensive stock of over 24,000 items and need vendors to keep it moving. By selling our merchandise on eBay, or to family and friends, we become your partner not your competitor and offer you fine jewelry at wholesale prices which are a FRACTION of what YOUR CUSTOMERS pay in retail stores. We understand that many buyers are apprehensive about paying for merchandise up front, and we have devised our Direct Purchase Partnership program with these concerns in mind. Our Guaranteed Movers Policy states that if you cannot sell one of our items within 6 months we will exchange it. This insures that you are never stuck with merchandise you can't sell. We want to strongly emphasize that this is a partnership and we offer our partners the full support that they need, including pictures, prices and descriptions of all merchandise to get them started. Please contact us via e-mail at [EMAIL PROTECTED] or at (212) 719-0090 if you are interested or have any questions and please include where you saw this message. Thank You -- http://mail.python.org/mailman/listinfo/python-list
Partnership Opportunity
Partnership Opportunity Hello, I am with a manufacturer of fine jewelry and am currently looking for those interested in forming a partnership to sell jewelry on eBay or anywhere else. I work for Elie International, a manufacturer of fine jewelry located in the heart of the diamond district in New York City. We have been in the jewelry business for over 23 years and are registered with the Jewelers Board of Trade (JBT registration # 0107) and Dunne & Bradstreet. For the first time in our company's history we are looking to build partnerships with individual sellers. We hold an extensive stock of over 24,000 items and need vendors to keep it moving. By selling our merchandise on eBay, or to family and friends, we become your partner not your competitor and offer you fine jewelry at wholesale prices which are a FRACTION of what YOUR CUSTOMERS pay in retail stores. We understand that many buyers are apprehensive about paying for merchandise up front, and we have devised our Direct Purchase Partnership program with these concerns in mind. Our Guaranteed Movers Policy states that if you cannot sell one of our items within 6 months we will exchange it. This insures that you are never stuck with merchandise you can't sell. We want to strongly emphasize that this is a partnership and we offer our partners the full support that they need, including pictures, prices and descriptions of all merchandise to get them started. Please contact us via e-mail at [EMAIL PROTECTED] or at (212) 719-0090 if you are interested or have any questions and please include where you saw this message. Thank You -- http://mail.python.org/mailman/listinfo/python-list
Re: is there a safe marshaler?
Carl> but can't effbot's fast cElementree be used for PYROs XML_PICKLE Carl> and would it be safe and fast enough? It's not clear to me that if marshal is unsafe how XML could be safe. In this context they are both just serializations of basic Python data structures. Skip -- http://mail.python.org/mailman/listinfo/python-list
Re: Install MySQLdb on Mac OS X (10.3)
>> Try a more recent version of mysql-python. I think 1.1.7 is the latest. TK> It now works with MySQL-python-1.2.0 Andy's a busy guy... ;-) Skip -- http://mail.python.org/mailman/listinfo/python-list
Re: Alternative to raw_input ?
> Err, why? >> It looks to ugly this way. I want to press >> any key without ENTER to continue How about modifying it to raw_input("Press ENTER to continue ") Skip -- http://mail.python.org/mailman/listinfo/python-list
Re: Loading functions from a file during run-time
Ah, thanks a lot, Grant and Nick. Let me try to clarify because I think I was unclear in specifying what I want to do: 1. Read in a file containing a bunch of function definitions: def f1(x): ... def f2(x): ... def f3(x): ... def f4(x): ... 2. In wxPython, populate a CheckListBox with all the functions defined in that file. 3. Allow the user to check some of the functions, say for example, f1() and f3(). 4. The program then executes f1() and f3() on some specified data. The reason I asked these questions is because I don't know what functions are contained in the function file ahead of time, but I still want to be able to read those in, then based on which functions the user selects, to run those accordingly, even though I still don't know, at design-time, what functions are contained in the function file. Does that make sense? Thanks a lot! Bryant -- http://mail.python.org/mailman/listinfo/python-list
Re: ActivePython 2.3.5.236 and ActivePython 2.4.0.244 are available
mep wrote: ActivePython-2.4.0-243-win32-ix86.msi : 29M ActivePython-2.4.0-244-win32-ix86.msi : 18M What make so much difference of the size of them, which distinct monir version number for 1 only. Any explaination? Yes, build 243 accidentally included some debug-build bits from the included PyWin32 build in the package. These debug bits are only intended for the separate Windows "debug" package. I fixed this for build 244. $ diff -qr ActivePython-2.4.0-243-win32-ix86 ActivePython-2.4.0-244-win32-ix86 | grep "Only in" Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/isapi: PyISAPI_loader_d.dll Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/isapi: PyISAPI_loader_d.pdb Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/pythonwin: dde_d.pdb Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/pythonwin: dde_d.pyd Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/pythonwin: Pythonwin_d.exe Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/pythonwin: Pythonwin_d.pdb Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/pythonwin: scintilla_d.dll Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/pythonwin: win32ui_d.pdb Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/pythonwin: win32ui_d.pyd Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/pythonwin: win32uiole_d.pdb Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/pythonwin: win32uiole_d.pyd Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: dbi_d.pdb Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: dbi_d.pyd Only in ActivePython-2.4.0-244-win32-ix86/INSTALLDIR/Lib/site-packages/win32/Demos: BackupRead_BackupWrite.py Only in ActivePython-2.4.0-244-win32-ix86/INSTALLDIR/Lib/site-packages/win32/Demos: BackupSeek_streamheaders.py Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32/libs: pywintypes_d.lib Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: mmapfile_d.pdb Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: mmapfile_d.pyd Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: odbc_d.pdb Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: odbc_d.pyd Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: perfmondata_d.dll Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: perfmondata_d.pdb Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: perfmon_d.pdb Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: perfmon_d.pyd Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: pythonservice_d.exe Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: pythonservice_d.pdb Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32/scripts: setup_d.py Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: servicemanager_d.pdb Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: servicemanager_d.pyd Only in ActivePython-2.4.0-244-win32-ix86/INSTALLDIR/Lib/site-packages/win32/test: test_win32event.py Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: timer_d.pdb Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: timer_d.pyd Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: win2kras_d.pdb Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: win2kras_d.pyd Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: win32api_d.pdb Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: win32api_d.pyd Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: win32clipboard_d.pdb Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: win32clipboard_d.pyd Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: win32event_d.pdb Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: win32event_d.pyd Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: win32evtlog_d.pdb Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: win32evtlog_d.pyd Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: win32file_d.pdb Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: win32file_d.pyd Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: win32gui_d.pdb Only in ActivePython-2.4.0-243-win32-ix86/INSTALLDIR/Lib/site-packages/win32: win32gui_d.pyd Only in Ac