Re: optphart (alpha2)

2010-06-28 Thread rantingrick
On Jun 29, 1:30 am, Stephen Hansen wrote: > This is just stupid. > It isn't worthy of any more elaborate response. Well gee thanks Stephen. Why don't you just kick me in the balls while your at it? *Maybe* you don't find it useful. *Maybe* no one will find it useful. However, i did manage to move

Re: [ANN] optphart (alpha2)

2010-06-28 Thread Stephen Hansen
On 6/28/10 10:41 PM, rantingrick wrote: """ I am pleased to announce optphart (alpha2)! This is just stupid. It isn't worthy of any more elaborate response. You just don't get the point, do you? -- ... Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io

Third World War is Coming - Who is Webster Tarpley ?

2010-06-28 Thread nanothermite911fbibustards
Third World War is Coming - Who is Webster Tarpley ? http://www.youtube.com/watch?v=jLaaPBV9nqA http://www.youtube.com/watch?v=KV6oKRnM4mY http://www.youtube.com/watch?v=y53R_h-OZAM -- http://mail.python.org/mailman/listinfo/python-list

[ANN] optphart (alpha2)

2010-06-28 Thread rantingrick
""" I am pleased to announce optphart (alpha2)! --- What is optphart? --- optphart is the nemisis of the asinine interfaces and bulky libraries you may be accustomed to in the stdlib. All of which clog your scripts with wasted lines and your memory with complex int

Re: [OT] Re: Why Is Escaping Data Considered So Magical?

2010-06-28 Thread Kushal Kumaran
On Tue, Jun 29, 2010 at 5:56 AM, Lawrence D'Oliveiro wrote: > In message , Kushal > Kumaran wrote: > >> On Sun, Jun 27, 2010 at 5:16 PM, Lawrence D'Oliveiro >> wrote: >> >>>In message , Kushal >>> Kumaran wrote: >>> On Sun, Jun 27, 2010 at 9:47 AM, Lawrence D'Oliveiro wrote: >

Re: Pydev 1.5.8 Released

2010-06-28 Thread ejosvp
On 28 jun, 22:35, ejosvp wrote: > I have a problem with pydev 1.5.8 > > An error has occurred. See error log for more details. > com.aptana.editor.common.CommonEditorPlugin.getThemeManager()Lcom/ > aptana/editor/common/theme/IThemeManager; > > I seek the file and that file does not exist my log i

Re: Pydev 1.5.8 Released

2010-06-28 Thread ejosvp
I have a problem with pydev 1.5.8 An error has occurred. See error log for more details. com.aptana.editor.common.CommonEditorPlugin.getThemeManager()Lcom/ aptana/editor/common/theme/IThemeManager; I seek the file and that file does not exist -- http://mail.python.org/mailman/listinfo/python-l

Re: Lockless algorithms in python (Nothing to do with GIL)

2010-06-28 Thread sturlamolden
On 29 Jun, 05:11, Ryan Kelly wrote: > Very interesting idea.  Will it work if accessed through ctypes? > >    ticker = ctypes.c_int.in_dll(ctypes.pythonapi,"_Py_Ticker") >    ticker.value = 0x7fff > > Or does ctypes muck with the GIL in a way that would break this idea? > >>> ctypes.pythonap

Re: optparse TypeError

2010-06-28 Thread Michele Simionato
On Jun 28, 11:47 pm, rantingrick wrote: > Give your *script* an > enema, and do *yourself* a favor by harnessing the simplistic elegance > of the "optphart" module instead! > > #-- Start Script --# > def optphart(args): >     d = {'args':[]} >     for arg in args: >         if arg.startswith('-'):

Re: optparse TypeError

2010-06-28 Thread Michele Simionato
On Jun 28, 9:56 pm, Ben Finney wrote: > Michele Simionato writes: > > optparse is so old-fashioned. Use plac! > > The OP should be made aware that: > > * plac is a third-party library with (TTBOMK) no prospect of inclusion >   in the standard library > > * optparse is in the standard library and

Re: Why are String Formatted Queries Considered So Magical?

2010-06-28 Thread Peter H. Coffin
On Mon, 28 Jun 2010 03:07:29 -0700, Dennis Lee Bieber wrote: > Coding for something like a DBTG network database did not allow for > easy changes in queries... What would be a simple join in SQL was > traversing a circular linked list in the DBTG database my college > taught. EG: loop get nex

Re: Python as a scripting language. Alternative to bash script?

2010-06-28 Thread Peter H. Coffin
On Mon, 28 Jun 2010 23:12:47 +0100, Rhodri James wrote: > On Mon, 28 Jun 2010 18:57:45 +0100, John Nagle wrote: > >> On 6/28/2010 7:58 AM, Benjamin Kaplan wrote: >>> How does a program return anything other than an exit code? >> >> Ah, yes, the second biggest design mistake in UNIX. >> >>

