Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-16 Thread Cameron Simpson
On 17Jul2011 13:09, Steven D'Aprano wrote: | Cameron Simpson wrote: | > On 16Jul2011 09:51, rantingrick trolled: | > | Evidence: Tabs ARE superior! | > | -- | > | I have begun to believe that tabs are far more superior to spaces | > | > Please Ri

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-16 Thread anand jeyahar
On Sun, Jul 17, 2011 at 08:39, Steven D'Aprano wrote: > > I have reluctantly come to do the same thing. There is a plethora of broken > tools out there that don't handle tabs well, and consequently even though > tabs for indentation are objectively better, I use spaces because it is > less worse t

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-16 Thread Andrew Berg
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 On 2011.07.16 10:07 PM, Steven D'Aprano wrote: > Hilariously, in my newsreader, the first example (allegedly > unaligned) was lined up as straight as an arrow, It has consistent indentation, but the self.whatever references aren't aligned. > The

Re: Proposal to extend PEP 257 (New Documentation String Spec)

2011-07-16 Thread Steven D'Aprano
Michael Hrivnak wrote: > Dodgy medium? Such as? I just avoid sending code over any medium > that is going to change the text in any way. Are you sending it with > an instant messenger client or something? There are lots of ways, > some very convenient, to transfer files without them being modi

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-16 Thread Steven D'Aprano
Cameron Simpson wrote: > On 16Jul2011 09:51, rantingrick trolled: > | Evidence: Tabs ARE superior! > | -- > | I have begun to believe that tabs are far more superior to spaces > > Please Rick: you need at least three things to use the term "more >

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-16 Thread Steven D'Aprano
Andrew Berg wrote: > I try to avoid aligning things unless not doing it really hurts > readability for that reason. For example, in most of my source files, I > use tabs to indent. Since Python won't allow a mix of tabs and spaces > (for whitespace) on one line, I don't try to align things: > > e

Re: Re: Virtual functions are virtually invisible!

2011-07-16 Thread Dave Angel
On 01/-10/-28163 02:59 PM, rantingrick wrote: On Jul 16, 5:34 pm, Fabio Zadrozny wrote: I also like the idea of override annotations and I've created a blog post at:http://pydev.blogspot.com/2011/06/overrideimplements-templates-on-pyd... to explain how I do use it (and in a way that I think sh

Re: Newbie help - Programming the Semantic Web with Python

2011-07-16 Thread Bruce Whealton
Hello, So, regarding the path that python uses to find modules, I read the link that you sent. Suppose, I open IDLE and start an interactive session. That would mean the input script location is wherever python is installed, correct? I did add an environment variable PYTHONPATH whi

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-16 Thread Cameron Simpson
On 16Jul2011 19:29, Andrew Berg wrote: | Of everything I've read on tabs vs. spaces, this is what makes the most | sense to me: | http://www.iovene.com/61/ Makes sense to me. Thanks for the URL. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ Every particle continues in

Re: None versus MISSING sentinel -- request for design feedback

2011-07-16 Thread Ethan Furman
Gregory Ewing wrote: Ethan Furman wrote: some of the return values (Logical, Date, DateTime, and probably Character) will have their own dedicated singletons (Null, NullDate, NullDateTime, NullChar -- which will all compare equal to None) That doesn't seem like a good idea to me. It's common

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-16 Thread Chris Angelico
On Sun, Jul 17, 2011 at 9:52 AM, Cameron Simpson wrote: > | Programming languages MUST have rules or > | ambiguities will run a muck and bring the entire system crashing down. > > "Amuck" is one word you know... Yes, but maybe he's wanting to run a MUCK. It's quite possible; I run a MUD. Now, I'm

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-16 Thread Andrew Berg
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 On 2011.07.16 06:52 PM, Cameron Simpson wrote: > Only for leading indentation, not following indentation. Consider > docstrings and other stuff with embedded fixed witdh layout. I try to avoid aligning things unless not doing it really hurts read

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-16 Thread Dan Stromberg
On Sat, Jul 16, 2011 at 4:52 PM, Cameron Simpson wrote: > Well to some extent because I share files with > another who uses 4 position tabs. Editing these is a real nightmare if > one uses 8 position tabs (as I do, the common editor/terminal default > these days). 8's been the default in pretty

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-16 Thread Cameron Simpson
On 16Jul2011 09:51, rantingrick trolled: | Evidence: Tabs ARE superior! | -- | I have begun to believe that tabs are far more superior to spaces Please Rick: you need at least three things to use the term "more superior". With only two, you just ha

