Re: Why Is Escaping Data Considered So Magical?

2010-06-29 Thread Mark Lawrence
ed an off-by-one error myself. :) Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: I strongly dislike Python 3

2010-06-30 Thread Mark Lawrence
On 30/06/2010 23:30, Steven D'Aprano wrote: [snips] The rule against premature optimization doesn't just apply to *code*. +1QOTW Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Reversing backslashed escape sequences

2010-06-30 Thread Mark Tolonen
ion 0: ordinal not in range(128) Use 'string-escape': s=['\\n','\\xff','\\023'] for n in s: n.decode('string-escape') ... '\n' '\xff' '\x13' -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Namespace problem?

2010-07-01 Thread Mark Lawrence
s own, but not in the main script. I know it looks funny, but this should preserve the appropriate nesting of things. Certainly doesn't look at all correct to me. Where else could I look to find this problem? In a mirror? :) Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: automate minesweeper with python

2010-07-02 Thread Mark Young
Just tested it in XP, it works. -- http://mail.python.org/mailman/listinfo/python-list

Re: delegation pattern via descriptor

2010-07-03 Thread Mark Lawrence
Have you run this and get your SystemError yet? :) Kindest regards. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list

Re: SyntaxError not honoured in list comprehension?

2010-07-04 Thread Mark Dickinson
r is fairly simple: it's LL(1) (unlike C's, for example), so can be parsed with only 1 token of lookahead. -- Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: SyntaxError not honoured in list comprehension?

2010-07-04 Thread Mark Dickinson
On Jul 4, 9:55 am, Mark Dickinson wrote: > Why?  If Python itself has no problem parsing this code, why should it > be so difficult for editors?  Python's grammar is fairly simple:  it's > LL(1) (unlike C's, for example), so can be parsed with only 1 token of > looka

Re: Getting the name of the file that imported current module

2010-07-04 Thread Mark Lawrence
On 04/07/2010 22:05, Tobiah wrote: foo.py: import bar bar.show_importer() output: 'foo' or 'foo.py' or 'path/to/foo' etc. Possible? Thanks, Tobiah >>> import re >>> re.__file__ 'C:\\Python26\\lib\\re.pyc' HTH. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting the name of the file that imported current module

2010-07-04 Thread Mark Lawrence
On 05/07/2010 00:25, Michael Torrie wrote: On 07/04/2010 03:17 PM, Mark Lawrence wrote: On 04/07/2010 22:05, Tobiah wrote: foo.py: import bar bar.show_importer() output: 'foo' or 'foo.py' or 'path/to/foo' etc. Possible? Thanks, Tobiah >>> imp

Re: SyntaxError not honoured in list comprehension?

2010-07-05 Thread Mark Dickinson
darwin Type "help", "copyright", "credits" or "license" for more information. >>> from cStringIO import StringIO >>> import tokenize, token >>> for tok in tokenize.generate_tokens(StringIO("print9.0").readline): ... print token.tok_name[tok[0]], tok[1] ... NAME print9 NUMBER .0 ENDMARKER -- Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: SyntaxError not honoured in list comprehension?

2010-07-05 Thread Mark Dickinson
ngIO("print9.0").readline): > >         print tokenize.tok_name[tok[0]], tok[1] Ah yes; you're right. Thanks! Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Python -- floating point arithmetic

2010-07-07 Thread Mark Dickinson
_six_plus - sum # but it's closer to point_six True > my next question, why could i run > > print "%.66f" % ( sum ) > > but not > > print "%.67f" % ( sum ) That's a historical artefact resulting from use of a fixed-length buffer somewhere de

Re: C interpreter in Lisp/scheme/python

2010-07-08 Thread Mark Tarver
orted in any of your targets. Qi supports a compiler-compiler Qi- YACC that allows you to write in BNF which makes this kind of project much easier. See http://www.lambdassociates.org/Book/page404.htm for an overview Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Python -- floating point arithmetic

2010-07-08 Thread Mark Dickinson
On Jul 8, 2:00 pm, Adam Skutt wrote: > On Jul 8, 7:23 am, Mark Dickinson wrote:> On Jul 8, > 11:58 am, Adam Skutt wrote: > > > > accurately.  Moreover, in general, it's impossible to even round > > > operations involving transcendental functions to an arbitr

Re: Python -- floating point arithmetic

