Re: A bug in struct module on the 64-bit platform?

2005-12-01 Thread Fredrik Lundh
Neal Norwitz wrote: >> I have a user who complained about how "struct" module computes C >> struct data size on Itanium2 based 64-bit machine. > > I wouldn't be surprised, but I don't understand the problem. > >>>>struct.calcsize('idi') >>16 >>>>struct.calcsize('idid') >>24 >>>

Re: A bug in struct module on the 64-bit platform?

2005-12-01 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > This is the case on my linux/x86_64 machine: > $ python -c 'import struct; print struct.calcsize("idi")' > 20 > I don't know much about 'itanium', but i'd be surprised if they > chose 4-byte alignment for doubles. oops. missed your reply. > http://h21007.www2.

Re: General question about Python design goals

2005-12-01 Thread Fredrik Lundh
Rocco Moretti wrote: >>>I'm sure Antoon wouldn't object if lists were to be allowed as >>>dictionary keys, which would eliminate the multiple castings for >>>that situation. I wouldn't, either. >> >> so what algorithm do you suggest for the new dictionary im- >> plementation? > > One option is to

Re: Regular Expression question

2005-12-01 Thread Fredrik Lundh
Michelle McCall wrote: >I have a script that needs to scan every line of a file for numerous > strings. There are groups of strings for each "area" of data we are looking > for. Looping through each of these list of strings separately for each line > has slowed execution to a crawl. Can I creat

Re: best way to discover this process's current memory usage, cross-platform?

2005-12-01 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: >> "mallinfo" is available on most UNIX-like systems(Linux, Solaris, QNX, >> etc.) and is also included in the dlmalloc library (which works on >> win32). >> >> There is a small C extension module at >> http://hathawaymix.org/Software/Sketches/ >> which should give access

Re: aligning a set of word substrings to sentence

2005-12-01 Thread Fredrik Lundh
Steven Bethard wrote: > I feel like there should be a simpler solution (maybe with the re > module?) but I can't figure one out. Any suggestions? using the finditer pattern I just posted in another thread: tokens = ['She', "'s", 'gon', 'na', 'write', 'a', 'book', '?'] text = '''\ She's gonna wr

Re: python speed

2005-12-01 Thread Fredrik Lundh
Cameron Laird wrote: >>You are missing the main idea: Java is by design a general purpose >>programming language. That's why all "GMPYs" and alike are written in >>Java - now wrappers to C-libraries. Python, by design, is glue > . > I don't understand the sentence, "That's why all 'GMPYs' and alik

Re: General question about Python design goals

2005-12-01 Thread Fredrik Lundh
Mike Meyer wrote: >>> Seriously. Why doesn't this have to be phrased as "for x in list((1, >>> 2, 3))", just like you have to write list((1, 2, 3)).count(1), etc.? >> because anything that supports [] can be iterated over. > > That's false. Anything that has __getitem__ supports []. To be > iterat

Re: python speed