Re: Proposal to extend PEP 257 (New Documentation String Spec)

2011-07-16 Thread Chris Angelico
On Sun, Jul 17, 2011 at 9:25 AM, rantingrick wrote: > Now you see what this four space "brain washing" has done to us! > At least we have clean, freshly-washed brains. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Proposal to extend PEP 257 (New Documentation String Spec)

2011-07-16 Thread Andrew Berg
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 On 2011.07.16 06:12 PM, Chris Angelico wrote: > He's on Steven's killfile, and he might get himself on mine. He's like a guy at a party who's had too much to drink. He'll start going on about conspiracy theories and philosophies based more on bloo

Re: Proposal to extend PEP 257 (New Documentation String Spec)

2011-07-16 Thread rantingrick
On Jul 16, 6:03 pm, Andrew Berg wrote: > Shouldn't that be s = s.replace('--->', '\t') ? Now you see what this four space "brain washing" has done to us! -- http://mail.python.org/mailman/listinfo/python-list

Re: Possible File iteration bug

2011-07-16 Thread Cameron Simpson
On 16Jul2011 13:42, Steven D'Aprano wrote: | Billy Mays wrote: | > I was thinking that a convenient solution to this problem would be to | > introduce a new Exception call PauseIteration, which would signal to the | > caller that there is no more data for now, but not to close down the | > genera

Re: Looking for general advice on complex program

2011-07-16 Thread Cameron Simpson
On 16Jul2011 10:37, Josh English wrote: | You use a directory as lock mechanism. I think I get how that works. | When you're done manipulating the file, do you just remove the director? Yes. The advantages of a directory are twofold: you can't mkdir() twice while you can usually open the same fil

Re: Looking for general advice on complex program