Re: Lockless algorithms in python (Nothing to do with GIL)

2010-06-28 Thread Ryan Kelly
On Mon, 2010-06-28 at 19:45 -0700, sturlamolden wrote: > > > Many lockless algorithms that I have looked at thusfar require a > > > "Compare and Swap" operation. Does python have an equivalent to this? > > > Is python high level enough that it has something better than this or > > > it simply doesn

[python] how to ensure item in list or dict bind with "an uuid meaning" integer type ID?

2010-06-28 Thread kee chen
Dear all, I have 2 lists stored in 2 text files may have duplicated records, the raw data looks like this: lfruit lcountry == = orange japan pearchina

Re: Lockless algorithms in python (Nothing to do with GIL)

2010-06-28 Thread sturlamolden
> > Many lockless algorithms that I have looked at thusfar require a > > "Compare and Swap" operation. Does python have an equivalent to this? > > Is python high level enough that it has something better than this or > > it simply doesn't need it? Python does have a GIL, and contrary to the title

Re: Lockless algorithms in python (Nothing to do with GIL)

2010-06-28 Thread sturlamolden
> > Many lockless algorithms that I have looked at thusfar require a > > "Compare and Swap" operation. Does python have an equivalent to this? > > Is python high level enough that it has something better than this or > > it simply doesn't need it? Python does have a GIL, and contrary to the title

Re: refactoring a group of import statements

2010-06-28 Thread Steven W. Orr
On 06/27/10 23:20, quoth GrayShark: > Thanks for the help > That was what I was looking for. All the rest, the arguments were > unhelpful. > > Question: If you can't answer the question, why are you talking? > > I'm American Indian. That's what I was taught. We don't talk that much. > But you

Re: dynamically modify help text

2010-06-28 Thread Steven D'Aprano
On Tue, 29 Jun 2010 10:37:44 +1000, Ben Finney wrote: > Brian Blais writes: > >> On Jun 28, 2010, at 14:25 , Chris Rebert wrote: >> > __doc__ is normally defined on classes, e.g. `A`, not instances, e.g. >> > `a`. help() looks for __doc__ accordingly. >> >> so that gets back to my original quest

Re: Why Is Escaping Data Considered So Magical?

2010-06-28 Thread Steven D'Aprano
On Mon, 28 Jun 2010 20:55:53 -0400, Roy Smith wrote: > The nice thing about null-terminated strings is how portable they have > been over various word lengths. Life would have been truly inconvenient > if K&R had picked, say, a 16-bit length field, and then we needed to > bump that up to 32 bits

validate string representation of a timedelta

2010-06-28 Thread CM
I'm looking for a good way to check whether a certain string is valid. It is a string representation of a Python timedelta object, like this: '0:00:03.695000' (But the first place, the hours, could also be double digits) In trying to figure out how to validate that, I saw this page which create

Re: Lockless algorithms in python (Nothing to do with GIL)

2010-06-28 Thread Ryan Kelly
On Mon, 2010-06-28 at 18:27 -0700, Zac Burns wrote: > > > > I've managed to avoid locking in some cases by using > dict.setdefault() as a kind of atomic test-and-set operation. > It's not a full compare-and-swap but you could implement a > simple locking sch

Re: Lockless algorithms in python (Nothing to do with GIL)

2010-06-28 Thread Zac Burns
> > Sure, but I think you're timing the wrong thing here. You would only > allocate the lock relatively rarely - it's the overhead of *acquiring* > the lock that's the real problem. > > r...@durian:~$ python -m timeit -s "from threading import Lock; l = > Lock()" "l.acquire(); l.release()" > 1

Re: Why Python3

2010-06-28 Thread Terry Reedy
On 6/28/2010 12:25 AM, John Nagle wrote: Unfortunately, that's not what's happening in the development pipeline. Please do some research before posting year-old news as current news. > Unladen Swallow targets Python 2.6.1. It used 2.6 for development because that was the current stable relea

Re: Why Is Escaping Data Considered So Magical?

2010-06-28 Thread Roy Smith
In article <7xmxuffpxp@ruckus.brouhaha.com>, Paul Rubin wrote: > Gregory Ewing writes: > > I don't think it was as stupid as that back when C was > > designed. Every byte of memory was precious in those days, > > and if you had, say, 10 bytes allocated for a string, you > > wanted to be abl

Re: Benchmarker 1.1.0 released - a samll benchmark utility

2010-06-28 Thread kwatch
Stefan, Thank you for trying Benchmarker library. On Jun 28, 6:39 pm, Stefan Behnel wrote: > Makoto Kuwata, 26.06.2010 19:09: > > > I released Benchmarker 1.1.0. > >http://pypi.python.org/pypi/Benchmarker/ > > > Benchmarker is a small utility to benchmark your code. > > Does it use any statistica