2010-07-08 Thread Mark Dickinson
On Jul 8, 3:29 pm, Adam Skutt wrote: > On Jul 8, 9:22 am, Mark Dickinson wrote: > > On Jul 8, 2:00 pm, Adam Skutt wrote: > > > For some computations, the number of bits required to > > > get the desired precision can quickly overwhelm the finite limitations > >

Re: Python -- floating point arithmetic

2010-07-08 Thread Mark Dickinson
n is not correctly rounded): > > Decimal('100.0') ** Decimal('-557.71e-74288') Hmm. So it does. Luckily, this particular problem is easy to deal with. Though I dare say that you have more up your sleeve. :)? -- Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Python -- floating point arithmetic

2010-07-08 Thread Mark Dickinson
On Jul 8, 9:52 pm, Wolfram Hinderer wrote: > JFTR, it works because a+b == a+b (while I don't think that a+b == b+a > holds for all a and b). Actually, that's one of the few identities that's safe. Well, for non- NaN IEEE 754 floating-point, at any rate. And assuming that there's no use of exte

Re: 500 tracker orphans; we need more reviewers

2010-07-08 Thread Mark Lawrence
On 19-6-2010 23:45, Shashwat Anand wrote: Terry: Thanks for bringing this to notice. Mark: Kudos for your effort in cleaning up bugs.python.org Like I've said elsewhere, flattery will get you everywhere. :) FYI there are now 480 orphans and I've managed to get 8 issues closed.

Python scripts from DOS

2010-07-09 Thread Mark Carter
On my machine, I can go to a DOS shell, and type myscript.py This will cause the script to be run as a python script. So that bit works. On another machine, on which python was set up without admin privileges, if I type myscript.py it will open the "Open With" dialog box. It wont let me exec

Re: Python Ireland's pre-PyCon drinks - Wed, 14th July @ Trinity Capital Hotel

2010-07-09 Thread Mark Lawrence
had a bad day and forgot to run the unit tests. Kindest regards. Mark Lawrence p.s. Best of luck to the Dutch and Spanish Sunday evening in the World Series Soccer!!! -- http://mail.python.org/mailman/listinfo/python-list

Re: getting the variable type

2010-07-11 Thread Mark Lawrence
') html += f.read() page = { 'html' : html } the third-last item in the list is not a string, it's a function. how do i test for that? Check out the isinstance function here. http://docs.python.org/library/functions.html HTH. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list

Re: integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-11 Thread Mark Dickinson
n how you'd deal with any backwards compatibility problems that your fix introduces. Have you considered forking Python? That may be the way forward here. -- Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-11 Thread Mark Lawrence
the cost of building empty tuples is an actual bottleneck. +1 Kindest regards. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list

Re: Naming Conventions, Where's the Convention Waldo?

2010-07-11 Thread Mark Lawrence
not deep thoughts. Well said Steven, or is it Stephen, or Stephan, or Stefen, or what? Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: round issue

2010-07-12 Thread Mark Dickinson
so specify what rounding mode you want (instead of relying on the default round-half- away-from-zero in 2.x or round-half-to-even in 3.x.) >>> decimal.Decimal('-9.85').quantize(decimal.Decimal('0.1'), >>> rounding=decimal.ROUND_HALF_UP) Decimal('-9.9

Re: ValueError: invalid literal for float(): -1.#IND (pickle.py)

2010-07-12 Thread Mark Dickinson
no longer receiving bugfixes, so it's not going to change there. > BTW: I'm tied to version 2.5 of python Have you tried using pickle protocol 1 or 2, instead of pickle protocol 0? That may well solve your problem. (Those protocols write out the binary form of a float directly,

Re: round issue

2010-07-12 Thread Mark Dickinson
finitely a bug: please report it!) With all this said, asking for *decimal* rounding of *binary* approximations to *decimal* halfway cases to give the results you expect is ... optimistic, to say the least. Use the decimal module if you care about which way your (almost) halfway cases get round

Re: Fascinating interview by Richard Stallman at KTH on emacs history and internals

2010-07-16 Thread Mark Tarver
y would be thrown out. In the old > days, yes we had service contracts for the machines, but it was > essentially a joke. That was a way of getting parts after the expert > hackers from the AI lab fixed the problem. Because if you let the > field-service person fix it it would

Re: ctypes' c_longdouble: underflow error (bug?)

2010-07-16 Thread Mark Dickinson
rning is issued. > i.e., in *both* cases, expl would get passed a double (which gets > automatically cast into a long double), But how on earth would ctypes *know* it's supposed to convert (nitpick: not cast) to a long double? The function signature isn't available to ctypes; it's only through you setting .argtypes and .restype that ctypes knows anything about it. -- Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: improvement for copy.deepcopy : no memo for immutable types

2010-07-16 Thread Mark Lawrence
sue tracker. The oldest open issue I've come across was dated 2001, and there could be older. Unless more volunteers come forward, particularly to do patch reviews or similar, the situation as I see it can only get worse. Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Where is a module usually installed?

2010-07-17 Thread Mark Lawrence
tml#module-site HTH. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list

Re: Is '[' a function or an operator or an language feature?

2010-07-17 Thread Mark Lawrence
com/bill_r/elf/html/elf-1-33.htm I'm just envisaging a "Paper Tape Repairman" sketch. Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Code generator and visitor pattern

2010-07-17 Thread Mark Lawrence
x27;t even be needed. Regards, Mick. Boilerplate, boilerplate everywhere, but not a beer to drink. Hope everyone at EuroPython is having a good time. Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: rstrip()

2010-07-17 Thread Mark Lawrence
g) becoming .strip(set(string)), but it didn't occur to me until too late. :-( Maybe 3.2 which is still in alpha, if not 3.3? Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: why is this group being spammed?

2010-07-18 Thread Mark Lawrence
othing because I read through gmane.comp.python.general. Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Print file via file association using os.system or subprocess? (Windows)

2010-07-18 Thread Mark Hammond
ng to distribute win32 extensions. Thanks, Malcolm You probably want to use the windows ShellExec function with a 'print' verb. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Visitor pattern and separating iteration

2010-07-22 Thread Mark Lawrence
the use of the visitor pattern becomes more and more questionable. What is it I'm missing? Karsten I suggest you google for "python patterns alex martelli". From what I've read, he's forgotten more about Python and/or patterns than most of us will ever know. HTH. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: blist 1.2.0

2010-07-22 Thread Mark Lawrence
ods would mostly be switched in. If it were added and the switching were internal, new test cases would be needed to test test timsort. Does your radix sort meet the stability guarantee of list.sort? Yes. Great. There is, of course, a test for that in the suite. Can I please book front row

Re: Where is the man page of python library

2010-07-23 Thread Mark Lawrence
will be good if the python communities get more > people who like to write documentation. > > Anyway, thank you again. > I'll be on the Python issue tracker later today. I look forward to seeing your first of many contributions to the "poor" Python documentation. Pigs might fly? :) Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiple versions of Python coexisting in the same OS

2010-07-24 Thread Mark Lawrence
-py.aspx HTH. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list

Re: why is this group being spammed?

2010-07-24 Thread Mark Lawrence
r the benefit of those who might have missed it, I'll repeat that I'm reading this from gmane.comp.python.general and see little or no spam. Regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: why is this group being spammed?

2010-07-24 Thread Mark Lawrence
table :)] at filtering spam than the diabolical google groups. I'm unsure as to how the main mailing list that is given above works, I'm sure that someone more knowledgable than myself will soon let us know. Regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: string manipulation.