2011-07-16 Thread Cameron Simpson
On 16Jul2011 10:34, Josh English wrote: | I found a FileLock (lost the link and it's not in the code) that uses | context managers to create a ".lock" file in the same directory of the | file. It uses os.unlink to delete the .lock file but I don't know if | this deletes the file or just removes it

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-16 Thread Tim Roberts
rantingrick wrote: > >As we all know python allows us to use either tabs or spaces but NEVER >both in the same source file. That's not true. Python allows tabs and spaces to be used in the same source file, and even in the same source line. I'm not saying it's wise, but it certainly allowed. --

Re: Proposal to extend PEP 257 (New Documentation String Spec)

2011-07-16 Thread Chris Angelico
On Sun, Jul 17, 2011 at 5:23 AM, Michael Hrivnak wrote: > Dodgy medium?  Such as?  I just avoid sending code over any medium > that is going to change the text in any way.  Are you sending it with > an instant messenger client or something?  There are lots of ways, > some very convenient, to trans

Re: Proposal to extend PEP 257 (New Documentation String Spec)

2011-07-16 Thread Andrew Berg
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 On 2011.07.16 10:32 AM, rantingrick wrote: > This method will preserve indention. However some might > blubber..."Yeah but then you have to remove the arrows, boo :( "... > well just watch and learn kiddo: > s = """ > def foo(): --->for x

Re: Virtual functions are virtually invisible!

2011-07-16 Thread rantingrick
On Jul 16, 5:34 pm, Fabio Zadrozny wrote: > I also like the idea of override annotations and I've created a blog > post > at:http://pydev.blogspot.com/2011/06/overrideimplements-templates-on-pyd... > to explain how I do use it (and in a way that I think should be > standard in Python the same wa

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-16 Thread Andrew Berg
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 On 2011.07.16 11:51 AM, rantingrick wrote: > -- Evidence: Tabs ARE > superior! -- That may be the case (for indentation, NOT alignment), but you're sti

Re: Virtual functions are virtually invisible!

2011-07-16 Thread Fabio Zadrozny
On Sun, Jul 10, 2011 at 2:15 PM, rantingrick wrote: > On Jul 4, 3:43 am, Gregory Ewing wrote: >> rantingrick wrote: >> > what concerns me is the fact that virtual methods in derived >> > classes just blend in to the crowd. >> > I think we really need some >> > sort of visual cue in the form of fo

Re: how to get a list of all the hosts on the intranet around my workstation?

2011-07-16 Thread Christian Heimes
Am 16.07.2011 21:13, schrieb Dan Stromberg: > Some options: > > 1) Broadcast ping > 2) nmap the subnet, optionally with -P0 > 3) Check the arp cache (optionally after options 1, 2 or 4) > 4) Unicast ping everything on the subnet in parallel - very effective, very > fast, might want to do it with t

Re: Looking for general advice on complex program

2011-07-16 Thread Michael Hrivnak
Multiple clients reading from and writing to a central collection of related data is a problem that has been largely solved. Use a database, and have the clients act on it with transactions. There's no reason to re-invent the wheel. You could have the clients connect to the database directly ove

Re: Proposal to extend PEP 257 (New Documentation String Spec)

2011-07-16 Thread Michael Hrivnak
Dodgy medium? Such as? I just avoid sending code over any medium that is going to change the text in any way. Are you sending it with an instant messenger client or something? There are lots of ways, some very convenient, to transfer files without them being modified. If you need to quickly sha

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-16 Thread Dan Stromberg
On Sat, Jul 16, 2011 at 9:51 AM, rantingrick wrote: > > -- > Summary > -- > As we all know python allows us to use either tabs or spaces but NEVER > both in the same source file. And as we also know t

Re: MemoryError vs malloc error

2011-07-16 Thread Dan Stromberg
Is the whole program pure python? Sometimes a reference to undefined memory or a lack of error checking elsewhere in a program, can cause innocuous code to fail later: http://stromberg.dnsalias.org/~dstromberg/checking-early.html If the program uses ctypes, or an unusual Python/C API module, I'd

Re: how to get a list of all the hosts on the intranet around my workstation?

2011-07-16 Thread Chris Angelico
On Sun, Jul 17, 2011 at 4:15 AM, Thomas Jollans wrote: > In the end, there is only one way to get all active machines: Ping > everyone on the subnet. But that will list everyone who's _currently_ active; it won't list everyone who _ought to be_ active. However, the OP was slightly ambiguous: On

Re: Code hosting services

2011-07-16 Thread Thomas Jollans
On 07/16/2011 06:00 PM, Jason Earl wrote: > On Sat, Jul 16 2011, Thomas Jollans wrote: > >> On 07/16/2011 10:32 AM, Andrew Berg wrote: >>> Does anyone know if there are any services that have cross-project >>> integration? I can see myself closing a ton of bug reports just because >>> they are iss

Re: how to get a list of all the hosts on the intranet around my workstation?

2011-07-16 Thread Chris Angelico
On Sun, Jul 17, 2011 at 4:04 AM, Emile van Sebille wrote: > On 7/16/2011 9:52 AM Chris Angelico said... >> >> I'd say there's several imperfect options, and no perfect ones. >> >> 1) DHCP, which hosts may or may not be using. >> 2) DNS - look up a list of the hosts within a (sub)domain. >> 3) Send

Re: how to get a list of all the hosts on the intranet around my workstation?

2011-07-16 Thread Thomas Jollans
On 07/16/2011 06:31 PM, Phlip wrote: > Yes, pythonistas, sometimes I even amaze myself with the quality of > question that a computer scientist with a 25 year resume can ask > around here... > > In my defense, a Google search containing "intranet host" will fan out > all over the place, not narrow

Re: Looking for general advice on complex program

2011-07-16 Thread Chris Angelico
On Sun, Jul 17, 2011 at 3:41 AM, Josh English wrote: > Chris, > > Thank you for spelling this out. I thought about this as a solution but I > don't have the skills to create this server application, and I don't know if > the target network can handle this request. They can see files on a shared

Re: Looking for general advice on complex program

2011-07-16 Thread geremy condra
On Fri, Jul 15, 2011 at 3:47 PM, Josh English wrote: > Maybe not to the gurus here, but for me, this is a complex problem and I want > to make sure I understand the real problem. > > All of this is in Python 2.7 and wxPython > > I have several XML files on a shared drive. > I have applications on

Re: how to get a list of all the hosts on the intranet around my workstation?

2011-07-16 Thread Emile van Sebille
On 7/16/2011 9:52 AM Chris Angelico said... On Sun, Jul 17, 2011 at 2:31 AM, Phlip wrote: pydhcplib? Shell to a DHCP utility? Ping every server in a range around my own? I'd say there's several imperfect options, and no perfect ones. 1) DHCP, which hosts may or may not be using. 2) DNS - lo

Re: feeding the troll (was: Tabs -vs- Spaces: Tabs should have won.)

2011-07-16 Thread Tim Chase
On 07/16/2011 11:51 AM, rantingrick wrote: 1) Using only one indention token removes any chance of user error. I'm not sure it "removes any chance of user error"...programmers are an awfully error-prone lot -- especially beginners. Picking one or the other might help reduce friction when lea

Re: Looking for general advice on complex program

2011-07-16 Thread Josh English
Chris, Thank you for spelling this out. I thought about this as a solution but I don't have the skills to create this server application, and I don't know if the target network can handle this request. They can see files on a shared drive. They can't see each other's computers on the network, a

Re: Looking for general advice on complex program

2011-07-16 Thread Josh English
I found a FileLock (lost the link and it's not in the code) that uses context managers to create a ".lock" file in the same directory of the file. It uses os.unlink to delete the .lock file but I don't know if this deletes the file or just removes it from the directory and leaves the memory fill

Re: Looking for general advice on complex program

2011-07-16 Thread Josh English
Cameron, You use a directory as lock mechanism. I think I get how that works. When you're done manipulating the file, do you just remove the director? Josh -- http://mail.python.org/mailman/listinfo/python-list

Tabs -vs- Spaces: Tabs should have won.

2011-07-16 Thread rantingrick
-- Summary -- As we all know python allows us to use either tabs or spaces but NEVER both in the same source file. And as we also know the python style guide says we should use four spaces and refrain

Re: how to get a list of all the hosts on the intranet around my workstation?

2011-07-16 Thread Chris Angelico
On Sun, Jul 17, 2011 at 2:31 AM, Phlip wrote: > pydhcplib? Shell to a DHCP utility? Ping every server in a range > around my own? > I'd say there's several imperfect options, and no perfect ones. 1) DHCP, which hosts may or may not be using. 2) DNS - look up a list of the hosts within a (sub)dom

Re: Proposal to extend PEP 257 (New Documentation String Spec)

2011-07-16 Thread Chris Angelico
On Sun, Jul 17, 2011 at 1:32 AM, rantingrick wrote: > On Jul 15, 6:16 pm, Chris Angelico wrote: >> Not Ruby, but to other languages. There's this guy in my house named >> Chris who tries his best to avoid Python if the code is going to be >> shared over any "dodgy medium" where indentation might

Re: Python ++ Operator?

2011-07-16 Thread Robert Kern
On 7/16/11 4:55 AM, Waldek M. wrote: Dnia Fri, 15 Jul 2011 23:09:02 +0200, Stefan Behnel napisał(a): [...] array[count++]=value; or the more direct pointer management: *ptr++=value; More direct, sure. But readable? Well, only when you know what this specific pattern does. If you have to think

Re: Is there a way to customise math.sqrt(x) for some x?

2011-07-16 Thread Gary Herron
On 07/16/2011 01:35 AM, Steven D'Aprano wrote: I have a custom object that customises the usual maths functions and operators, such as addition, multiplication, math.ceil etc. Is there a way to also customise math.sqrt? I don't think there is, but I may have missed something. Create a file na

Re: Code hosting services

2011-07-16 Thread Jason Earl
On Sat, Jul 16 2011, Thomas Jollans wrote: > On 07/16/2011 10:32 AM, Andrew Berg wrote: >> Does anyone know if there are any services that have cross-project >> integration? I can see myself closing a ton of bug reports just because >> they are issues with the library part of the program, which wi

Re: Proposal to extend PEP 257 (New Documentation String Spec)

2011-07-16 Thread rantingrick
On Jul 15, 6:16 pm, Chris Angelico wrote: > On Sat, Jul 16, 2011 at 4:56 AM, rantingrick wrote: > > Hmm, that's strange considering that code MUST be formatted in certain > > ways or you get a syntax error (indention, colons, parenthesis, etc, > > etc). I don't hear the masses claiming that they

Re: Python ++ Operator?

2011-07-16 Thread Adam Przybyla
Chris Angelico wrote: > On Sat, Jul 16, 2011 at 6:26 AM, Dan Stromberg wrote: >> >> I don't regard this as a low level versus VHLL issue - I regard it as a >> matter of operators with side effects being too error prone.  Adding such >> operators to Python has been discussed (it'd almost certainly

Pyrolite - a lightweight interface library to connect java to python

2011-07-16 Thread Irmen de Jong
Hi, What's a java interface library doing in comp.lang.python, you might ask. Well, this one, called 'Pyrolite' is meant to be a lightweight library (<50kb) to interface your java application to Python in a very easy and straightforward way. Pyrolite uses the Pyro protocol to call methods on r

Re: Is there a way to customise math.sqrt(x) for some x?

2011-07-16 Thread Nobody
On Sat, 16 Jul 2011 19:14:47 +1000, Chris Angelico wrote: > Only thing I can think of is: > > import math > math.sqrt=lambda(x) x.__sqrt__(x) if x.whatever else math.sqrt(x) math.sqrt=(lambda sqrt=math.sqrt: lambda x: x.__sqrt__(x) if hasattr(x,'__sqrt__') else sqrt(x))() -- http://mail.pytho

Re: Python ++ Operator?

2011-07-16 Thread Nobody
On Fri, 15 Jul 2011 23:09:02 +0200, Stefan Behnel wrote: >> or the more direct pointer management: >> >> *ptr++=value; > > More direct, sure. But readable? Well, only when you know what this > specific pattern does. If you have to think about it, it may end up > hurting your eyes before you figur

ANN: PyGUI 2.5.3

2011-07-16 Thread Greg Ewing
PyGUI 2.5.3 is available: http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ Clipboard access now implemented on MacOSX, plus a few bug fixes. What is PyGUI? -- PyGUI is a cross-platform GUI toolkit designed to be lightweight and have a highly Pythonic API. -- Gregory Ewin

Re: Python threading/multiprocessing issue.

2011-07-16 Thread Waldek M.
Dnia Fri, 15 Jul 2011 22:15:15 -0700, Dennis Lee Bieber napisał(a): > And (so far as I understand it) each process can claim its own CPU > core, whereas threads share the active core. I do not think so. AFAIK, threads may be distributed over differrent CPUs (just like in any other programmin

Re: Code hosting services

2011-07-16 Thread Thomas Jollans
On 07/16/2011 10:32 AM, Andrew Berg wrote: > Does anyone know if there are any services that have cross-project > integration? I can see myself closing a ton of bug reports just because > they are issues with the library part of the program, which will be a > separate project (because there will be

Re: Python ++ Operator?

2011-07-16 Thread Waldek M.
Dnia Fri, 15 Jul 2011 23:09:02 +0200, Stefan Behnel napisał(a): [...] >> array[count++]=value; >> >> or the more direct pointer management: >> *ptr++=value; > > More direct, sure. But readable? Well, only when you know what this > specific pattern does. If you have to think about it, it may end u

Re: Is there a way to customise math.sqrt(x) for some x?

2011-07-16 Thread Peter Otten
Steven D'Aprano wrote: > I have a custom object that customises the usual maths functions and > operators, such as addition, multiplication, math.ceil etc. > > Is there a way to also customise math.sqrt? I don't think there is, but I > may have missed something. There seem to be only three metho

Re: Is there a way to customise math.sqrt(x) for some x?

2011-07-16 Thread Chris Angelico
On Sat, Jul 16, 2011 at 6:35 PM, Steven D'Aprano wrote: > I have a custom object that customises the usual maths functions and > operators, such as addition, multiplication, math.ceil etc. > > Is there a way to also customise math.sqrt? I don't think there is, but I > may have missed something. O

Is there a way to customise math.sqrt(x) for some x?

2011-07-16 Thread Steven D'Aprano
I have a custom object that customises the usual maths functions and operators, such as addition, multiplication, math.ceil etc. Is there a way to also customise math.sqrt? I don't think there is, but I may have missed something. -- Steven -- http://mail.python.org/mailman/listinfo/python-lis

Re: Code hosting services

2011-07-16 Thread Andrew Berg
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 I found this on StackOverflow and it was very helpful: http://stackoverflow.com/questions/10490/best-open-source-project-hosting-site Now, I have it narrowed down to 3 choices - SF, Google Code and CodePlex. SF pros: Very popular and has tons of

Re: Please critique my script

2011-07-16 Thread Peter Otten
Ellerbee, Edward wrote: > I've been working on this for 3 weeks as a project while I'm learning > python. It's ugly, only function in there is from a fellow lister, but > it works perfectly and does what it is intended to do. > > I'd love to hear comments on how I could improve this code, what wo

Aw: Re: Aw: Functional style programming in python: what will you talk about if you have an hour on this topic?

2011-07-16 Thread Rainer Grimm
Am Samstag, 16. Juli 2011 08:46:42 UTC+2 schrieb Steven D'Aprano: > Rainer Grimm wrote: > > > I think it's relatively difficult to get a feeling what a are the key > > points behind functional programming. So I think you should start > > explaining the concepts behind functional programming. A few

Re: list(), tuple() should not place at "Built-in functions" in documentation

2011-07-16 Thread Corey Richardson
Excerpts from Inside's message of Sat Jul 16 01:40:21 -0400 2011: > Supplement: > The assertion will not be handled anyway. > I want AssertionError raise as early as possible.(mentinoed before) An AssertionError is pretty useless, there are much better exceptions that you could (and should!) use,