Re: I strongly dislike Python 3

2010-06-28 Thread Chris Rebert
On Mon, Jun 28, 2010 at 1:08 PM, Edward A. Falk wrote: > In article , > Stephen Hansen   wrote: >> >>No one said otherwise, or that print was useless and never used in such >>contexts. > > I was responding to the question "Also, do you use print *that* > much? Really?"  The implication being that

Pydev 1.5.8 Released

2010-06-28 Thread Fabio Zadrozny
Hi All, Pydev 1.5.8 has been released Details on Pydev: http://pydev.org Details on its development: http://pydev.blogspot.com Release Highlights: --- * Features only available on Aptana Studio 3 (Beta): * Theming support provided by Aptana Studio used * Fi

Re: dynamically modify help text

2010-06-28 Thread Ben Finney
Brian Blais writes: > On Jun 28, 2010, at 14:25 , Chris Rebert wrote: > > __doc__ is normally defined on classes, e.g. `A`, not instances, > > e.g. `a`. help() looks for __doc__ accordingly. > > so that gets back to my original question: can I change this text at > runtime. Doesn't look like I c

Re: Why Is Escaping Data Considered So Magical?

2010-06-28 Thread Lawrence D'Oliveiro
In message , Nobody wrote: > On Sun, 27 Jun 2010 14:36:10 +1200, Lawrence D'Oliveiro wrote: > >> Except nobody has yet shown an alternative which is easier to get right. > > For SQL, use stored procedures or prepared statements. So feel free to rewrite my example using either stored procedures

Re: Why are String Formatted Queries Considered So Magical?

2010-06-28 Thread Lawrence D'Oliveiro
In message <14e44c9c-04d9-452d-b544-498adfaf7...@d8g2000yqf.googlegroups.com>, Carl Banks wrote: > Seriously, almost every other kind of library uses a binary API. What > makes databases so special that they need a string-command based API? HTML is also effectively a string-based API. And what a

Re: Lockless algorithms in python (Nothing to do with GIL)