2010-07-27 Thread Mark Tolonen
string "AB" without the other stuff? Thanks. Whitespace in XML is significant. If the file was: AB100 2 You would just read 'AB'. If you don't control the XML file, then: print name.strip() will remove leading and trailing whitespace. -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Ascii to Unicode.

2010-07-29 Thread Mark Tolonen
x27;utf-8') for line in infile: outfile.write(line) infile.close() outfile.close() As you can see, codecs.open takes a parameter for the encoding of the file. Lines read are automatically decoded into Unicode; Unicode lines written are automatically encoded into a byte stream. -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter Label alignment problem using OS 10.6

2010-07-31 Thread Mark Young
That seems a bit harsh. Place, in general, isn't as useful as pack and grid. Yelling at him for suggesting you use them is unnecessary. When I looked at when your script generates, I don't see why you couldn't just use grid. I can fairly easily see a grid layout. But, I guess it's supposed to be a

Re: Call CFUNCTYPE, class Structure, ctype, dll and Callback function problem

2010-07-31 Thread Mark Tolonen
pec(dllexport) int __stdcall Callback(int a,CB cb) { g_cb = cb; return 1; } __declspec(dllexport) void __stdcall ChangeLinkState(BYTE newState) { LINKSTATE state; state.OldState = g_linkState; state.NewState = newState; g_linkState = newState; g_cb(&state); } -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is there no platform independent way of clearing a terminal?

