Re: generator expression works in shell, NameError in script

2009-06-19 Thread Mark Dickinson
ved in the innermost enclosing function scope. If a class definition occurs in a chain of nested scopes, the resolution process skips class definitions. This rule prevents odd interactions between class attributes and local variable access.""" Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Measuring Fractal Dimension ?

2009-06-19 Thread Mark Dickinson
rom a parametrization by an interval. > Then the second definition you cite: Amazon says the > prerequisites are two years of calculus. The stanard > meaning of log is log base e, even though means > log base 10 in calculus. Sorry, I've lost context for this comment. Why are logs relevant? (I'm very well aware of the debates over the meaning of log, having frequently had to help students 'unlearn' their "log=log10" mindset when starting a first post-calculus course). Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Measuring Fractal Dimension ?

2009-06-19 Thread Mark Dickinson
On Jun 17, 12:52 pm, Mark Dickinson wrote: > g_n(t) = nt if 0 <= t <= 1/n else 1 Whoops. Wrong definition. That should be: g_n(t) = nt if 0 <= t <= 1/n else n(2/n-t) if 1/n <= t <= 2/n else 0 Then my claim that g_n(t) -> 0 for all t might actuall

Re: Measuring Fractal Dimension ?

2009-06-22 Thread Mark Dickinson
can find a better place to have this discussion; I think there are still plenty of interesting things to say, but I fear we're rather abusing the hospitality of comp.lang.python at the moment. I'd suggest moving it to sci.math, except that I've seen the noise/signal ra

Re: UnicodeDecodeError: problem when path contain folder start withcharacter 'u

2009-06-22 Thread Mark Tolonen
"aberry" wrote in message news:[email protected]... I am facing an error on Unicode decoding of path if it contain a folder/file name starting with character 'u' . Here is what I did in IDLE 1. >>> fp = "C:\\ab\\anil" 2. >>> unicode(fp, "unicode_escape") 3. u'C:\x07b\x07nil' 4.

Re: Measuring Fractal Dimension ?

2009-06-23 Thread Mark Dickinson
roblems, like claiming that 0**0 is undefined while infinity**0 is 1.) [*] A notable exception is Michael Spivak's 'Calculus', which also happens to be the book I learnt calculus from many years ago. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: UnicodeDecodeError: problem when path contain folder startwithcharacter 'u

2009-06-23 Thread Mark Tolonen
"aberry" wrote in message news:[email protected]... Mark Tolonen-3 wrote: "aberry" wrote in message news:[email protected]... I am facing an error on Unicode decoding of path if it contain a folder/file name starting with character 'u'

Re: Measuring Fractal Dimension ?

2009-06-24 Thread Mark Dickinson
On Jun 24, 10:12 am, pdpi wrote: > Regarding inf ** 0, why does IEEE745 define it as 1, when there is a > perfectly fine NaN value? Have a look at: http://www.eecs.berkeley.edu/~wkahan/ieee754status/ieee754.ps (see particularly page 9). Mark -- http://mail.python.org/mailman/listinfo/

Re: Measuring Fractal Dimension ?

2009-06-24 Thread Mark Dickinson
y and positive real x, and in this context one can make a good argument that 0**0 should be undefined; but at the same time it's also used in contexts where y is naturally thought of as an integer; and in the latter context bad things happen if you don't define pow(0, 0) to b

Re: os.walk and os.listdir problems python 3.0+

2009-06-24 Thread Mark Tolonen
default system encoding to encode the Unicode strings into a file. On Windows, the filesystem uses Unicode and supports the full character set, but cp1252 (on your system) is the default text file encoding, which doesn't support zero-width space. Specify an encoding for the output file such as UTF-8: f=open('blah.txt','w',encoding='utf8') f.write('\u200b') 1 f.close() -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: 3.2*2 is 9.6 ... or maybe it isn't?

2009-06-25 Thread Mark Dickinson
7;t ask why I typed *that*, > I don*t know, I just did). And the answer wasn't 9.6. > > [examples snipped] Hi Bojan, This is a FAQ. Take a look at: http://docs.python.org/tutorial/floatingpoint.html and let us know whether that explains things to your satisfaction. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: 3.2*2 is 9.6 ... or maybe it isn't?

2009-06-25 Thread Mark Dickinson
On Jun 25, 7:04 pm, Bojan Sudarevic wrote: > The first thing I typed into it was 3.2*3 (don't ask why I typed *that*, > I don*t know, I just did). And the answer wasn't 9.6. It looks like it's false in PHP too, by the way (not that I know any PHP, so I could well be missing something...) bernou

Re: 3.2*2 is 9.6 ... or maybe it isn't?

2009-06-25 Thread Mark Dickinson
imal('7.12348'))/2 Decimal('7.12345') Similarly, sqrt(x*x) == x is always true for a positive IEEE 754 double x (again assuming the default roundTiesToEven rounding mode, and assuming that x*x neither overflows nor underflows). But this property fails for IEEE 754-compliant decimal floating-point. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: python3 fail to start

2009-06-30 Thread Mark Dickinson
and the problem. anyone can help? Hmm. It's working fine for me (OS X 10.5.7/Macbook Pro). What version of OS X are you using? How are you running python3---by typing 'python3' at a Terminal prompt, I assume? What's the output of the 'locale' command on your system? Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: getting rid of —

2009-07-03 Thread Mark Tolonen
e the above script in windows-1252 encoding and change the coding line to windows-1252 I get the same results, but the decode byte is 0x97. # coding: windows-1252 data = u'foo — bar' print repr(u'—'.encode('utf-8')) print repr(u'—'.encode('windows-1252')) print data.split(u'—') print data.split('—') '\xe2\x80\x94' '\x97' [u'foo ', u' bar'] Traceback (most recent call last): File "C:\dev\python\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 427, in ImportFile exec codeObj in __main__.__dict__ File "", line 1, in File "x.py", line 6, in print data.split('ק) UnicodeDecodeError: 'ascii' codec can't decode byte 0x97 in position 0: ordinal not in range(128) -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Compiling 64 bit python on a mac - cannot compute sizeof (int)

2009-07-03 Thread Mark Dickinson
I think using --enable-universalsdk=/ also works on my system. If none of that helps, you might try asking this question over on the pythonmac- sig mailing list. (http://mail.python.org/mailman/listinfo/pythonmac- sig) Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: How Python Implements "long integer"?

2009-07-05 Thread Mark Dickinson
7;t really understand the question: what do you mean by 'first'? It might help if you tell us what your aims are. In any case, you probably also want to look at the Include/ longintrepr.h and Include/longobject.h files. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: How Python Implements "long integer"?

2009-07-05 Thread Mark Dickinson
cessary zeros) and returns. As far as memory allocation goes: almost all operations call _PyLong_New at some point. (Except in py3k, where it's a bit more complicated because small integers are cached.) If you have more specific questions I'll have a go at answering them. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: How Python Implements "long integer"?

2009-07-06 Thread Mark Dickinson
e is constant in > all environments (Linux, Windows, Mobiles, etc.)? I think it would be dangerous to rely on this struct staying constant, even just for CPython. It's entirely possible that the representation of Python longs could change in Python 2.8 or 3.2. You should use the public

Re: A Bug By Any Other Name ...

2009-07-06 Thread Mark Dickinson
l/python-ideas/2009-March/003741.html Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: How Python Implements "long integer"?

2009-07-07 Thread Mark Dickinson
On Jul 6, 4:13 pm, Pedram wrote: > On Jul 6, 5:46 pm, Mark Dickinson wrote: > > On Jul 6, 1:24 pm, Pedram wrote: > > > > OK, fine, I read longobject.c at last! :) > > > I found that longobject is a structure like this: > > > > struct _longo

Re: python3 fail to start

2009-07-09 Thread Mark Dickinson
ked? I managed to reproduce the crash by starting python3 (again at a Terminal prompt) with: LANG=UTF-8 python3 So I suspect that your locale settings are part of the problem. As a temporary workaround, something like LANG=en_US.UTF-8 python3 might work. (Substitute whatever language setting i

Re: missing 'xor' Boolean operator

2009-07-14 Thread Mark Dickinson
'or' are special in that they have useful short- circuiting behaviour; xor doesn't have this property (that is, you always need to evaluate *both* operands to determine the result). I'd also guess that 'xor' would be much less used than 'and' or 'or', but maybe that's just a reflection of the sort of code that I tend to write. -- Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: bad behaviour in interactive Python prompt

2009-07-14 Thread Mark Dickinson
urce, then the problem is probably that either the readline library is missing, or (much more likely) the include files for the readline library are missing. Look for a package called something like libreadline5-dev or readline-devel and install it, and then try rebuilding Python. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: missing 'xor' Boolean operator

2009-07-14 Thread Mark Dickinson
On Jul 14, 8:43 pm, Chris Rebert wrote: > On Tue, Jul 14, 2009 at 11:47 AM, Mark Dickinson wrote: > > (1) It's easy to emulate xor:  'x xor y' <-> bool(x) != bool(y) > > Using the xor bitwise operator is also an option: > bool(x) ^ bool(y) Good poi

Re: missing 'xor' Boolean operator

2009-07-15 Thread Mark Dickinson
> >    for arg in args: >       if bool(arg): result= not result It's more idiomatic to say "if arg: ..." rather than "if bool (arg): ...". > >    return result Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: missing 'xor' Boolean operator

2009-07-15 Thread Mark Dickinson
On Jul 15, 7:29 pm, Wayne Brehaut wrote: > On Tue, 14 Jul 2009 11:47:41 -0700 (PDT), Mark Dickinson > wrote: > >I'd also guess that 'xor' would be much less used than 'and' or 'or', > >but maybe that's just a reflection of the sort of

Why aren't OrderedDicts comparable with < etc?

2009-07-15 Thread Mark Summerfield
Hi, I'm just wondering why <, <=, >=, and > are not supported by collections.OrderedDict: >>> d1 = collections.OrderedDict((("a",1),("z",2),("k",3))) >>> d2 = d1.copy() >>> d2["z"] = 4 >>> d1 == d2 False >>> d1 < d2 Traceback (most recent call last): File "", line

Re: missing 'xor' Boolean operator

2009-07-18 Thread Mark Dickinson
x27;a and b or c' idiom. See PEP 308, and: http://mail.python.org/pipermail/python-dev/2005-September/056546.html In my own code, I'm finding myself increasingly using conditional expressions where I would once have used 'and' or 'or': daysInAdvance = int(inputVar

difference in printing to screen Mac / Windows

2009-07-18 Thread Mark Bakker
0 1 2 3 4 5 6 7 8 9 Any thoughts on how I can make Python behave to get the Python behavior of my PC on my Mac? Thanks, Mark -- http://mail.python.org/mailman/listinfo/python-list

ANN: Shed Skin 0.2, an experimental (restricted) Python-to-C++ compiler

2009-07-19 Thread Mark Dufour
, loops such as 'for a, b in enumerate/zip(sequence[, sequence])' should now be dramatically faster (also inside list comprehensions), by avoiding allocation of intermediate tuples. Finally, basic list slicing should now be much faster. Please try it out! Mark Dufour. -- "

Re: missing 'xor' Boolean operator

2009-07-21 Thread Mark Dickinson
> Since the 'and' and 'or' already return objects (and objects evaluate to > true or false), then 'xor' should behave likewise, IMO.  I expect that > would be the case if it were ever added to the language. I'm not so sure. Did you ever wonder why the any() and all() functions introduced in 2.5 return a boolean rather than returning one of their arguments? (I did, and I'm still not sure what the answer is.) Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Python

2009-07-22 Thread Mark Lawrence
khanh le wrote: do you have any materials about Python? can you show me the link of Python or some books? thanks a lots! -- Regard! Khanh This comes highly recommeended http://diveintopython.org/ Regards. -- http://mail.python.org/mailman/listinfo/python-list

Re: regex: multiple matching for one string

2009-07-23 Thread Mark Lawrence
[email protected] wrote: For example, I have a string "#a=valuea;b=valueb;c=valuec;", and I will like to take out the values (valuea, valueb, and valuec). How do I do that in Python? The group method will only return the matched part. Thanks. p = re.compile('#a=*;b=*;c=*;') m = p.match(

strange python scripting error

2009-07-23 Thread Mark Tarver
e absolutely the same. The only hint at a difference I can see is that my ftp program says the files are of unequal lengths. test.py is 129 bytes long. python.py 134 bytes long. A zipped folder containing both files is at www.lambdassociates.org/weird.zip Any ideas welcome. Mark -- http:/

Re: Help understanding the decisions *behind* python?

2009-07-23 Thread Mark Lawrence
whereas that for the mutable list must be liable to change. You might like to look at the recent thread on this ng 'List insertion cost' and follow the links to Raymond Hettinger's power point presentation. Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: strange python scripting error

2009-07-23 Thread Mark Tarver
On 23 July, 18:01, Dennis Lee Bieber wrote: > On Thu, 23 Jul 2009 08:48:46 -0700 (PDT), Mark Tarver > declaimed the following in > gmane.comp.python.general: > > > I have a very strange error.  I have two test python files test.py and > > python.py which co

Re: strange python scripting error

2009-07-23 Thread Mark Tarver
On 23 July, 18:01, Dennis Lee Bieber wrote: > On Thu, 23 Jul 2009 08:48:46 -0700 (PDT), Mark Tarver > declaimed the following in > gmane.comp.python.general: > > > The only hint at a difference I can see is that my ftp program says > > the files are of unequal lengths.  t

Re: how to get no value

2009-07-24 Thread Mark Lawrence
R Mohali Chandigarh INDIA Try writing correct rather than incorrect code. Or as has been repeatedly stated get somone from your CS department to help. -- Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: len() should always return something

2009-07-24 Thread Mark Dickinson
On Jul 24, 3:11 pm, "Rhodri James" wrote: > Which doesn't make your point less valid.  In fact I'd go so > far as to argue that what len() gives you is the number of > items in a container, so len(7) should return 0. Nah. 7 contains three bits, so len(7) sho

Re: len() should always return something

2009-07-24 Thread Mark Lawrence
essing strings to a single bit is easy. It's the uncompressing that's tricky. I assume you mean ord("7")%2? First one to correctly decompress the value 0 into an ASCII character wins the title of the world's most capable hacker :p Marcus asciichar = chr(len(0)) if th

Re: strange python scripting error

2009-07-25 Thread Mark Tarver
On 24 July, 15:45, nn wrote: > On Jul 23, 7:03 pm, Dave Angel wrote: > > > > > > > Mark Tarver wrote: > > > I have a very strange error.  I have two test python files test.py and > > > python.py which contain the following code > > > >

Re: strange python scripting error

2009-07-25 Thread Mark Tarver
On 25 July, 10:30, Mark Tarver wrote: > On 24 July, 15:45, nn wrote: > > > > > > > On Jul 23, 7:03 pm, Dave Angel wrote: > > > > Mark Tarver wrote: > > > > I have a very strange error.  I have two test python files test.py and > > > >

Re: Mutable Strings - Any libraries that offer this?

2009-07-26 Thread Mark Lawrence
ffer print gapbuffer.GapBuffer(range(10))[:] GapBuffer('i')] If my sleuthing is correct the problem is with these lines ilow *= self->itemSize; ihigh *= self->itemSize; in GapBuffer_slice being computed before ilow and ihigh are compared to anything. Python 2.6.2 32 bit Windows.

Re: missing 'xor' Boolean operator

2009-07-27 Thread Mark Dickinson
On Jul 27, 1:53 am, "Delaney, Timothy (Tim)" wrote: > Mark Dickinson wrote: > >> Since the 'and' and 'or' already return objects (and objects > >> evaluate to true or false), then 'xor' should behave likewise, IMO. > >> I ex

Re: Need help in passing a "-c command" argument to the interactive shell.

2009-07-28 Thread Mark Lawrence
ut to no avail. You've told python to run the command "import re" which it's happily done before exiting. Simply type python, then at the prompt (default >>>) type whatever commands you wish, e.g. c:\Users\Mark\python\regex>python Python 2.6.2 (r262:71605, Apr 14

Re: need help using Tkinter

2009-07-28 Thread Mark Roseman
In Python > 3.1 the module is called "tkinter", not "Tkinter" (names are > case-sensitive). Further to the above, you can find my Tkinter tutorial (which uses Python 3.x) at http://www.tkdocs.com -- I hope this will provide some help in getting up to speed. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: New implementation of re module

2009-07-28 Thread Mark Lawrence
the files bm_regex_effbot.py and bm_regex_v8.py from http://code.google.com/p/unladen-swallow/source/browse/#svn/tests/performance and ran them, then reran them having substituted regex for re. Output timings were roughly effbot re 0.14secs, effbot regex 1.16secs, v8 re 0.17secs and v8 regex 0.67secs. HTH. -- Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: socket send

2009-07-30 Thread Mark Tolonen
an appropriate encoding (ascii, latin-1, windows-1252, utf-8, etc.): clientSock.send(buff.encode('ascii')) When reading from the socket, you can decode() the byte strings back into Unicode strings. data = clientSock.recv(1024).decode('ascii') -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Python docs disappointing

2009-07-31 Thread Mark Lawrence
t from that what have the Pythonistas ever done for us? Nothing!:) -- Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python docs disappointing

2009-07-31 Thread Mark Lawrence
cs (>= 2.6) The interface has changed drastically as to render itself completely useless. The old docs (<= 2.5) --the ones i learned from-- where flawless. @ Mark Lawrence Have you clicked any of those links? try the "Tutorial start here" and then try to find a menu of sorts. It se

Re: Python docs disappointing

2009-07-31 Thread Mark Lawrence
r wrote: On Jul 31, 4:53 pm, Mark Lawrence wrote: r wrote: On Jul 31, 4:16 pm, Carl Banks wrote: On Jul 31, 1:10 pm, kj wrote: I'm pretty new to Python, and I like a lot overall, but I find the documentation for Python rather poor, overall. I'm sure that Python experts don&#

Re: possible to round number and convert to string?

2009-08-01 Thread Mark Dickinson
nformation. >>> num2str = '{0:.{1}f}'.format >>> num2str(3.14159, 3) '3.142' (In Python 3.1, num2str = '{:.{}f}'.format is enough.) Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: iterate lines with regex

2009-08-01 Thread Mark Lawrence
oup(1) thisMap = map.search(line).group(1) thisParcel = parcel.search(line).group(1) except: continue The bare except will hide any errors in the lines above it. Either catch errors that you expect or take the try-except out. -- Kindest regards. Mark Lawrence. -- http

Re: Newbie thwarted by sys.path on Vista

2009-08-02 Thread Mark Lawrence
a list, and is writeable. Yes, but I'm mainly playing in IDLE and I was getting a bit fed up of repeatedly typing import sys sys.path.append('C:/Users/Michael/Code/Python') import mystuff -- Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie thwarted by sys.path on Vista

2009-08-02 Thread Mark Lawrence
Michael M Mason wrote: "Mark Lawrence" wrote in message news:[email protected]... Be careful, I'm screwed things up on several occasions by placing a file on PYTHONPATH that overrides a file in the standard library, test.py being my favourite!

Re: Overlap in python

2009-08-04 Thread Mark Lawrence
en't tried but could you adapt this:- data = [ 1, 4,5,6, 10, 15,16,17,18, 22, 25,26,27,28] for k, g in groupby(enumerate(data), lambda (i,x):i-x): print map(itemgetter(1), g) found here http://www.python.org/doc/2.6.2/library/itertools.html#module-itertools -- Kindest regards.

Re: Overlap in python

2009-08-04 Thread Mark Dickinson
n list, accumulating blocks along the way. count = 0 for i, (pt, startend, name) in enumerate(transitions): if startend == 'Start': if not count: start = pt names = [] count += 1 names.append(name) else: count -= 1 if not

Re: Overlap in python

2009-08-04 Thread Mark Dickinson
On Aug 4, 9:03 pm, Mark Dickinson wrote: > for i, (pt, startend, name) in enumerate(transitions): Whoops. That line should just be: for pt, startend, name in transitions: The enumerate was accidentally left-over from a more complicated version. -- Mark -- http://mail.python.org/mail

Re: Overlap in python

2009-08-05 Thread Mark Lawrence
don't know if this is relevant, but http://planet.python.org/ has an entry dated this morning which points here http://www.logarithmic.net/pfh/blog/01249470842. HTH. -- Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is it possible to produce spider plots?

2009-08-05 Thread Mark Lawrence
, Dan http://www.answers.com/topic/spider-plot How about http://matplotlib.sourceforge.net/examples/api/radar_chart.html?highlight=spider -- Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: XML flaw

2009-08-06 Thread Mark Lawrence
than trivial issues like Denial of Service atacks via XML. Sorry, just couldn't resist. -- Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: unicode() vs. s.decode()

2009-08-07 Thread Mark Lawrence
involving thousands or millions of characters is more meaningful? Or to go the other way, you are unlikely to write for c in 'äöüÄÖÜß': u = unicode(c, 'utf-8') ... Yes? -- Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Bug or feature: double strings as one

2009-08-08 Thread Mark Lawrence
e for this "etc." language but failed dismally. Does it belong here? http://www.thefreecountry.com/compilers/esoteric.shtml -- Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: www.python.org website is down?

2009-08-08 Thread Mark Lawrence
periencing the same problem? Yes, it's been down for several hours. -- Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python docs disappointing - group effort to hire writers?

2009-08-08 Thread Mark Lawrence
hing really to do with Python, say a query about which algorithm to use. Response "Not really a Python question, but try ...". Put the same question on (say) the C ng and you'd be told in no uncertain terms to Foxtrot Oscar. -- Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Florida Python training in October

2009-08-10 Thread Mark Lutz
We're pleased to announce a new venue for our Python classes. Python author and trainer Mark Lutz will be teaching a 3-day Python class on October 20-22, in Sarasota, Florida. Come spend 3 days mastering Python, and enjoy all that Florida and its Gulf Coast have to offer while you're h

Re: pybotwar-0.5

2009-08-10 Thread Mark Lawrence
[snip] r "slayer of the galactic-ly stupid!" Can I assume from this that you intend killing yourself, on the grounds that some 10 days ago you couldn't successfully use a windows compiled help file? -- Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Social problems of Python doc [was Re: Python docs disappointing]

2009-08-11 Thread Mark Lawrence
ty, there are attention seekers who are not interested in actual participation. (*) http://bugs.python.org (**) yes, humour is fine, but it doesn't replace actual, informational content Antoine. Thank you for this fine, cultured, reasonable response. Seriously!!! -- Kindest regards. M

Re: Search and write to .txt file

2009-08-11 Thread Mark Lawrence
, why not process it from there, i.e. "for line in firstread". Also look at the docs for the find method, it doesn't return what you think it does. -- Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Extracting matrix from a text file

2009-08-11 Thread Mark Lawrence
more for your help! Best Regards, Bea I think your best bet is to read and action the responses you got to your original email from three days ago. If these have got lost in the post simply search online, they're bound to be archived somewhere. -- Kindest regards. Mark Lawrence. --

Re: Python docs disappointing - group effort to hire writers?

2009-08-11 Thread Mark Lawrence
her provide hard evidence that can persuade me that your perspective on this is correct or shut up. [snip] -- Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python docs disappointing - group effort to hire writers?

2009-08-11 Thread Mark Lawrence
wrong, went here and downloaded the corrected version of the file, which has presumably been available for months! http://www.python.org/download/releases/2.6.2/ And you want newbies let loose on the python docs. As good ole Santa would say, ho, ho, ho! -- Kindest regards. Mark Lawrence. -- ht

Re: Need cleanup advice for multiline string

2009-08-11 Thread Mark Lawrence
ecognize there are syntax errors. Ignore those for now. For starters take a look at http://tinyurl.com/o2o8r8 , just about every combination of string concatenation going there. I assume that one of these will let you leave failMsg where it belongs. -- Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python docs disappointing - group effort to hire writers?

2009-08-11 Thread Mark Lawrence
r wrote: Ah Ha! the docs are broken and i was right all along! Are the good folks at Python dev rolling a new installer as we speak, or we must wait for new version? As I pointed out a few minutes ago thicko, the new version has been available for months. -- Kindest regards. Mark Lawrence

Re: Python docs disappointing - group effort to hire writers?

2009-08-11 Thread Mark Lawrence
Carl Banks wrote: On Aug 11, 1:46 pm, Mark Lawrence wrote: r wrote: Ah Ha! the docs are broken and i was right all along! Are the good folks at Python dev rolling a new installer as we speak, or we must wait for new version? As I pointed out a few minutes ago thicko, the new version has been

Re: Windows 7 : any problems installing or running Python ?

2009-08-11 Thread Mark Hammond
umber of the usually cranky driver developers have expressed the same opinion. Microsoft might actually have a winner here. "Me too" :) Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Social problems of Python doc [was Re: Python docs disappointing]

2009-08-12 Thread Mark Lawrence
foreigners to death, that's more like it. See the following links should anyone be interested. http://www.dorsetforyou.com/index.jsp?articleid=386553 http://www.dorsetforyou.com/index.jsp?articleid=386598 -- Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: best practice for documenting a project? pydoc?

2009-08-12 Thread Mark Lawrence
Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: best practice for documenting a project? pydoc?

2009-08-12 Thread Mark Lawrence
Esmail wrote: Mark Lawrence wrote: Hi Mark, The docs for the constraint package look good, see http://labix.org/python-constraint and http://labix.org/doc/constraint. I think they've been produced with epydoc see http://epydoc.sourceforge.net/ Thanks for the links, I'll take a

Re: matching patterns after regex?

2009-08-12 Thread Mark Lawrence
one is after the , :) You should probably learn how to play with regexes. I personnaly use a visual tool called RX Toolkit[1] that comes with Komodo IDE. [1] http://docs.activestate.com/komodo/4.4/regex.html Haven't tried it myself but how about this? http://re-try.appspot.com/ -- Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python configuration question when python scripts are executed using Appweb as web server.

2009-08-13 Thread Mark Lawrence
istrator but it prevents the user from accidently overwriting a stdlib module. Stdlib modules can still be overwritten with PYTHONPATH." What am I missing? http://www.daimi.au.dk/~chili/PBI/pythonpath.html [snip] -- Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: implementing descriptors

2009-08-13 Thread Mark Lawrence
ndest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling parent constructor with different argument list

2009-08-14 Thread Mark Lawrence
list? Simplest way to get it to work is above using Python 2.6.2 on Windows. I'm sure there are variations depending on your use case, but I'll leave that to the experts. -- Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 'for' loop is memory inefficient

2009-08-14 Thread Mark Lawrence
looping mechanism that generates the index variable values incrementally as they are needed. I have a strong suspicion that you will find hints in the Python documentation that this has already been addressed. Perhaps you could try reading before posting? -- Kindest regards. Mark Lawrence

Re: Python 2.6 still not giving memory back to the OS...

2009-08-15 Thread Mark Dickinson
) >>> f = open('testfile.txt', 'w') >>> f.write(b) >>> del b >>> f = open('testfile.txt') >>> b = f.read() >>> del b and got the expected memory usage for my Python process, as displayed by top: memory usage went up to nearly 1Gb after each assignment to b, then dropped down to 19 Mb or so after each 'del b'. I get similar results under Python 2.5. So maybe there's something in xlrd that's hanging on to all that memory? Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Python docs disappointing - group effort to hire writers?

2009-08-15 Thread Mark Lawrence
Bill Jones wrote: On Aug 8, 3:27 pm, Mark Lawrence wrote: Kee Nethery wrote: As someone trying to learn the language I want to say that the tone on this list towards people who are trying to learn Python feels like it has become anti-newbies. [snip] Kee Nethery My gut feeling (which

Re: What happened to __cmp__() in Python 3.x?

2009-08-15 Thread Mark Lawrence
p://xavierho.com/ http://bytes.com/topic/python/answers/844614-python-3-sorting-comparison-function -- Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: What's a good solution to implement rich comparison for user-defined classes? (was: What happened to __cmp__() in Python 3.x?)

2009-08-15 Thread Mark Lawrence
x27;s your call as to what to do next. -- Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: getting the fractional part of a real?

2009-08-15 Thread Mark Dickinson
I'm missing, like fraction(r)? > >>> import math > >>> math.modf(1.5) > > (0.5, 1.0) What Christian said. math.fmod(r, 1.0) also works. Note that r % 1 and r - int(r) aren't the same thing for negative reals. What sign do you want the result to have when r is negative? Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Splitting a string into substrings of equal size

2009-08-15 Thread Mark Tolonen
1,234,567,890,123,456,789' Gregor Is it? jj = '234567890123456789' ",".join([jj[max(ii-3,0):ii] for ii in range(len(jj)%3,len(jj)+3,3)]) ',234,567,890,123,456,789' At least one other solution in this thread had the same problem. -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: What happened to __cmp__() in Python 3.x?

2009-08-16 Thread Mark Lawrence
Chris Rebert wrote: On Sat, Aug 15, 2009 at 1:06 PM, Mark Lawrence wrote: Xavier Ho wrote: Hey all, I've recently made my way to Python 3.1 and I'm not seeing __cmp__() in the documentation. Is there a substitution for this special method in 3.1, or do I really have to define al

Re: What happened to __cmp__() in Python 3.x?

2009-08-16 Thread Mark Lawrence
t__ or __gt__ * __ge__ or __le__ Cheers, Chris Unfortunately I don't think it's that easy, see. http://mail.python.org/pipermail/python-list/2008-November/688761.html The issue referenced is still open. This of course assumes that I've posted the correct link this time! -- K

Re: What happened to __cmp__() in Python 3.x?

2009-08-16 Thread Mark Lawrence
Xavier Ho wrote: On Sun, Aug 16, 2009 at 9:49 PM, Mark Lawrence wrote: Unfortunately I don't think it's that easy, see. http://mail.python.org/pipermail/python-list/2008-November/688761.html The issue referenced is still open. This of course assumes that I've posted the correct

Re: [Python-Dev] Mercurial migration: help needed

2009-08-18 Thread Mark Hammond
nt item here is currently the win32text stuff. Mark Hammond said he would work on this; Mark, when do you have time for this? Then I could set apart some time for it as well. I can make time, somewhat spasmodically, starting fairly soon. Might I suggest that as a first task I can resurrect my old stale

Re: How do I convert an iterator over bytes into a str?

2009-08-18 Thread Mark Lawrence
he correct way to turn an iterator over bytes into a string? This works, but, ewww: In [8]: "".join(iter("four score and seven years ago")) Out[8]: 'four score and seven years ago' You've started with a string. >>> type("four

Re: Read C++ enum in python

2009-08-19 Thread Mark Tolonen
27;: id = int(entry.value) print '%s_%s = %d' % (item.enum.upper(),entry.name.upper(),id) id += 1 --end code Output: HELLO_ZERO = 0 HELLO_ONE = 1 HELLO_TWO = 2 HELLO_THREE = 3 HELLO_FIVE = 5 HELLO_SIX = 6 HELLO_TEN = 10 BLAH_ALPHA = 0 BLAH_BETA = 1 BLAH_GAMMA = 10 BLAH_ZETA = 50 -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Read C++ enum in python

2009-08-19 Thread Mark Tolonen
"Mark Tolonen" wrote in message news:[email protected]... [snip] This is what 3rd party library pyparsing is great for: begin code-- from pyparsing import * # sample string with enums and other stuff sample = ''' stuff before

Re: Converting DD MM YYYY into YYYY-MM-DD?

2009-08-19 Thread Mark Tolonen
"Gilles Ganault" wrote in message news:[email protected]... I find it odd that the regex library can't handle European characters It can. Read the documentation about the re.LOCALE flag. -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: incrementing string/hex value from file and write back

2009-08-20 Thread Mark Lawrence
val+1 -- --> TypeError: cannot concatenate 'str' and 'int' objects -- f = open('serial.txt', 'rb') val = f.read() val = val + 1 -- --> TypeError: cannot concatenat

<    48   49   50   51   52   53   54   55   56   57   >