Re: Python 3: range objects cannot be sliced

2009-01-25 Thread Terry Reedy
Fuzzyman wrote: On Jan 25, 2:28 pm, Alan G Isaac wrote: On 1/16/2009 3:13 PM Alan G Isaac apparently wrote: > It is documented: >http://docs.python.org/3.0/library/stdtypes.html#sequence-types-str-b... But then again, the opposite is also documented, since `range` is a sequence type. Quotin

Re: v = json.loads("{'test':'test'}")

2009-01-25 Thread Steven D'Aprano
On Sun, 25 Jan 2009 19:04:44 -0500, Steve Holden wrote: > Andreas Waldenburger wrote: >> On Sun, 25 Jan 2009 23:51:41 +0100 "Diez B. Roggisch" >> wrote: >> >>> gert schrieb: {'test': 'test'} {"test": "test"} It can not be that hard to support both notation can it ? >>> It's n

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-25 Thread Steven D'Aprano
On Mon, 26 Jan 2009 00:59:48 +, Steven D'Aprano wrote: > How is this scenario different from an API change where public_method() > gets changed to method()? Sorry, that's a poor example, since you were talking about attributes rather than methods. Must stop posting before coffee *wink* Rew

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-25 Thread Paul Rubin
Steven D'Aprano writes: > How is this scenario different from an API change where > self.some_attribute gets changed to self.attribute? That would be a backward incompatible change to a published interface, something that should not be done without a good reason, and which was mostly avoided th

Re: Cartesian Product of two lists (itertools)