2010-07-31 Thread Mark Lawrence
uters. Windows users biggest allergy is to this strange world that involves "make" on other boxes, whatever that is, it strikes me as rather archaic. Personally I find double clicking on an msi file rather easier. Regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is there no platform independent way of clearing a terminal?

2010-08-01 Thread Mark Lawrence
On 01/08/2010 07:50, Lawrence D'Oliveiro wrote: In message, Mark Lawrence wrote: Personally I find double clicking on an msi file rather easier. Easier than apt-get dist-upgrade? I'm sorry but I only do English, could you please translate. :) Mark Lawrence. -- http://mail.

Re: Why is there no platform independent way of clearing a terminal?

2010-08-01 Thread Mark Lawrence
On 01/08/2010 08:18, Lawrence D'Oliveiro wrote: In message, Mark Lawrence wrote: On 01/08/2010 07:50, Lawrence D'Oliveiro wrote: In message, Mark Lawrence wrote: Personally I find double clicking on an msi file rather easier. Easier than apt-get dist-upgrade? I'm sorr

Re: Why is there no platform independent way of clearing a terminal?

2010-08-02 Thread Mark Lawrence
On 01/08/2010 12:10, Lawrence D'Oliveiro wrote: In message, Mark Lawrence wrote: On 01/08/2010 08:18, Lawrence D'Oliveiro wrote: In message, Mark Lawrence wrote: On 01/08/2010 07:50, Lawrence D'Oliveiro wrote: In message, Mark Lawrence wrote: Personally I find double cli

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-08-02 Thread Mark Lawrence
. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-08-02 Thread Mark Lawrence
On 02/08/2010 07:15, Michele Simionato wrote: On Jul 31, 5:08 am, Steven D'Aprano wrote: I have read Michelle Simionato's articles on super in Python. One "l" please! I am a man! ;-) Please prove it, get your bits out!!! :) M. Simionato -- http://mail.python.org/mailman/li

Re: Why is there no platform independent way of clearing a terminal?

2010-08-02 Thread Mark Lawrence
On 02/08/2010 16:41, Benjamin Kaplan wrote: On Mon, Aug 2, 2010 at 8:21 AM, Mark Lawrencewrote: On 01/08/2010 12:10, Lawrence D'Oliveiro wrote: In message, Mark Lawrence wrote: On 01/08/2010 08:18, Lawrence D'Oliveiro wrote: In message, Mark Lawrence wrote: On 01/08/

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-08-02 Thread Mark Lawrence
On 02/08/2010 17:53, donn wrote: On 02/08/2010 17:35, Mark Lawrence wrote: aka the colon. :) Ha. This is a case of the colon being the appendix! \d Is there a better newsgroup in the world than c.l.py? No! Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python

Re: Why is there no platform independent way of clearing a terminal?

2010-08-02 Thread Mark Lawrence
cid/amd64/linux-image-2.6.32-21-generic/filelist http://mail.python.org/mailman/listinfo/python-list This is all very well, but what is the unladen airspeed velocity of a swallow in flight? Answers on a postcard please, given that I expect both direction and speed! Kindest regards.

Re: Why is python not written in C++ ?

2010-08-02 Thread Mark Lawrence
the toilet so I can talk to the great white telephone. Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: how best to clear objects from a frame

2010-08-02 Thread Mark Lawrence
echnical content of this thread, but I'm very pleased to see rantingrick being positive, well done!!! :) I know that we've crossed swords in the past but believe that bygones should be bygones. Can we call it quits and help to take Python forward? Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is python not written in C++ ?

2010-08-02 Thread Mark Lawrence
On 03/08/2010 00:03, Aahz wrote: In article, Peter wrote: On Aug 3, 7:42=A0am, Mark Lawrence wrote: On 02/08/2010 00:08, candide wrote: I can't understand why any serious programmer mentions C++. As soon as I read it, I have to rush either to the kitchen to find a bowl to throw up i

Re: Why is python not written in C++ ?