2005-12-01 Thread Fredrik Lundh
Isaac Gouy wrote: >> and yes, the proposition matches my experiences. java heads prefer to do >> everything in java, while us pythoneers happily mix and match whenever we >> can... (which is why guoy's "benchmarks" says so little about Python; if you >> cannot use smart algorithms and extensions

Re: how to run an external program...

2005-12-01 Thread Fredrik Lundh
Larry Bates wrote: > In addition to what Philippe suggested, take a look at the > subprocess module as well (if you are on Python 2.4 or > greater). footnote: the subprocess module is available for 2.2 and 2.3 as well. a pure-python version (for unix and compatibles) can be found here: http:

Re: UnicodeDecodeError

2005-12-01 Thread Fredrik Lundh
"ash" wrote: > If you dont mind, I have another question for you. I use wxPython for > GUI development. When i use a string containing "&" character as a > label for statictext, the "&" does'nt appear.It is replaced by a short > _. I have tried different encodings but have no success. what should

Re: Newbie: global variables inside class

2005-12-01 Thread Fredrik Lundh
"tjas ni" <[EMAIL PROTECTED]> wrote: > I just got a simple question which I did not find (I bet it's there > somewhere) in the documentation: > How can I make a variable access-able globally inside a class? > > Like I've got a variable in function 1 which I want to access in function 2. > Both fu

Re: Retrieve input

2005-12-01 Thread Fredrik Lundh
"amfr" wrote: > A little while ago, someone told me that for the BaseHTTPServer module, > the whole request would be stored in self.rfile. > I looked at the doumentation and is says rfile is: > "Contains an input stream, positioned at the start of the optional > input data." > How do i get the inp

Re: General question about Python design goals

2005-12-01 Thread Fredrik Lundh
Donn Cave wrote: > Paul Rubin wrote: > > > There's a historical issue too: when tuples started first being > > used this way in Python, classes had not yet been introduced. > > When was that, old-timer? According to Misc/HISTORY, > Python was first posted to alt.sources at version 0.9.0, > Febru

Re: Tkinter menu

2005-12-01 Thread Fredrik Lundh
<[EMAIL PROTECTED]> wrote: > I'm writing a small GUI program in Python/Tkinter (my first Python > program). I want to make a menu which lists the names of a number of > text files that my program uses/generates. When I select one of the > files from the menu, I would like a new window to open up

Re: CGI module does not parse data

2005-12-01 Thread Fredrik Lundh
"amfr" wrot3e: > I am writing a webserver, and I want it to be able to run python > scripts. But when I set sys.stdin to self.rfile (using the > BaseHTTPServer class, self.rfile is a input stream containing the > request), the cgi module does not parse the data. > Example script: > import cgi > f

Re: Problem cmpiling M2Crypto under Plone

2005-12-02 Thread Fredrik Lundh
Thomas G. Apostolou wrote: > So what you say is that the Python installed with Plone doesn't have > Python.h in ./include but Python installers from Python.org do have the > file? that's likely, given building didn't work for you. after all, Plone's an application that happens to include a Pytho

Re: python speed

2005-12-02 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > DecInt's division algorithm is completely general also. But I would > never claim that Python code is faster than assembler. I believe that > careful implementation of a good algorithm is more important than the > raw speed of the language or efficiency of the compiler.

Re: How to creat a file?

2005-12-02 Thread Fredrik Lundh
"sandorf" <[EMAIL PROTECTED]> wrote: > I'm new to python. Have a simple question. > > "open" function can only open an existing file and raise a IOerror when > the given file does not exist. How can I creat a new file then? reading the documentation might help: >>> help(open) class file(object)

Re: aligning a set of word substrings to sentence

2005-12-02 Thread Fredrik Lundh
Steven Bethard wrote: >>> I feel like there should be a simpler solution (maybe with the re >>> module?) but I can't figure one out. Any suggestions? >> >> using the finditer pattern I just posted in another thread: >> >> tokens = ['She', "'s", 'gon', 'na', 'write', 'a', 'book', '?'] >> text = ''

Re: why use #!/usr/bin/env python rather than #!python?

2005-12-02 Thread Fredrik Lundh
Adriano Ferreira wrote: > Many Python scripts I see start with the shebang line > > #!/usr/bin/env python > > What is the difference from using just > > #!python $ more test.py #!python print "hello" $ chmod +x test.py $ ./test.py -bash: ./test.py: python: bad interpreter: No such file or directo

Re: Detect TKinter window being closed?

2005-12-02 Thread Fredrik Lundh
Glen wrote: > Is it possible to to detect a Tkinter top-level window being closed with the > close icon/button (top right), for example to call a function before the > window actually closes? http://effbot.org/tkinterbook/tkinter-events-and-bindings.htm#protocols -- http://mail.python.org/

Re: Why my modification of source file doesn't take effect whendebugging?

2005-12-02 Thread Fredrik Lundh
Christophe wrote: > > "import" only reads the file the first time it's called. Every import > > call after that looks up the module in memory. This is to prevent > > circular dependencies between modules from creating infinite loops. > > You need to use the reload() function: > > As a matter of

Re: Is there no compression support for large sized strings in Python?

2005-12-03 Thread Fredrik Lundh
Christopher Subich wrote: >> anyone out there with an ILP64 system? > > I have access to an itanium system with a metric ton of memory. I > -think- that the Python version is still only a 32-bit python an ILP64 system is a system where int, long, and pointer are all 64 bits, so a 32-bit python o

Re: regexp non-greedy matching bug?

2005-12-04 Thread Fredrik Lundh
Mike Meyer wrote: > ^ must match the beginning of the string (BTW, you can get the same > behavior by leaving off the ^ and using search instead of match). that's backwards, isn't it? using ^ with match is usually pointless (since match only looks at the first position anyway), and using ^ with

Re: want to get the pointer of any python object in C++, but I Failed.

2005-12-04 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I am trying to call the method of python object. But I dont know > how to transfer the pointer of the python object into c++ . > > the C++ method to receive python object pointer : > > static PyObject* > ReceivePythonPointer(PyObject* self, PyObject* args) > { >

Re: Scientific Notation

2005-12-04 Thread Fredrik Lundh
> > > You mean something like: > > > > > > >>> print '%e' % (1e50) > > > 1.00e+50 > > > > > > ...? > > > No, I mean given a big number, such as > > 1000, convert it into > > scientific notation. > > It's the same. > > >>> print "%e" % 1000

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-04 Thread Fredrik Lundh
Ed Leafe wrote: > > That depends on your editor. Mine (vim) can be instructed to insert > > the appropriate amount of spaces on a tab, and remove them on a > > backspace. > > So let's say that you are using 4 spaces as your standard, but > by accident type 5. You hit backspace, which deletes

Re: How to execute an EXE via os.system() with spaces in the directoryname?

2005-12-04 Thread Fredrik Lundh
Peter Hansen wrote: > It can't all be Windows' brain damage, since typing precisely the same > command at the prompt (at least with the example I'm using) doesn't > require doubling the initial quote of the command line. Or, more > precisely, Windows is brain damaged in at least two different pla

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-04 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Python could take over the programming world except one of it's best > features (scope by indent) is a primary reason why it never will. It's > not flexible enough. A large percentage of programmers won't even try > the language. you're about 10 years late for this ki

Re: want to get the pointer of any python object in C++, but I Failed.

2005-12-04 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote > I cant understand yet. The second parameter is "0" in the python' > documentation. what documentation? the official PyArg_ParseTuple documentation at http://docs.python.org/api/arg-parsing.html uses the letter O (use cut and paste if you don't believe me).

Re: ADD HTML to the code

2005-12-05 Thread Fredrik Lundh
"Little" <[EMAIL PROTECTED]> wrote: > Could someone tell me how to add some HTML tags to this program. I want > to be able to change the background color, add some headers, and put a > table below the map that will be displayed. Could someone please tell > me how to add this to the current program

Re: regexp non-greedy matching bug?

2005-12-05 Thread Fredrik Lundh
Aahz wrote: > While you're technically correct, I've been bitten too many times by > forgetting whether to use match() or search(). I've fixed that problem > by choosing to always use search() and combine with ^ as appropriate. that's a bit suboptimal, though, at least for cases where failed mat

Re: Help needed: file writing problem with subprocess

2005-12-05 Thread Fredrik Lundh
Pekka Niiranen wrote: > I am running Python script in W2K or in WinXP. > The script is started from DOS prompt and writes text file to disk > with codecs.open() in UTF8. > > The problem is: When script writes the file and tries to read it > with by calling itself thru subprocess() the created file

Re: Favorite flavor of Linux? (for python or anything else)

2005-12-05 Thread Fredrik Lundh
"BartlebyScrivener" wrote: > Since it's a python board I'm most interested in the python > implications. I thought you could use, say, a stable Debian > distribution, and still download the newest version of Python > to run on it. works fine. however, since applications shipped with the OS may d

Re: Why my modification of source file doesn't take effectwhendebugging?

2005-12-05 Thread Fredrik Lundh
"Christophe" wrote: > F5 is designed to run the current open file. Sane people won't assume > that pressing twice the F5 key will yield different. Sane people will > assume that when you edit file1.py and press F5, it reparses the file, > but when you edit file2.py and press F5 with file1.py it wo

Re: hash()

2005-12-05 Thread Fredrik Lundh
John Marshall wrote: > For strings of > 1 character, what are the chances > that hash(st) and hash(st[::-1]) would return the > same value? the algorithm is described here: http://effbot.org/zone/python-hash.htm feel free to do a mathematical analysis. a non-mathematical analysis says that

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-05 Thread Fredrik Lundh
Richard Brodie wrote: > I doubt it: a lot of people have asserted something similar over > the years but I don't remember anyone ever bothering to post > a patch people have posted more than just patches; see e.g. http://www.google.com/search?q=corbascript > (and if someone has it disappear

Re: how to check compile options

2005-12-05 Thread Fredrik Lundh
"Michal" <[EMAIL PROTECTED]> wrote: > how i could check, if my python was compiled with option > WANT_HUGE_STACK_SIZE=yes (or option CFLAG: -DTHREAD_STACK_SIZE=0x10) > > i have already installed python 2.3.5 on my freebsd 5.4 from ports, but > i dont remember, if i used this options. to check

Re: XML and namespaces

2005-12-05 Thread Fredrik Lundh
> Is this automatic creation an expected behaviour? > Of course. > Not exactly a bug /.../ So it should probably be optional. > My interpretation of namespace nodes is that the application is > responsible /.../ > I'm sorry but you're wrong on this. > Well, my reading of the DOM L2 spec is suc

Re: insert a dictionary into sql data base

2005-12-05 Thread Fredrik Lundh
David Bear wrote: > The dictionary keys are the field names. The values are the values to be > inserted. > > I am looking for a good pythonic way of expressing this, but I have a > problem with the way lists are represented when converted to strings. > > Lets say my dictionary is > > data = {"fnam

Re: insert a dictionary into sql data base

2005-12-05 Thread Fredrik Lundh
David Bear wrote > Fredrik Lundh wrote: > > > cursor.execute( > > "INSERT INTO table (%s) VALUES (%%s);" % (",".join(fields)), > > *values > > ) > > Thanks for the hint. However, I don't understand the syntax. > > I

Re: Bitching about the documentation...

2005-12-05 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > > The problem with marching in here and saying "fix the docs" is that you are > > an unknown quantity (I certainly don't recognize your email address and as > > far as I've seen you never sign your posts. > > I don't believe my name, etnic heritage, gender, age, employer

Re: wxPython : getting started

2005-12-05 Thread Fredrik Lundh
Peter Milliken wrote: > Perhaps the authors should create a new "release" every 6 months or so just > so people don't get this (mistaken) impression - I am just not sure what they > should put into each new "release" :-) just bump the version number slightly, and add a "tested with " to the READM

Re: XML and namespaces

2005-12-05 Thread Fredrik Lundh
> Leaving such attributes out by default, whilst claiming some kind of > "fine print" standards compliance, is really a recipe for unnecessary user > frustration. > On the contrary, once you start second guessing the standards and making > guesses about what users are really trying to do, and maki

Re: what's wrong with "lambda x : print x/60,x%60"

2005-12-05 Thread Fredrik Lundh
Sybren Stuvel wrote: > def somefunc(x): return x*5 > > How is that a multi-line function definition? but that's namespace pollution! if you do this, nobody will never ever be able to use the name somefunc again! won't somebody please think about the children! -- http://mail.python.org/mailm

Re: apply()?

2005-12-05 Thread Fredrik Lundh
Ron Griswold wrote: > I'm almost positive I've seen a function somewhere that will call a > method of an object given the method's name. Something like: > > apply(obj, "func_name", args) > > is equivalent to: > > obj.func_name(args) > > For some reason I thought this was the apply function, but th

Re: XML and namespaces

2005-12-05 Thread Fredrik Lundh
Alan Kennedy wrote: > [Fredrik Lundh] > > and this hypothetical situation is different from the current situation in > > exactly what way? > > Hmm, not sure I understand what you're getting at. > > If changes are made to minidom that implement non-standard beha

Re: Bitching about the documentation...

2005-12-05 Thread Fredrik Lundh
Grant Edwards wrote: > The correlation isn't as high as it used to be, now that hiding > behind silly nicknames has apparently become socially acceptable > in other venues (web "forums" and "boards" and whatnot). on the other hand, hanging out on web forums and boards is in it- self a good predic

Re: what's wrong with "lambda x : print x/60,x%60"

2005-12-06 Thread Fredrik Lundh
Steve Holden wrote: > One perhaps needs to be a little more careful with instance variables, > but again most *temporaries* are simply local to the method in which > they're called, they don't exist for the lifetime of the instance. and more importantly, temporary variables can be reused. they'r

Re: iron python exe problem

2005-12-06 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I have test.py: > print 'hello' > > I compile using iron python the result is test.exe > > I have got error message when I tried to call test.exe telling that > test.exe is not a valid win32 application. > > How can I solve this problem? since ironpython is still under

Re: shelve seg error

2005-12-06 Thread Fredrik Lundh
Philippe C. Martin wrote: > This code however works, which seems to me means the problem is with the > default database used by shelve ... which one is it ? http://docs.python.org/lib/module-anydbm.html -- http://mail.python.org/mailman/listinfo/python-list

Re: shelve seg error

2005-12-06 Thread Fredrik Lundh
Philippe C. Martin wrote: > Can I ask anydb which db it's using ? the page says If the database file already exists, the whichdb module is used to determine its type and the appropriate module is used; if it does not exist, the first module listed above that can be imported is used

Re: XML and namespaces

2005-12-06 Thread Fredrik Lundh
Alan Kennedy wrote: > [Fredrik Lundh] > > my point was that (unless I'm missing something here), there are at > > least two widely used implementations (libxml2 and the 4DOM domlette > > stuff) that don't interpret the spec in this way. > > Libxml2dom

Re: Documentation suggestions

2005-12-06 Thread Fredrik Lundh
A.M. Kuchling wrote: > There's another struggle within the LibRef: is it a reference or a > tutorial? Does it list methods in alphabetical order so you can look > them up, or does it list them in a pedagogically useful order? I > think it has to be a reference; if each section were to be a tutor

Re: Documentation suggestions

2005-12-06 Thread Fredrik Lundh
Ian Bicking wrote: > > There's another struggle within the LibRef: is it a reference or a > > tutorial? Does it list methods in alphabetical order so you can look > > them up, or does it list them in a pedagogically useful order? I > > think it has to be a reference; if each section were to be a

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-06 Thread Fredrik Lundh
"Zeljko Vrba" wrote: > >> Python recognizes the TAB character as valid indentation. TAB > >> characters are evil. They should be banned from Python source code. > > > > AGREE! AGREE! AGREE! > > > The day TABs are banned from the source, I drop python forever. It took me > too long to get used

Re: Calculating Elapsed Time

2005-12-06 Thread Fredrik Lundh
Jean Johnson wrote: > I have a start and end time that is written using the > following: > > time.strftime("%b %d %Y %H:%M:%S") > > How do I calculate the elapsed time? import time FORMAT = "%b %d %Y %H:%M:%S" t1 = time.strftime(FORMAT) print t1 time.sleep(1) t2 = time.strftime(FORMAT) prin

Re: JPEG decoder not available in PIL

2005-12-06 Thread Fredrik Lundh
"Peter" wrote: > At the last moment I managed to solve this problem and I hope it is > worth supplying the details here. First there is a file in the install > directory libImaging/Jpeg.h which has a line: > > #include "jpeglib.h" > > but there is no such header file. On my system I put: > >

Re: Documentation suggestions

2005-12-07 Thread Fredrik Lundh
Ian Bicking wrote: > > I've proposed adding support for semi-automatic linking to external > > documents, based on a simple tagging model, a couple of times, e.g. > > > > http://mail.python.org/pipermail/python-list/2005-May/280751.html > > http://mail.python.org/pipermail/python-list/2005

Re: Documentation suggestions

2005-12-07 Thread Fredrik Lundh
A.M. Kuchling wrote: > > I've proposed adding support for semi-automatic linking to external > > documents, based on a simple tagging model, a couple of times, e.g. > > > > http://mail.python.org/pipermail/python-list/2005-May/280751.html > > Very interesting. There could be a manually-mainta

Re: XML and namespaces

2005-12-07 Thread Fredrik Lundh
Alan Kennedy wrote: > [Fredrik Lundh] > > but isn't libxml2dom just a binding for libxml2? as I mention above, I had > > libxml2 > > in mind when I wrote "widely used", not the libxml2dom binding itself. > > No, libxml2dom is Paul Boddie's DOM

Re: Bitching about the documentation...

2005-12-07 Thread Fredrik Lundh
Steven D'Aprano wrote: > "Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo." Did you mean: Badger badger Badger badger badger badger Badger badger Mushroom! Mushroom! -- http://mail.python.org/mailman/listinfo/python-list

Re: Usenet falsehoods (was Re: Bitching about the documentation...)

2005-12-07 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Real people have real names. Using your real name on the net makes > you less virtual to the people you communicate with. on the other hand, http://www.python.org/doc/Humor.html#timbot2 -- http://mail.python.org/mailman/listinfo/python-list

Re: python: how to get an executable archive?

2005-12-07 Thread Fredrik Lundh
"giangiammy" wrote: > I'm starting to approch python: I find it a powerful language, > but, I'd like to get, ad result of my program, something > containing every python lib necessary to run (on linux systems): > > i.e.: my application should be bounbled with the python > interpreter and the neede

Re: Calculating Elapsed Time

2005-12-07 Thread Fredrik Lundh
Peter Hansen wrote: > Going by memory, Linux will generally be 1ms resolution (I might be > off by 10 there...), while Windows XP has about 64 ticks per second, > so .015625 resolution... here's a silly little script that measures the difference between two distinct return values, and reports the

Re: Calculating Elapsed Time

2005-12-07 Thread Fredrik Lundh
Grant Edwards wrote: > >> Going by memory, Linux will generally be 1ms resolution (I might be > >> off by 10 there...), while Windows XP has about 64 ticks per second, > >> so .015625 resolution... > > > > here's a silly little script that measures the difference between > > two distinct return va

Re: Calculating Elapsed Time

2005-12-07 Thread Fredrik Lundh
Grant Edwards wrote: > > Yeah, I said it was silly. On the other hand, the Linux box is a lot faster > > than the Windows box I'm using, and I do get the same result no matter > > what Python version I'm using... except if I run it under my latest 2.4 build, where I get 524288 ... > > > > (and

Re: Bitching about the documentation...

2005-12-07 Thread Fredrik Lundh
Steven D'Aprano wrote: > S > P > O > I > L > E > R > > S > P > A > C > E > > > > Buffalo from the city of Buffalo, which are intimidated by buffalo > from Buffalo, also intimidate buffalo from Buffalo. Did you mean: Bagder from the city of Badger, who is pestered by a badger from Badger, also pe

Re: Bitching about the documentation...

2005-12-07 Thread Fredrik Lundh
Steven D'Aprano wrote: > > Did you mean: Badger badger Badger badger badger badger Badger badger > > Mushroom! Mushroom! > > Er... no, I can't parse that. I suffered a Too Much Recursion error about > the third Badger (I only have a limited runtime stack). > > I asked my missus about this one, sh

Re: Bitching about the documentation...

2005-12-07 Thread Fredrik Lundh
Rocco Moretti wrote: > Insert punctuation & capitalization to make the following a correct and > coherent (if not a little tourtured). > > fred where guido had had had had had had had had had had had a better > effect on the reader punctuation, including quote marks, I presume? it's not time to

Re: List index question

2005-12-07 Thread Fredrik Lundh
"questions?" wrote: >I want to do list index function. y=['1','2','3','4'] y > ['1', '2', '3', '4'] y.index['2'] make that: >>> y.index('2') -- http://mail.python.org/mailman/listinfo/python-list

Re: ElementTree - Why not part of the core?

2005-12-07 Thread Fredrik Lundh
Steven Bethard wrote: > > ElementTree on the other hand provides incredibly easy access to XML > > elements and works in a more Pythonic way. Why has the API not been > > included in the Python core? > > While I fully agree that ElementTree is far more Pythonic than the > dom-based stuff in the c

Re: opening a file using a relative path from a subclass in a package

2005-12-07 Thread Fredrik Lundh
"spike grobstein" write: > I understand why it wasn't working and it makes sense based on the > structure of namespaces that python defines, however, I'm just > surprised that there isn't some kind of built-in facility for dealing > with these types of things. > > Module packages are a spectacular

Re: Documentation suggestions

2005-12-07 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > The builtins section should be moved to the language > reference manual. The material it documents is part > of the language definition, not part of an add-on library. the standard library is not an add-on. you're confused. -- http://mail.python.org/mailman/list

Re: Documentation suggestions

2005-12-07 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Fredrik Lundh wrote: > > [EMAIL PROTECTED] wrote: > > > > > The builtins section should be moved to the language > > > reference manual. The material it documents is part > > > of the language definition, not part of an add-o

Re: Documentation suggestions

2005-12-07 Thread Fredrik Lundh
Ian Bicking wrote: > > the standard library is not an add-on. you're confused. > > I think the point is that there is the core language, and from a user's > perspective builtins and statements and syntax are all the same thing. > When you import a module, it's more-or-less obvious where you find

Re: Documentation suggestions

2005-12-07 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > > wasn't the idea to get rid of the language reference altogether, and > > replace it with a better introduction ? > > Can an introduction provide the information the language > reference provides (or maybe I am misunderstanding what > you mean by introduction.) from th

Re: Mutability of function arguments?

2005-12-07 Thread Fredrik Lundh
"ex_ottoyuhr" wrote: > I've looked around on this newsgroup and elsewhere, and I gather that > this is a very common concern in Python, but one which is ordinarily > answered with "No, you can't. Neat, huh?" A few websites, newsgroup > posts, etc. have recommended that one ask for a more "Pythonic

Re: sql escaping module

2005-12-07 Thread Fredrik Lundh
David Bear wrote: > Being new to pgdb, I'm finding there are lot of things I don't understand > when I read the PEP and the sparse documentation on pgdb. > > I was hoping there would be a module that would properly escape longer text > strings to prevent sql injection -- and other things just make

Re: sql escaping module

2005-12-07 Thread Fredrik Lundh
Fredrik Lundh wrote: >> web searchs for 'python sql escape string' yeild way too many results. >> >> Any pointers would be greatly appreciated. > > for x in range(100): >print "USE PARAMETERS TO PASS VALUES TO THE DATABASE" for an ex

Re: sql escaping module

2005-12-08 Thread Fredrik Lundh
Frank Millman wrote: > Each of the API's includes the capability of passing commands in the > form of 'string + parameters' directly into the database. This means > that the data values are never embedded into the SQL command at all, > and therefore there is no possibility of injection attacks. a

Re: newbie Q on sdtin word completion

2005-12-08 Thread Fredrik Lundh
"Bernd" wrote: > I'm on a Linux env and try to get > word completion form sdtin done, > like Perl's > $stdin = Complete( "\t: ", @choices ); > > What I have so far shows me the directory listing > on the second hit on TAB and not the list of > choices on the first like I wanted to have. your com

Re: spawnle & umask

2005-12-08 Thread Fredrik Lundh
Yves Glodt wrote: > I tried something like this but the umask part does not work clearly...: > > newpid = > os.spawnle(os.P_NOWAIT,'/usr/bin/touch','/usr/bin/touch','xyz','umask 0113') > > What would be the correct syntax for setting the umask for the created > process...? not sure, but something

Re: ElementTree - Why not part of the core?

2005-12-08 Thread Fredrik Lundh
Magnus Lycka wrote: > We're deploying our software on a number of different platforms. We > certainly depend on Python, so a standard Python install will always > be included. Using standard library modules is for free. Using yet > another third party library has a cost, even if some Cheese Shop o

Re: How to get the extension of a filename from the path

2005-12-08 Thread Fredrik Lundh
"Lad" <[EMAIL PROTECTED]> wrote: > what is a way to get the the extension of a filename from the path? > E.g., on my XP windows the path can be > C:\Pictures\MyDocs\test.txt > and I would like to get > the the extension of the filename, that is here > txt > > I would like that to work on Linux a

Re: Encoding of file names

2005-12-08 Thread Fredrik Lundh
"utabintarbo" wrote: > I am trying to programatically access files created on an IBM AIX > system, stored on a Sun OS 5.8 fileserver, through a samba-mapped drive > on a Win32 system. Not confused? OK, let's move on... ;-) > > When I ask for an os.listdir() of a relevant directory, I get filenames

Re: Mutability of function arguments?

2005-12-08 Thread Fredrik Lundh
Mike Meyer wrote: > Your description of "passes references by value" is a description of > call by reference. C passes all arguments by value, to pass a > reference, the C programmer creates the reference to the value "by > hand", then dereferences it by hand at the other end. So C's > "call-by-re

Re: Documentation suggestions

2005-12-08 Thread Fredrik Lundh
A.M. Kuchling wrote: > > of the seealso environment. I'll talk to Fred about it and begin > > assembling a patch. > > Patch #1376361: http://www.python.org/sf/1376361 . I still need to talk > to Fred about this. cool. can you post a sample page somewhere? -- http://mail.python.org/mailma

Re: small inconsistency in ElementTree (1.2.6)

2005-12-08 Thread Fredrik Lundh
Damjan wrote: > Attached is the smallest test case, that shows that ElementTree returns > a string object if the text in the tree is only ascii, but returns a unicode > object otherwise. > > This would make sense if the sting object and unicode object were > interchangeable... but they are not - o

Re: Python-list Digest, Vol 27, Issue 123

2005-12-08 Thread Fredrik Lundh
Michael Williams wrote: > Thanks, Heiko, I'll give this a try. In the meantime, I'll try to > explain what exactly I mean. > > Basically, I want the ability to reference a variable just as I am > able to set a variable (or attribute) on the fly. For instance, say > the user has the following lis

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-09 Thread Fredrik Lundh
Zeljko Vrba wrote: > But look at the following example: > > if a: > some_code1 > if b: > some_code2 > > If I accidentaly delete if b:, then some_code2 gets under the if a: which is > not intended. not to mention that if you have if a: some_code1 some_code2 and accidental

Re: idea of building python module using pyrex

2005-12-09 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I have an idea to build python module to speed up python code in some > of field where pyrex shines such as numeric, code which needs a lot of > looping etc. > > What do you think? I don't think you need anyone's permission to do that, really. Just grab the tools and s

Re: Is there anything that pickle + copy_reg cannot serialize?

2005-12-09 Thread Fredrik Lundh
Maurice LING wrote: > Sorry for not specifying clearly enough. Given that copy_reg lets you > specify arbitrary code to serialize arbitrary objects, of which some are > taken care of by pickle, in the set of possible Python types, the types module contains a selection of type objects; the set of

Re: uuDecode problem

2005-12-09 Thread Fredrik Lundh
"py" wrote: > What would you suggest? I have to encode/decode in chunks b/c of the > 45 byte limitation. so use 45-byte chunks, instead of one-byte chunks. but why are you using UU encoding in a nonstandard way ? why not just use the "uu" module to do the chunking for you? the third example o

Re: idea of building python module using pyrex

2005-12-09 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I just wonder if someone has already build it. built what? it's not like nobody's ever built a Python module using Pyrex before, so I guess you have to be a bit more precise if you want feedback. -- http://mail.python.org/mailman/listinfo/python-list

Re: Dectecting dir changes

2005-12-09 Thread Fredrik Lundh
"chuck" <[EMAIL PROTECTED]> wrote: > I need to write a daemon for Solaris that monitors a directory for > incoming FTP transfers. Under certain conditions, when the transfer is > complete I need to send an email notification, and do other stuff. > Win32 provides FindFirstChangeNotification(), but

Re: Dectecting dir changes

2005-12-09 Thread Fredrik Lundh
"chuck" wrote: > I think you may have missed my point. I don't have fcntl.py on my > Solaris box so how do I know what signals that I can used to monitor a > directory for modification. In other words will the following work? > > fcntl.fcntl(self.fd, fcntl.F_NOTIFY, > fcntl.DN_DELETE|fcntl.DN_CR

Re: small inconsistency in ElementTree (1.2.6)

2005-12-09 Thread Fredrik Lundh
Damjan wrote: > > ascii strings and unicode strings are perfectly interchangable, with some > > minor exceptions. > > It's not only translate, it's decode too... why would you use decode on the strings you get back from ET ? > probably other methods and behaviour differ too. > > And the bigger p

Re: is this a unicode/string bug?

2005-12-09 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I was going to submit to sourceforge, but my unicode skills are weak. > I was trying to strip characters from a string that contained values > outside of ASCII. I though I could just encode as 'ascii' in 'replace' > mode but it threw an error. Strangely enough, if I de

<    2   3   4   5   6   7   8   9   10   11   >