2009-01-25 Thread Terry Reedy
Thorsten Kampe wrote: Hi, is there a way to make itertools.product generate triples instead of pairs from two lists? For example: list1 = [1, 2]; list2 = [4, 5]; list3 = [7, 8] from itertools import product list(product(list1, list2, list3)) [(1, 4, 7), (1, 4, 8), (1, 5, 7), (1, 5, 8), (2, 4

Re: Why this code is working?

2009-01-25 Thread r
On Jan 23, 10:02 pm, alex23 wrote: [snip] > How's that Python bridge to SketchUp coming > along? It's been months already, surely you've invested as much effort > into learning Python as you have in talking about it? Thanks for asking Alex23, The ball is rolling on the Python SketchUp integration

Re: What is intvar?

2009-01-25 Thread r
W. eWatson, I contacted the author of New Mexico Techs "Introduction to Tkinter" a couple of weeks ago. He is going to update the reference material with a few missing widgets and some info on Photo and Bitmap classes. I really love the NMT layout and use it quite often. Fredricks Tkinterbook is m

Re: Newby: how to transform text into lines of text

2009-01-25 Thread Tim Chase
Scott David Daniels wrote: Here's how I'd do it: with open('deheap/deheap.py', 'rU') as source: for line in source: print line.rstrip() # Avoid trailing spaces as well. This should handle \n, \r\n, and \n\r lines. Unfortunately, a raw rstrip() eats other whitespace

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-25 Thread Steven D'Aprano
On Sun, 25 Jan 2009 17:15:47 -0800, Paul Rubin wrote: > Steven D'Aprano writes: >> How is this scenario different from an API change where >> self.some_attribute gets changed to self.attribute? > > That would be a backward incompatible change to a published interface, > something that should not

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-25 Thread Paul Rubin
Steven D'Aprano writes: > We're not talking specifically about Python standard library changes, > we're talking about any project which may have more entertaining *cough* > policies regarding API changes. Oh, yes, I see what you mean. That's a problem even in small projects, sometimes even in

Python C API (PyObject_CallMethod clear object)

2009-01-25 Thread googler . 1 . webmaster
Hi! I have a problm with deallocating stuff. I call a function with this command: PyObject *rvalue = PyObject_CallMethod(obj, "execute","",NULL); if(rvalue==NULL) PyErr_Print(); else Py_DECREF(rvalue); Can it be, that something is missing here? Imagine I allocate an object of a type: t

Re: Why this code is working?

2009-01-25 Thread r
Actually Alex, i have not stopped working on getting Python into SU in one form or another since that crazy post of mine almost 3 moths ago. I have many people in the SU community asking me almost daily when i will get finished. I have a lot of work to do at this point but i will keep fighting beca

Re: Byte oriented data types in python

2009-01-25 Thread Stephen Hansen
> > However, as you keep claiming that the struct module is what > should be used, I must be missing something about the struct > module. You seem to be focusing overly on the "C Struct" part of the description of what the struct module does, instead of the part where it says, "packed binary data

Re: Newby: how to transform text into lines of text

2009-01-25 Thread Gabriel Genellina
En Sun, 25 Jan 2009 23:30:33 -0200, Tim Chase escribió: Unfortunately, a raw rstrip() eats other whitespace that may be important. I frequently get tab-delimited files, using the following pseudo-code: def clean_line(line): return line.rstrip('\r\n').split('\t') f = file('cu

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-25 Thread Mark Wooding
"Russ P." writes: > On Jan 25, 10:04 am, Mark Wooding wrote: > > But what if you type "mumble._seekrit" in several places, then the > library implementer decides to give in to your nagging and makes it > "public" by changing it to "mumble.seekrit". There's a possibly better fix: introduce a pro

Re: Cartesian Product of two lists (itertools)

2009-01-25 Thread Mark Wooding
Thorsten Kampe writes: > [((1, 4), 7), ((1, 4), 8), ((1, 5), 7), ((1, 5), 8), ((2, 4), 7), ((2, > 4), 8), ((2, 5), 7), ((2, 5), 8)] [...] > What's the best way to pre-process the arguments to "itertools.product" > or to post-process the result of "itertools.product" to get what I > want?! P

Re: A java hobbyist programmer learning python

2009-01-25 Thread TheFlyingDutchman
>         If you're building an extension tree, you'll either have to supply > layers of getter/setter methods, or hand-mangle references to attributes > defined in the superclass. > >         Say you start with a "Point2D" class, and make the X, Y coordinates > double underscore. > >         Now e

Re: Efficient multi-slicing technique?

2009-01-25 Thread python
Tim, > I'm not sure if it's more efficient, but there's the struct module: > http://docs.python.org/library/struct.html Thanks for your suggestion. I've been experimenting with this technique, but my initial tests don't show any performance improvements over using slice() objects to slice a strin

Re: v = json.loads("{'test':'test'}")

2009-01-25 Thread Matt Nordhoff
gert wrote: > On Jan 25, 11:16 pm, Дамјан Георгиевски wrote: >>> raise ValueError(errmsg("Expecting property name", s, end)) >>> http://docs.python.org/library/json.html >>> What am I doing wrong ? >> try this >> v = json.loads('{"test":"test"}') >> >> JSON doesn't support single quotes, only doub

Re: Newby: how to transform text into lines of text

2009-01-25 Thread John Machin
On Jan 26, 1:03 pm, "Gabriel Genellina" wrote: > En Sun, 25 Jan 2009 23:30:33 -0200, Tim Chase   > escribió: > > > > > Unfortunately, a raw rstrip() eats other whitespace that may be   > > important.  I frequently get tab-delimited files, using the following   > > pseudo-code: > > >    def clean_

Re: Python C API (PyObject_CallMethod clear object)

2009-01-25 Thread Gabriel Genellina
En Sun, 25 Jan 2009 23:46:01 -0200, escribió: I have a problm with deallocating stuff. I call a function with this command: PyObject *rvalue = PyObject_CallMethod(obj, "execute","",NULL); if(rvalue==NULL) PyErr_Print(); else Py_DECREF(rvalue); Can it be, that something is missing h

Where to put configuration/data files

2009-01-25 Thread Jay Bloodworth
Is there a nice cross-platform way to figure out the Right (tm) place to store configuration files and other data? Jay -- http://mail.python.org/mailman/listinfo/python-list

Re: OCaml, Language syntax, and Proof Systems

2009-01-25 Thread Xah Lee
Just a quick relpy. Jon's tutorial: http://www.ffconsultancy.com/products/ocaml_for_scientists/chapter1.html is by far the best tutorial of Ocaml. It is far better than the official intro to ocaml at “caml.inria.fr” or the popularly cited tutorial at “ocaml-tutorial.org” . Jon's tutorial, namel

Re: seeking to improve Python skills

2009-01-25 Thread Aahz
In article , mk wrote: > >However, unit tests are a tougher cookie, do you have any resource >that's truly worth recommending for learning unit tests? Start with the doctest module. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ Weinberg's Second Law: If bui

Re: Securing a database

2009-01-25 Thread Bryan Olson
kt83...@gmail.com wrote: Thank you very much Bryan. It does look like this is out of my league. As Peter Pearson noted, "It is out of *everyone's* league." And Peter used to work for Cryptography Research, a small company that scored as high in this league as anyone. Maybe you can advance the

Re: OCaml, Language syntax, and Proof Systems

2009-01-25 Thread Jon Harrop
Xah Lee wrote: > ok, i've been reading these Ocaml tutorials in the past few days: > > intro to ocaml, from official site > http://caml.inria.fr/pub/docs/manual-ocaml/manual003.html > > “Objective CAML Tutorial”, most cited tutorial on the web > http://www.ocaml-tutorial.org/ > > The best one, i

Re: is None vs. == None

2009-01-25 Thread Roger
> And, just for completeness, the "is" test is canonical precisely because > the interpreter guarantees there is only ever one object of type None, > so an identity test is always appropriate. Even the copy module doesn't > create copies ... > Does the interpreter guarantee the same for False and

Re: is None vs. == None

2009-01-25 Thread Roger
> Why do you think it matters? Intellectual curiosity hence why I asked the question. It doesn't matter if I know why the sky is blue but it's interesting to know regardless. -- http://mail.python.org/mailman/listinfo/python-list

Re: A different kind of interface

2009-01-25 Thread Дамјан Георгиевски
>> I don't know what an IBQ is. > > +IBQ- seems to be the way your newsreader displays the dashes that > where in Ben's posting. I see "em dash" characters there: I see IBQ too ... also weird is that he has Content-Type: text/plain; charset=utf-7 -- дамјан ( http://softver.org.mk/damjan/ ) G

Python

2009-01-25 Thread porkodi
www.easythings5.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: *.python.org broken?

2009-01-25 Thread tgvaughan
Hi Tim, thanks for your post. I could resolve but not ping, which has been the situation for the last couple of days. But not any more! I was just in the process of checking whether or not I could connect via another ISP when I discovered that the problem has apparently fixed itself. Which is great

Re: Securing a database

2009-01-25 Thread kt83313
On Jan 23, 4:41 pm, Bryan Olson wrote: > kt83...@gmail.com wrote: > > Anyways, if we can make it real hard for them to analyze also, I think > > we are in the good - esp since the clients are not extremely rich > > enough to go for professional analyzers -- > > Sounds like you have the "digital ri

Re: I'm a python addict !

2009-01-25 Thread Andreas Waldenburger
On Sat, 24 Jan 2009 23:53:17 + MRAB wrote: > Terry Reedy wrote: > > For a Python 'program', see http://xkcd.com/534/ > > > It doesn't follow PEP 8! So Randall can just forget about getting xkcd in the Standard Library. Let this be an example to all of you­! /W -- My real email address is

Re: Securing a database

2009-01-25 Thread Peter Pearson
On Fri, 23 Jan 2009 06:10:31 -0800 (PST), kt83...@gmail.com wrote: > On Jan 23, 4:41 pm, Bryan Olson wrote: [snip] >> Look up DRM technology companies, such as CloakWare, Macrovision, and >> Cryptography Research. >> >> If you have a modest number of customers, hardware solutions and/or >> strict

Re: v = json.loads("{'test':'test'}")

2009-01-25 Thread Matt Nordhoff
Matt Nordhoff wrote: > gert wrote: >> On Jan 25, 11:16 pm, Дамјан Георгиевски wrote: raise ValueError(errmsg("Expecting property name", s, end)) http://docs.python.org/library/json.html What am I doing wrong ? >>> try this >>> v = json.loads('{"test":"test"}') >>> >>> JSON doesn't s

Why is it faster the second time ?

2009-01-25 Thread jalanb3
Hello the group, I am wondering why doctests run slower the first time. In the transcript below "try" is a script which finds and runs doctests in the current directory. It also shows how long it takes to run these tests. I added a new test which searches recursively for files given a path, and i

Re: Efficient multi-slicing technique?

2009-01-25 Thread Tim Chase
I'm not sure if it's more efficient, but there's the struct module: http://docs.python.org/library/struct.html Thanks for your suggestion. I've been experimenting with this technique, but my initial tests don't show any performance improvements over using slice() objects to slice a string. Howev

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-25 Thread Russ P.
On Jan 25, 5:31 pm, Steven D'Aprano wrote: > It seems to me that Russ' latest objection to _private names is not > specific to _private names. The same problem: > > "You will get no warning at all. You will just be inadvertently > creating a new "private" attribute -- and the assignment that you

Re: Counting number of objects

2009-01-25 Thread Mark Wooding
Andreas Waldenburger writes: > On Sun, 25 Jan 2009 09:23:35 -0800 (PST) Kottiyath > wrote: > >> class a(object): >> counter = 0 >> def __new__(cls, *args, **kwargs): >> a.counter += 1 >> return object.__new__(cls, *args, **kwargs) Hmm. Exceptions raised during object cr

Re: Why is it faster the second time ?

2009-01-25 Thread Philip Semanchuk
On Jan 23, 2009, at 12:46 PM, jalanb3 wrote: Hello the group, I am wondering why doctests run slower the first time. In the transcript below "try" is a script which finds and runs doctests in the current directory. It also shows how long it takes to run these tests. I added a new test which s

Re: Python 3: range objects cannot be sliced

2009-01-25 Thread John Machin
On Jan 26, 12:08 pm, Terry Reedy wrote: > Fuzzyman wrote: > > On Jan 25, 2:28 pm, Alan G Isaac wrote: > >> On 1/16/2009 3:13 PM Alan G Isaac apparently wrote: > >>  > It is documented: > >>  >http://docs.python.org/3.0/library/stdtypes.html#sequence-types-str-b... > > >> But then again, the oppos

Re: Plugin system, RuntimeWarning: Parent module 'ext_abc' not found while handling absolute import

2009-01-25 Thread Gabriel Genellina
En Sun, 25 Jan 2009 04:55:47 -0200, Torsten Mohr escribió: i try to write a plugin system that i want to use to let users extend a module that i write. Within the module there is an extension loader that loads an extension module. This extension module should be able to import modules from

Re: Byte oriented data types in python

2009-01-25 Thread John Machin
On Jan 26, 10:53 am, "Martin v. Löwis" wrote: > > It deals with variable sized fields just fine: > > > dtype = 18 > > dlength = 32 > > format = "!BB%ds" % dlength > > > rawdata = struct.pack(format, (dtype,dlength,data)) > > I wouldn't call this "just fine", though - it involves > a % operator to

Re: ob_type in shared memory

2009-01-25 Thread Mark Wooding
Aaron Brady writes: > I am writing an extension using shared memory. I need a data type > that is able to reassign its 'ob_type' field depending on what process > is calling it. That sounds scary! > Object 'A' is of type 'Ta'. When process 'P' is looking at it, it > needs to have an 'ob_type'

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-25 Thread Mark Wooding
"Russ P." writes: [snip stuff I don't disagree with] > That makes renaming and refactoring riskier in general in Python than > in statically typed languages with enforced access restrictions. More > care and attention to detail is needed to do it right in Python. In fact, I don't disagree with

Re: is None vs. == None

2009-01-25 Thread Terry Reedy
Roger wrote: And, just for completeness, the "is" test is canonical precisely because the interpreter guarantees there is only ever one object of type None, so an identity test is always appropriate. Even the copy module doesn't create copies ... Does the interpreter guarantee the same for Fal

Re: Python

2009-01-25 Thread Terry Reedy
porkodi wrote: www.easythings5.blogspot.com Ad spam site with pirated semi-gibberish not even containing 'Python'. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python

2009-01-25 Thread skip
Terry> porkodi wrote: >> www.easythings5.blogspot.com Terry> Ad spam site with pirated semi-gibberish not even containing Terry> 'Python'. Yeah, my fault. I was poking through a bunch of held messages and saw "Pyhon" as the subject. Didn't even look at the message itself until

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-25 Thread Russ P.
On Jan 25, 7:56 pm, Mark Wooding wrote: > "Russ P." writes: > > [snip stuff I don't disagree with] > > > That makes renaming and refactoring riskier in general in Python than > > in statically typed languages with enforced access restrictions. More > > care and attention to detail is needed to do

Re: USB in python

2009-01-25 Thread Tim Roberts
Astan Chee wrote: > >Im trying to write a program for my USB device and I'm thinking of using >python to do this. The USB device is of my own making and it is >activated when one of the two data pins of the USB is given about 5V (or >similar to whatever the power pin is getting). Now I'm confus

Re: Newby: how to transform text into lines of text

2009-01-25 Thread Gabriel Genellina
En Mon, 26 Jan 2009 00:23:30 -0200, John Machin escribió: On Jan 26, 1:03 pm, "Gabriel Genellina" wrote: It's so easy that don't doing that is just inexcusable lazyness :) Your own example, written using the csv module: import csv f = csv.reader(open('customer_x.txt','rb'), delimiter='\t'

Re: v = json.loads("{'test':'test'}")

2009-01-25 Thread Tim Roberts
Andreas Waldenburger wrote: > >But as gert says, the standard is "broken" by many many browsers >already We're debating relatively picky semantic point, so I won't feel bad by being picky. Browsers have nothing to do with the JSON standard. JSON is not Javascript, nor is it a part of Javascri

Re: USB in python

2009-01-25 Thread Astan Chee
Tim Roberts wrote: Sorry, but you have NOT created a USB device, and I sincerely hope you do not try to plug it in to a real USB port. Sorry, by USB device, I meant a device that is powered/activated by a bunch of wires that I want to control using a computer and since I had a spare USB jack

Re: String comparision

2009-01-25 Thread S.Selvam Siva
Thank You Gabriel, On Sun, Jan 25, 2009 at 7:12 AM, Gabriel Genellina wrote: > En Sat, 24 Jan 2009 15:08:08 -0200, S.Selvam Siva > escribió: > > > I am developing spell checker for my local language(tamil) using python. >> I need to generate alternative word list for a miss-spelled word from th

Re: Monitor a FTP site for arrival of new/updated files

2009-01-25 Thread Michael Iatrou
When the date was Sunday 25 January 2009, pyt...@bdurham.com wrote: > Any suggestions on a best practice way to monitor a remote FTP > site for the arrival of new/updated files? For a custom solution, you may want to take a look to pyinotify: http://pyinotify.sourceforge.net/ -- Mich

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-25 Thread Hendrik van Rooyen
"Paul Rubin" wrote: > Steven D'Aprano writes: > > We're not talking specifically about Python standard library changes, > > we're talking about any project which may have more entertaining *cough* > > policies regarding API changes. > > Oh, yes, I see what you me

<    1   2