2010-08-02 Thread Mark Lawrence
inal report on Ariane 501 here: http://www.di.unito.it/~damiani/ariane5rep.html A bug is a bug is a bug? Except in my code. Never written a bug in my life. Cross my heart and hope to die. Of course I'm lying. :) Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to run Python 2.7 on Windows 7 and any suggestions onbooks/websites for "dummies guide to python" type learning

2010-08-02 Thread Mark Tolonen
"ben owen" wrote in message news:[email protected]... Hi everyone, I'm new to this and was needing help with trying to learn/work with Python 2.7 on my computer. I'm running Windows 7 and trying to learn python programming from an older book fr

Re: pre-uninstall script in bdist_wininst

2010-08-05 Thread Mark Hammond
e to package the object and inno installer or similar to handle the install and uninstall parts. Mark -- http://mail.python.org/mailman/listinfo/python-list

ANN: Shed Skin 0.5

2010-08-08 Thread Mark Dufour
Hi all, I have just released Shed Skin 0.5, an experimental (restricted) Python-to-C++ compiler. Please see my blog for more details about the release: http://shed-skin.blogspot.com/ Thanks, Mark Dufour. -- http://www.youtube.com/watch?v=E6LsfnBmdnk -- http://mail.python.org/mailman/listinfo

Re: Win7. Why Don't Matplotlib, ... Show up in Control Panel Add-Remove?

2010-08-08 Thread Mark Lawrence
google? Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Floating numbers