2010-06-28 Thread Ryan Kelly
On Mon, 2010-06-28 at 16:46 -0700, Zac Burns wrote: > In my experience it is far more expensive to allocate a lock in python > then it is the types that use them. Here are some examples: > > >>> timeit.timeit('Lock()', 'from threading import Lock') > 1.4449114807669048 > > >>> timeit.timeit('dict

Re: dynamically modify help text

2010-06-28 Thread Brian Blais
On Jun 28, 2010, at 14:25 , Chris Rebert wrote: On Jun 27, 2010, at 22:37 , Red Forks wrote: Read you doc file and set the __doc__ attr of the object you want to change. __doc__ is normally defined on classes, e.g. `A`, not instances, e.g. `a`. help() looks for __doc__ accordingly. Cheers,

Re: [OT] Re: Why Is Escaping Data Considered So Magical?

2010-06-28 Thread Lawrence D'Oliveiro
In message , Kushal Kumaran wrote: > On Sun, Jun 27, 2010 at 5:16 PM, Lawrence D'Oliveiro > wrote: > >>In message , Kushal >> Kumaran wrote: >> >>> On Sun, Jun 27, 2010 at 9:47 AM, Lawrence D'Oliveiro >>> wrote: >>> A long while ago I came up with this macro: #define Descr(v) &v,

Lockless algorithms in python (Nothing to do with GIL)

2010-06-28 Thread Zac Burns
In my experience it is far more expensive to allocate a lock in python then it is the types that use them. Here are some examples: >>> timeit.timeit('Lock()', 'from threading import Lock') 1.4449114807669048 >>> timeit.timeit('dict()') 0.2821554294221187 >>> timeit.timeit('list()') 0.17358153222

Re: [OT] Football was: Python dynamic attribute creation

2010-06-28 Thread Mark Lawrence
On 29/06/2010 00:21, Alexander Kapps wrote: Mark Lawrence wrote: On 28/06/2010 20:23, Alexander Kapps wrote: UHHM! Forget it. This of course doesn't work with setattr too. My stupidness. :-( Don't worry too much, looks like your nation's football is much better than your settattr knowledge.

[OT] Football was: Python dynamic attribute creation

2010-06-28 Thread Alexander Kapps
Mark Lawrence wrote: On 28/06/2010 20:23, Alexander Kapps wrote: UHHM! Forget it. This of course doesn't work with setattr too. My stupidness. :-( Don't worry too much, looks like your nation's football is much better than your settattr knowledge. I very much appreciate your attempt to make

pysandbox 1.0: a new sandbox for Python

2010-06-28 Thread Victor Stinner
pysandbox is a Python sandbox. By default, untrusted code executed in the sandbox cannot modify the environment (write a file, use print or import a module). But you can configure the sandbox to choose exactly which features are allowed or not, eg. import sys module and read /etc/ issue file. Webs

Re: An invalid expression as parameter

2010-06-28 Thread Terry Reedy
On 6/28/2010 10:49 AM, Stephen Hansen wrote: Now, if you are entering a generator where its not 'on its own' and its not ambiguous-- such as inside a function call-- you don't have to surround it by its own parens. So you don't have to do f((i for i in range(4)). You need another ) on the end.

Re: Python as a scripting language. Alternative to bash script?

2010-06-28 Thread Rhodri James
On Mon, 28 Jun 2010 18:57:45 +0100, John Nagle wrote: On 6/28/2010 7:58 AM, Benjamin Kaplan wrote: How does a program return anything other than an exit code? Ah, yes, the second biggest design mistake in UNIX. Programs have "argv" and "argc", plus environment variables, going in.

Re: optparse TypeError

2010-06-28 Thread rantingrick
On Jun 28, 10:44 am, Michele Simionato wrote: > optparse is so old-fashioned. Use plac! Hog wash! Both are archaic and asinine. Both clog your scripts with wasted lines and your memory with complex interfaces far worse than colon clogging junk food can hold a candle to. Give your *script* an ene

Re: Python dynamic attribute creation

2010-06-28 Thread Mark Lawrence
On 28/06/2010 20:23, Alexander Kapps wrote: Alexander Kapps wrote: Bruno Desthuilliers wrote: Alexander Kapps a écrit : (snip) While I personally don't agree with this proposal (but I understand why some people might want it), I can see a reason. When disallowing direct attribute creation, th

Re: I strongly dislike Python 3

2010-06-28 Thread Martin v. Loewis
> Until such time as 100% of the systems I might ever want to run my progams > on have python 3 installed, I cannot port my programs over from python 2. You don't have to port them from python 2, but still could it make easy to use them with Python 3: just arrange it so that 2to3 will correctly co

Re: I strongly dislike Python 3

2010-06-28 Thread geremy condra
On Mon, Jun 28, 2010 at 1:52 PM, Grant Edwards wrote: > On 2010-06-28, geremy condra wrote: >> On Mon, Jun 28, 2010 at 1:08 PM, Edward A. Falk wrote: >>> In article , >>> Stephen Hansen ? wrote: No one said otherwise, or that print was useless and never used in such contexts. >>> >>

Re: Python as a scripting language. Alternative to bash script?

2010-06-28 Thread Michael Torrie
On 06/28/2010 02:06 PM, Mithrandir wrote: > I can't see Python as an alt. to bash. (As I recall) Python is much more > object-oriented than bash, but also there are many commands (such as apt- > get, etc.) that would need Python equivs. However, I can see Python being > used as a scripting alt. t

Re: I strongly dislike Python 3

2010-06-28 Thread Robert Kern
On 6/28/10 3:09 PM, Edward A. Falk wrote: In article, Stephen Hansen wrote: Any other use, I basically operate on a file object. I use file objects all the time. I use print with them. The 2to3 conversion script takes care of this for you. [~]$ 2to3 foo.py RefactoringTool: Skipping impli

Re: Python dynamic attribute creation

2010-06-28 Thread Michael Torrie
On 06/28/2010 02:31 PM, Aahz wrote: > In article , > Michael Torrie wrote: >> True. But you can't really criticize a language's implementation of OOP >> without a good understanding of the "pure" OO language. For example, in >> Smalltalk If/Then statements are actually methods of Boolean object

Re: I strongly dislike Python 3

2010-06-28 Thread Grant Edwards
On 2010-06-28, geremy condra wrote: > On Mon, Jun 28, 2010 at 1:08 PM, Edward A. Falk wrote: >> In article , >> Stephen Hansen ? wrote: >>> >>>No one said otherwise, or that print was useless and never used in such >>>contexts. >> >> I was responding to the question "Also, do you use print *that*

Re: dynamically modify help text

2010-06-28 Thread Christian Heimes
> >>> i.__add__ = __add__ > >>> i+1 > 6 > >>> > > Was this in reference to a specific python version? This doesn't work with new style classes and thus not in Python 3.x. Subclass from object and you'll see the difference. Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: I strongly dislike Python 3

2010-06-28 Thread Stephen Hansen
On 6/28/10 1:30 PM, geremy condra wrote: On Mon, Jun 28, 2010 at 1:08 PM, Edward A. Falk wrote: In article, Stephen Hansen wrote: No one said otherwise, or that print was useless and never used in such contexts. I was responding to the question "Also, do you use print *that* much? Really?"

Re: dynamically modify help text

2010-06-28 Thread Stephen Hansen
On 6/28/10 1:13 PM, Emile van Sebille wrote: On 6/28/2010 12:02 PM Benjamin Kaplan said... Just to save the OP some trouble later on: this optimization is done for most of the __*__ methods. Overriding __add__ on an instance won't change the behavior of a + b. ActivePython 2.4.1 Build 247 (Act

Re: dynamically modify help text

2010-06-28 Thread Thomas Jollans
On 06/28/2010 10:13 PM, Emile van Sebille wrote: > On 6/28/2010 12:02 PM Benjamin Kaplan said... >> Just to save the OP some trouble later on: this optimization is done >> for most of the __*__ methods. Overriding __add__ on an instance won't >> change the behavior of a + b. > > ActivePython 2.4.1

Re: dynamically modify help text

2010-06-28 Thread Chris Kaynor
On Mon, Jun 28, 2010 at 1:13 PM, Emile van Sebille wrote: > On 6/28/2010 12:02 PM Benjamin Kaplan said... > > Just to save the OP some trouble later on: this optimization is done >> for most of the __*__ methods. Overriding __add__ on an instance won't >> change the behavior of a + b. >> > > Act

Re: Python dynamic attribute creation

2010-06-28 Thread Aahz
In article , Michael Torrie wrote: >On 06/27/2010 11:58 PM, Stephen Hansen wrote: >> >> To say you can't really know "much about" OOP without knowing "much >> about" Smalltalk seems basically, well, wrong. > >True. But you can't really criticize a language's implementation of OOP >without a goo

Re: I strongly dislike Python 3

2010-06-28 Thread geremy condra
On Mon, Jun 28, 2010 at 1:08 PM, Edward A. Falk wrote: > In article , > Stephen Hansen   wrote: >> >>No one said otherwise, or that print was useless and never used in such >>contexts. > > I was responding to the question "Also, do you use print *that* > much? Really?"  The implication being that

Re: Python as a scripting language. Alternative to bash script?

2010-06-28 Thread Stephen Hansen
On 6/28/10 1:06 PM, Mithrandir wrote: Paul Rubin wrote in news:7xpqzbj8st@ruckus.brouhaha.com: Re: Python as a scripting language. Alternative to bash script? That's interesting but I'm having a hard time seeing how it would work. I think environment variables didn't exist in early vers

Re: dynamically modify help text

2010-06-28 Thread Emile van Sebille
On 6/28/2010 12:02 PM Benjamin Kaplan said... Just to save the OP some trouble later on: this optimization is done for most of the __*__ methods. Overriding __add__ on an instance won't change the behavior of a + b. ActivePython 2.4.1 Build 247 (ActiveState Corp.) based on Python 2.4.1 (#65, Ju

Re: I strongly dislike Python 3

2010-06-28 Thread Edward A. Falk
In article , Stephen Hansen wrote: > >Any other use, I basically operate on a file object. I use file objects all the time. I use print with them. -- -Ed Falk, f...@despams.r.us.com http://thespamdiaries.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: I strongly dislike Python 3

2010-06-28 Thread Edward A. Falk
In article , Stephen Hansen wrote: > >No one said otherwise, or that print was useless and never used in such >contexts. I was responding to the question "Also, do you use print *that* much? Really?" The implication being that in the majority of useful python programs, you don't really need to

Re: Python as a scripting language. Alternative to bash script?

2010-06-28 Thread Mithrandir
Paul Rubin wrote in news:7xpqzbj8st@ruckus.brouhaha.com: > Re: Python as a scripting language. Alternative to bash script? > That's interesting but I'm having a hard time seeing how it would work. > I think environment variables didn't exist in early versions of Unix, > and argc/argv were p

Re: refactoring a group of import statements

2010-06-28 Thread Stephen Hansen
On 6/28/10 12:54 PM, rantingrick wrote: On Jun 27, 10:20 pm, GrayShark wrote: Question: If you can't answer the question, why are you talking? Q: If you can't take advice without complaining, then why are you asking? I'm American Indian. That's what I was taught. We don't talk that much. Bu

Re: I strongly dislike Python 3

2010-06-28 Thread Edward A. Falk
In article , Grant Edwards wrote: > >Maybe it's just me, but I find both debugging and small scripts to be >very useful. Ditto. I've also written a number of large scripts, and I *always* use print in them. -- -Ed Falk, f...@despams.r.us.com http://thespamdiaries.blogspot.com/

Re: C++/Python function call

2010-06-28 Thread Rami Chowdhury
On Monday 28 June 2010 12:46:13 Zohair M. Abu Shaban wrote: > Hello every one: > > > I have this python function defined as: > > def set_time_at_next_pps(self, *args, **kwargs): > > """set_time_at_next_pps(self, usrp2::time_spec_t time_spec) > -> bool""" > > > > it was generated to do t

Re: optparse TypeError

2010-06-28 Thread Ben Finney
Michele Simionato writes: > optparse is so old-fashioned. Use plac! The OP should be made aware that: * plac is a third-party library with (TTBOMK) no prospect of inclusion in the standard library * optparse is in the standard library and has been for many versions * argparse is a third-par

Re: refactoring a group of import statements

2010-06-28 Thread rantingrick
On Jun 27, 10:20 pm, GrayShark wrote: > Question: If you can't answer the question, why are you talking? Q: If you can't take advice without complaining, then why are you asking? > I'm American Indian. That's what I was taught. We don't talk that much. > But you get an answer when we do talk. Ma

Re: Python dynamic attribute creation

2010-06-28 Thread Michael Torrie
On 06/27/2010 11:58 PM, Stephen Hansen wrote: > To say you can't really know "much about" OOP without knowing "much > about" Smalltalk seems basically, well, wrong. True. But you can't really criticize a language's implementation of OOP without a good understanding of the "pure" OO language. Fo

C++/Python function call

2010-06-28 Thread Zohair M. Abu Shaban
Hello every one: I have this python function defined as: def set_time_at_next_pps(self, *args, **kwargs): """set_time_at_next_pps(self, usrp2::time_spec_t time_spec) -> bool""" it was generated to do the same function as the c++: set_time_at_next_pps(usrp2::time_spec_t(0, 0)) I

Re: Python dynamic attribute creation

2010-06-28 Thread Michael Torrie
On 06/25/2010 09:39 PM, WANG Cong wrote: > Thanks, I have to admit that I know nothing about Smalltalk. If you know nothing about Smalltalk then you really aren't in a position to talk about what is and is not OOP. Smalltalk is one of the original OOP languages and purists define OOP as the model

Re: Python dynamic attribute creation

2010-06-28 Thread Stephen Hansen
On 6/28/10 12:09 PM, Alexander Kapps wrote: This seems to work quite well: class TypoProtection(object): def __init__(self): self.foo = 42 self.bar = 24 def _setattr(self, name, value): if name in self.__dict__: self.__dict__[name] = value else: raise AttributeError, "%s has no '%s' attribute"

Re: Python dynamic attribute creation

2010-06-28 Thread Alexander Kapps
Alexander Kapps wrote: Bruno Desthuilliers wrote: Alexander Kapps a écrit : (snip) While I personally don't agree with this proposal (but I understand why some people might want it), I can see a reason. When disallowing direct attribute creation, those typos that seem to catch newcommers won

Re: Python dynamic attribute creation

2010-06-28 Thread Alexander Kapps
Bruno Desthuilliers wrote: Alexander Kapps a écrit : (snip) While I personally don't agree with this proposal (but I understand why some people might want it), I can see a reason. When disallowing direct attribute creation, those typos that seem to catch newcommers won't happen anymore. What

Re: Why Python3

2010-06-28 Thread rantingrick
On Jun 28, 12:58 pm, "OKB (not okblacke)" wrote: > Steven D'Aprano wrote: > > None of PyPy, Unladen Swallow or IronPython are dependencies for > > Python 3.x to be "ready for prime time". Neither is C module > > support. > >         I think this is being overoptimistic.  For me, "ready for prime >

Re: dynamically modify help text

2010-06-28 Thread Benjamin Kaplan
On Mon, Jun 28, 2010 at 11:25 AM, Chris Rebert wrote: > On Mon, Jun 28, 2010 at 11:13 AM, Brian Blais wrote: >> On Jun 27, 2010, at 22:37 , Red Forks wrote: >>> Read you doc file and set the __doc__ attr of the object you want to >>> change. >>> >>> On Monday, June 28, 2010, Brian Blais wrote: >

Re: More MySQL Stuff

2010-06-28 Thread Emile van Sebille
On 6/28/2010 9:10 AM Victor Subervi said... Any other suggestions? http://www.databaseanswers.org/tutorial4_db_schema/index.htm -- http://mail.python.org/mailman/listinfo/python-list

Re: Python as a scripting language. Alternative to bash script?

2010-06-28 Thread Paul Rubin
John Nagle writes: >Programs have "argv" and "argc", plus environment variables, > going in. So, going in, there are essentially subroutine parameters. > But all that comes back is an exit code. They should have had > something similar coming back, with arguments to "exit()" returning > the r

Re: Python as a scripting language. Alternative to bash script?

2010-06-28 Thread Michael Torrie
On 06/28/2010 12:05 PM, Dave Pawson wrote: > On 28 June 2010 18:39, Michael Torrie wrote: > >> Sure. I've created a module called runcmd that does 90% of what I >> want (easy access to stdout, stderr, error code). I've attached >> it to this e-mail. Feel free to use it; this post puts my code

Re: dynamically modify help text

2010-06-28 Thread Chris Rebert
On Mon, Jun 28, 2010 at 11:13 AM, Brian Blais wrote: > On Jun 27, 2010, at 22:37 , Red Forks wrote: >> Read you doc file and set the __doc__ attr of the object you want to >> change. >> >> On Monday, June 28, 2010, Brian Blais wrote: >>> I know that the help text for an object will give a descrip

Re: dynamically modify help text

2010-06-28 Thread Brian Blais
On Jun 27, 2010, at 22:37 , Red Forks wrote: Read you doc file and set the __doc__ attr of the object you want to change. On Monday, June 28, 2010, Brian Blais wrote: I know that the help text for an object will give a description of every method based on the doc string. Is there a way t

Re: Python as a scripting language. Alternative to bash script?

2010-06-28 Thread Dave Pawson
On 28 June 2010 18:39, Michael Torrie wrote: > On 06/28/2010 05:48 AM, Dave Pawson wrote: >> Main queries are: Ease of calling out to bash to use something like >> imageMagick or Java? Ease of grabbing return parameters? E.g. convert >> can return both height and width of an image. Can this be ret

Re: Why Python3

2010-06-28 Thread OKB (not okblacke)
Steven D'Aprano wrote: > None of PyPy, Unladen Swallow or IronPython are dependencies for > Python 3.x to be "ready for prime time". Neither is C module > support. I think this is being overoptimistic. For me, "ready for prime time" means "I can rely on being able to find a way to do w

Re: Python as a scripting language. Alternative to bash script?

2010-06-28 Thread John Nagle
On 6/28/2010 7:58 AM, Benjamin Kaplan wrote: How does a program return anything other than an exit code? Ah, yes, the second biggest design mistake in UNIX. Programs have "argv" and "argc", plus environment variables, going in. So, going in, there are essentially subroutine parameters.

Re: N00b question: matching stuff with variables.

2010-06-28 Thread Rami Chowdhury
On Monday 28 June 2010 10:29:35 Ken D'Ambrosio wrote: > Hi, all. I've got a file which, in turn, contains a couple thousand > filenames. I'm writing a web front-end, and I want to return all the > filenames that match a user-input value. In Perl, this would be something > like, > > if (/$value/

Re: N00b question: matching stuff with variables.

2010-06-28 Thread Stephen Hansen
On 6/28/10 10:29 AM, Ken D'Ambrosio wrote: Hi, all. I've got a file which, in turn, contains a couple thousand filenames. I'm writing a web front-end, and I want to return all the filenames that match a user-input value. In Perl, this would be something like, if (/$value/){print "$_ matches\n

Re: N00b question: matching stuff with variables.

2010-06-28 Thread Thomas Jollans
On 06/28/2010 07:29 PM, Ken D'Ambrosio wrote: > Hi, all. I've got a file which, in turn, contains a couple thousand > filenames. I'm writing a web front-end, and I want to return all the > filenames that match a user-input value. In Perl, this would be something > like, > > if (/$value/){print

PDF Generation With Reportlab

2010-06-28 Thread Albert Leibbrandt
Hi All I am hoping there is someone out there that knows reportlab quite well. I posted this on the reportlab mailing list but there is not much activity on that list I am currently generating a pdf report using reportlab 2.3 and python 2.5.4. The report has a table that spans multiple pages

Re: Python as a scripting language. Alternative to bash script?

2010-06-28 Thread Michael Torrie
On 06/28/2010 05:48 AM, Dave Pawson wrote: > Main queries are: Ease of calling out to bash to use something like > imageMagick or Java? Ease of grabbing return parameters? E.g. convert > can return both height and width of an image. Can this be returned to > the Python program? Can Python access th

N00b question: matching stuff with variables.

2010-06-28 Thread Ken D'Ambrosio
Hi, all. I've got a file which, in turn, contains a couple thousand filenames. I'm writing a web front-end, and I want to return all the filenames that match a user-input value. In Perl, this would be something like, if (/$value/){print "$_ matches\n";} But trying to put a variable into regex

Re: More MySQL Stuff

2010-06-28 Thread Victor Subervi
On Mon, Jun 28, 2010 at 12:11 PM, Stephen Hansen wrote: > On 6/28/10 9:10 AM, Victor Subervi wrote: > >> Hi; >> So I'm launching into a major rewrite of my shopping cart because I've >> finally woken up to the challenge of injection attacks. One of my major >> problems is that many column names ar

Re: I strongly dislike Python 3

2010-06-28 Thread Stephen Hansen
On 6/28/10 9:23 AM, Thomas Jollans wrote: Installing Linux is still a LOT easier than installing a working MSYS since you get proper package management with proper dependency resolution, while with MSYS, you end up downloading dozens of different inter-dependent GNU packages one-by-one until anyt

Re: CONTROLLED DEMOLITION INC explosive-charge placement technician ?Tom ?Sullivan 911 TESTIMONIAL Video

2010-06-28 Thread Juha Nieminen
In comp.lang.c++ small Pox wrote: > Academia and Scientific and Arts community is the BIGGEST RECIPIENT of > Federal Grants from TAX PAYER MONEY What's so hard to understand in "take your religion elsewhere, we don't want it here"? Go away. -- http://mail.python.org/mailman/listinfo/pyth

Re: More MySQL Stuff

2010-06-28 Thread Stephen Hansen
On 6/28/10 9:10 AM, Victor Subervi wrote: Hi; So I'm launching into a major rewrite of my shopping cart because I've finally woken up to the challenge of injection attacks. One of my major problems is that many column names are determined when the shopping cart is built. For example, how many pho

Re: Python as a scripting language. Alternative to bash script?

2010-06-28 Thread Thomas Jollans
On 06/28/2010 06:08 PM, Dave Pawson wrote: > Thanks for the replies (and Benjamin). > Not met with the subprocess idea. > > On 28 June 2010 16:29, D'Arcy J.M. Cain wrote: > >>> Main queries are: >>> Ease of calling out to bash to use something like imageMagick or Java? >> >> You don't need to ca

Re: I strongly dislike Python 3

2010-06-28 Thread Thomas Jollans
On 06/28/2010 04:36 PM, Stephen Hansen wrote: > On 6/28/10 2:20 AM, Thomas Jollans wrote: >> On 06/28/2010 03:21 AM, Stephen Hansen wrote: >>> On 6/27/10 6:11 PM, geremy condra wrote: On Sun, Jun 27, 2010 at 8:50 PM, Grant Edwards wrote: > If you install a real shell on Windows, the

Re: Python 2.6.x version module compatibility

2010-06-28 Thread Stephen Hansen
On 6/28/10 9:06 AM, Ratufa wrote: Suppose I have a webapp running in a virtualenv (--no-site-packages) cloned off a Python 2.6.2 install, running under mod_wsgi. The virtual environment has various modules installed in it, some perhaps using C extensions. Question: If the Python installation

More MySQL Stuff

2010-06-28 Thread Victor Subervi
Hi; So I'm launching into a major rewrite of my shopping cart because I've finally woken up to the challenge of injection attacks. One of my major problems is that many column names are determined when the shopping cart is built. For example, how many photos are to be uploaded is determined that wa

Re: Python as a scripting language. Alternative to bash script?

2010-06-28 Thread Dave Pawson
Thanks for the replies (and Benjamin). Not met with the subprocess idea. On 28 June 2010 16:29, D'Arcy J.M. Cain wrote: >> Main queries are: >> Ease of calling out to bash to use something like imageMagick or Java? > > You don't need to call bash to call an external program.  Check out the > sub

Python 2.6.x version module compatibility

2010-06-28 Thread Ratufa
Suppose I have a webapp running in a virtualenv (--no-site-packages) cloned off a Python 2.6.2 install, running under mod_wsgi. The virtual environment has various modules installed in it, some perhaps using C extensions. Question: If the Python installation gets upgraded to 2.6.5 (or 2.6.7 at

Re: optparse TypeError

2010-06-28 Thread Michele Simionato
On Jun 28, 3:30 pm, dirknbr wrote: > I get an int object is not callable TypeError when I execute this. But > I don't understand why. > >     parser = optparse.OptionParser("usage: %lines [options] arg1") >     parser.add_option("-l", "--lines", dest="lines", >                       default=10, ty

Re: Python dynamic attribute creation

2010-06-28 Thread Stephen Hansen
On 6/28/10 8:27 AM, Aahz wrote: In article<4c285e7c$0$17371$426a7...@news.free.fr>, Bruno Desthuilliers wrote: Aahz a écrit : In article<4c2747c1$0$4545$426a7...@news.free.fr>, Bruno Desthuilliers wrote: Python has no pretention at "elegance". That's not true at all. More precisely, I wo

Re: Python dynamic attribute creation

2010-06-28 Thread Aahz
In article <4c285e7c$0$17371$426a7...@news.free.fr>, Bruno Desthuilliers wrote: >Aahz a écrit : >> In article <4c2747c1$0$4545$426a7...@news.free.fr>, >> Bruno Desthuilliers wrote: >>> >>> Python has no pretention at "elegance". >> >> That's not true at all. More precisely, I would agree wit

Re: Python as a scripting language. Alternative to bash script?

2010-06-28 Thread D'Arcy J.M. Cain
On Mon, 28 Jun 2010 12:48:51 +0100 Dave Pawson wrote: > I've a fairly long bash script and I'm wondering > how easy it would be to port to Python. That's too big a question without seeing more of what your script does. I will try to suggest some direction though. First, if you have a complicate

  1   2   >