2010-08-13 Thread Mark Dickinson
give unpredictable results in halfway cases. (E.g., round(2.675, 2) might give 2.68 or 2.67, depending on what version of Python you're using, and also possibly depending on your platforms.) -- Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Floating numbers

2010-08-13 Thread Mark Dickinson
> > 4858258098025923 > > Possible? See the float.as_integer_ratio method. -- Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: EOFError with fileinput

2010-08-16 Thread Mark Lawrence
files in the file list 'logs'? Thank you, Alex van der Spek I'm not sure exactly what you're asking here. Could you a brief description as to what you're trying to achieve, then put the question again. Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie: strftime object error message

2010-08-16 Thread Mark Lawrence
me.strftime("%Y-%m-%d %H:%M:%S") AttributeError: 'str' object has no attribute 'strftime' NOTE: current_time prints within the function, line does not HTH. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to convert bytearray into integer?

2010-08-16 Thread Mark Dickinson
On Aug 16, 8:08 pm, Jacky wrote: > Hi Thomas, > > Thanks for your comments!  Please check mine inline. > > On Aug 17, 1:50 am, Thomas Jollans wrote: > > > On Monday 16 August 2010, it occurred to Jacky to exclaim: > > > > Hi there, > > > > Recently I'm facing a problem to convert 4 bytes on an by

Re: How to convert bytearray into integer?

2010-08-16 Thread Mark Dickinson
On Aug 16, 8:36 pm, Mark Dickinson wrote: > On Aug 16, 8:08 pm, Jacky wrote: > > My concern is that struct may need to parse the format string, > > construct the list, and de-reference index=0 for this generated list > > to get the int out. > > > There should be som

Re: Python 2.7 support for PyWin32

2010-08-18 Thread Mark Lawrence
/ Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python "why" questions

2010-08-18 Thread Mark Lawrence
er 0 team! Unfortunately, we're stuck with this goofy numbering system in many languages. Fortunately, the trend is away from explicit indexing and toward "for" loops when possible. Bring back Coral 66, all is forgiven. http://www.xgc.com/manuals/xgc-c66-rm/x357.html Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Re: Assert statements in python 3.1

2010-08-20 Thread Mark Dickinson
then in assert(expensive_check) the argument expensive_check would be evaluated both with 'python' and with 'python -O'. -- Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: weakref.proxy behaviour in python 3.0

2010-08-21 Thread Mark Dickinson
on the real underlying objects. *But* C-level tp_compare slots only ever get called when both objects have the same type, so when comparing a real object with the proxy for that object, that's never. In 3.x, that's replace with a proxy_richcompare function for the tp_richcompare slot. So my guess

Re: weakref.proxy behaviour in python 3.0

2010-08-21 Thread Mark Dickinson
On Aug 21, 5:06 pm, Nicholas Cole wrote: > On Sat, Aug 21, 2010 at 3:31 PM, Mark Dickinson wrote: > > [SNIP] > > > So my guess is that the change was unintentional. > > > It's probably worth a bug report.  Even if the behaviour isn't going > > to c

Re: Save/load like matlab?

2010-08-24 Thread Mark Leander
: >>> ssdf.loads(u'a = [0xffff**0x]') Regards Mark http://blog.topicbranch.net/2010/08/ssdf-simple-structured-data-format.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Proper set-up for a co-existant python 2.6 & 3.1 installation

2010-08-25 Thread Mark Tolonen
" \"C:\\Python31\\Lib\\idlelib\\idle.pyw\" -n -e \"%1\"" [HKEY_CLASSES_ROOT\Python.File\shell\Edit with Pythonwin3\command] @="C:\\Python31\\Lib\\site-packages\\Pythonwin\\Pythonwin.exe /edit \"%1\"" [HKEY_CLASSES_ROOT\Python.File\shell\Open with Python3\command] @="\"C:\\Python31\\python.exe\" \"%1\" %*" ---END--- -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: speed of numpy.power()?

2010-08-25 Thread Mark Lawrence
On 25/08/2010 14:59, Carlos Grohmann wrote: Hi all, I'd like to hear from you on the benefits of using numpy.power(x,y) over (x*x*x*x..) I looks to me that numpy.power takes more time to run. cheers Carlos Measure it yourself using the timeit module. Cheers. Mark Lawrence. --

Re: how to transfer my utf8 code saved in a file to gbk code

2009-06-07 Thread Mark Tolonen
quot;rb") content=f.read() print repr(content) print len(content) print content.count("\\") print content.count("x") Try: utf8data = content.decode('string-escape') unicodedata = utf8data.decode('utf8') gbkdata = unicodedata.encode('gbk

urllib2.URLError: error using twill with python

2009-06-08 Thread Mark Devine
Hi I wonder if someone could point me in the right direction. I used the following code to access gmail but I got a urllib2.URLError: error when I ran it. I have included the Traceback import twill, string, os b=twill.commands.get_browser() b.set_agent_string("Mozilla/5.0 (Windows; U; Wi

Re: python version in snow leopard?

2009-06-09 Thread Mark Dickinson
ack in September 2008, there was a 'MajorOS Vendor (tm)' who was interested in getting Python 2.6 into their next OS release, provided that it (Python 2.6) was released by October 1st. Make of that what you will. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: random number including 1 - i.e. [0,1]

2009-06-10 Thread Mark Dickinson
iss lots of possible values. On the other hand, it's easy to find examples of a and b such that random.uniform(a, b) has a significant chance of producing b. For example, take a = 10**16, b = 10**16 + 4, then there's about a 1 in 4 chance of getting b. Or for a more extreme example, simply take a = b. Hence the doc change. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: retrieve bitwise float representation

2009-06-10 Thread Mark Dickinson
n the above would truncate, while the implicit conversion from double to single precision involved in packing with 'f' is more likely to do a round-to-nearest. -- Mark Dickinson -- http://mail.python.org/mailman/listinfo/python-list

Re: random number including 1 - i.e. [0,1]

2009-06-10 Thread Mark Dickinson
ncorrect? The documentation for random.uniform says: """Return a random floating point number N such that a <= N <= b for a <= b and b <= N <= a for b < a.""" And that's precisely what it does. Nowhere does the documentation say that *every* float

Re: random number including 1 - i.e. [0,1]

2009-06-10 Thread Mark Dickinson
On Jun 10, 6:57 pm, Mensanator wrote: > On Jun 10, 12:37 pm, Mark Dickinson wrote: > > > On Jun 10, 6:21 pm, Mensanator wrote: > > > > So, the 2.6.2 documentation is STILL wrong. Before it implied > > > it was ALWAYS a semi-open interval, and now it says it'

Re: random number including 1 - i.e. [0,1]

2009-06-10 Thread Mark Dickinson
ndom()), without worrying about the possibility of taking log of 0. But I don't know why it would be useful to know that endpoints *are* sometimes included, without knowing exactly when. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: random number including 1 - i.e. [0,1]

2009-06-10 Thread Mark Dickinson
Robert Kern wrote: > On 2009-06-10 14:46, Mark Dickinson wrote: >> On Jun 10, 8:15 pm, Robert Kern wrote: >>> On 2009-06-10 13:53, Terry Reedy wrote: >>>> A full technical discussion does not below in the docs, in my opinion. A >>>> wike article woul

Re: random number including 1 - i.e. [0,1]

2009-06-10 Thread Mark Dickinson
Robert Kern wrote: > On 2009-06-10 15:54, Mark Dickinson wrote: >> [...] I'm not sure I'm capable of coming up with extra wording >> for the docs that won't just cause more confusion, so I'll leave that >> to someone else. > > I did make a

Re: Convert integer to fixed length binary string

2009-06-11 Thread Mark Dickinson
.6.2 (r262:71600, Jun 8 2009, 14:57:27) [GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> '{0:032b}'.format(12345) '001100111001' Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Changing Hash Values Across Versions

2009-06-11 Thread Mark Dickinson
ums of objects like classes may and most likely do > change when you restart the interpreter. What he said. I remember at least one recent hash change: the algorithm for computing the hash of a long is different in Python 2.5.x and Python 2.6.x. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help in Python regular expression

2009-06-11 Thread Mark Tolonen
Table) (?:\(\w+\)|{\w+})') testdata = '''\ RenderTable {TABLE} RenderBlock (CENTER) RenderBlock {CENTER} RenderTable {TABLE) #shouldn't match ''' print pat.findall(testdata) --- Result: ['RenderTable

Re: Specify the sorting direction for the various columns/

2009-06-11 Thread Mark Tolonen
column "name" orders ascending. One way is to sort twice...sort on the secondary key first, then the primary key. sort will maintain the order of equal entries. -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: frustrating failure of 'break' statement ( novice )

2009-06-13 Thread Mark Dickinson
gt;     print(num) >     if num == 0 : >         break > > print('done') > > SyntaxError : invalid syntax    ( pointing to end of break ) > [...] Are you mixing tabs and spaces in your code at all? Check that the 'break' line is indented with 8 spaces rather than a tab character. Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Managing a multiple threaded service

2009-06-16 Thread Mark Hammond
; or some other blocking function. HTH, Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Measuring Fractal Dimension ?

2009-06-17 Thread Mark Dickinson
1/n else 1 Then for any 0 <= t <= 1, g_n(t) -> 0 as n -> infinity. But the convergence isn't uniform: max_t(g_n(t)-0) = 1 for all n. Maybe James is thinking of the standard theorem that says that if a sequence of continuous functions on an interval converges uniformly then its limit is continuous? Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Measuring Fractal Dimension ?

2009-06-17 Thread Mark Dickinson
On Jun 17, 1:26 pm, Jaime Fernandez del Rio wrote: > On Wed, Jun 17, 2009 at 1:52 PM, Mark Dickinson wrote: > > Maybe James is thinking of the standard theorem > > that says that if a sequence of continuous functions > > on an interval converges uniformly then its limit

Re: Measuring Fractal Dimension ?

2009-06-17 Thread Mark Dickinson
f1|| = d/3, ||f3 - f2|| = d/9, ||f4 - f3|| = d/27, etc. Hence, since sum_{i >= 0} d/(3^i) converges absolutely, the sequence f0, f1, f2, ... converges *uniformly* to a limiting function f : [0, 1] -> R^2 that parametrizes the Koch curve. And since a uniform limit of uniformly continuous fun

Re: Measuring Fractal Dimension ?

2009-06-17 Thread Mark Dickinson
On Jun 17, 3:46 pm, Paul Rubin <http://[email protected]> wrote: > Mark Dickinson writes: > > It looks as though you're treating (a portion of?) the Koch curve as > > the graph of a function f from R -> R and claiming that f is > > uniformly continuous.  Bu

Re: Measuring Fractal Dimension ?

2009-06-18 Thread Mark Dickinson
On Jun 18, 7:26 pm, David C. Ullrich wrote: > On Wed, 17 Jun 2009 08:18:52 -0700 (PDT), Mark Dickinson > >Right.  Or rather, you treat it as the image of such a function, > >if you're being careful to distinguish the curve (a subset > >of R^2) from its parametrization (

Re: Integer Division

2009-06-19 Thread Mark Dickinson
http://docs.python.org/library/string.html#formatstrings If you're after the number and you *really* need to be able to manipulate the *exact* value 0.04 in Python (e.g., because you're doing financial work), you're probably better off using the Decimal module: http://docs.pyth

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