Re: object.enable() anti-pattern

2013-05-08 Thread Robert Kern
bling it, or similar. I don't think the anti-pattern has a name, but it's opposite pattern is named: http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terribl

Re: Style question -- plural of class name?

2013-05-09 Thread Robert Kern
oEntry`s But I don't mind A list of FooEntries Hopefully there isn't also a `FooEntries` class. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying tru

Re: object.enable() anti-pattern

2013-05-10 Thread Robert Kern
e they are misapplied, where YAGNI, why novices overuse it, other patterns that should be used instead, and also the circumstances where it is actually a good pattern instead. To artificially limit the discussion of the anti-pattern to the trivial, entirely unmotivated case forbids most of the in

Re: object.enable() anti-pattern

2013-05-10 Thread Robert Kern
On 2013-05-10 15:01, Roy Smith wrote: In article , Robert Kern wrote: I'd be curious to see in-the-wild instances of the anti-pattern that you are talking about, then. I think everyone agrees that entirely unmotivated "enable" methods should be avoided, but I have my doubts

Re: object.enable() anti-pattern

2013-05-10 Thread Robert Kern
On 2013-05-10 16:44, Serhiy Storchaka wrote: 10.05.13 15:19, Robert Kern написав(ла): I'd be curious to see in-the-wild instances of the anti-pattern that you are talking about, then. Many (if not most) GUI frameworks use this pattern. button = Button(

Re: object.enable() anti-pattern

2013-05-11 Thread Robert Kern
On 2013-05-11 08:51, Steven D'Aprano wrote: On Fri, 10 May 2013 18:20:34 +0100, Robert Kern wrote: According to Steven's criteria, neither of these are instances of the anti-pattern because there are good reasons they are this way. He is reducing the anti-pattern to just those c

Re: Future standard GUI library

2013-05-20 Thread Robert Kern
candidate to replace tkinter. FLTK? (http://www.fltk.org/index.php) tkinter is the Python wrapper of the tk library, just as wxpython is the python wrapper of the wx library. I do not see a py-fltk wrapper. It exists, but it's really old. http://pyfltk.sourceforge.net/ -- Robert Kern "I

Re: PyWart: The problem with "print"

2013-06-03 Thread Robert Kern
On 2013-06-03 05:20, Dan Sommers wrote: On Sun, 02 Jun 2013 23:23:42 -0400, Jason Swails wrote: ... (And yes, a good portion of our code is -still- in Fortran -- but at least it's F90+ :). I am a huge proponent of using the right tool for the job. There is nothing wrong with some well-place

Re: Interactive interpreter hooks

2013-06-03 Thread Robert Kern
])". You will need to write your own REPL for this. Use the code.InteractiveConsole class: http://docs.python.org/2/library/code I recommend source-diving to see what you need to override, but I suspect you can just wrap around the `runsource()` method. -- Robert Kern "I have

Re: Bools and explicitness [was Re: PyWart: The problem with "print"]

2013-06-06 Thread Robert Kern
. With something fully dynamic like Python, it's probably not worth the effort. But maybe checks like this could be useful to something like Coverity. As Serhiy notes, Go does this, almost exactly as you wrote it (modulo syntax). http://golang.org/doc/effective_go.html#interfaces_and_typ

Re: Bools and explicitness [was Re: PyWart: The problem with "print"]

2013-06-06 Thread Robert Kern
compile-time checking of that. Say that on a Haskell list, and they'll take it as a challenge. :-) -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlyin

Re: Re-using copyrighted code

2013-06-10 Thread Robert Kern
? Larry Rosen's free (open source, even!) book _Open Source Licensing_ is good introductory reading. Larry is an intellectual property lawyer and helped draft the current PSF license. http://www.rosenlaw.com/oslbook.htm -- Robert Kern "I have come to believe that the whole w

Re: Simple algorithm question - how to reorder a sequence economically

2013-06-12 Thread Robert Kern
vided by a source such as /dev/random (on Unix systems). It's sometimes referred to as "cryptographic" randomness, due to its necessity in secure encryption work. There are various ways to get this in a cross-platform way. os.random() and os.urandom(), particularly. -- Robert Kern

Re: Newbie: standard way to add version, author and license to a source file?

2013-06-13 Thread Robert Kern
uthor: http://producingoss.com/en/license-quickstart.html#license-quickstart-applying -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth."

Re: Must we include urllib just to decode a URL-encoded string, when using Requests?

2013-06-13 Thread Robert Kern
so? -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list

Re: Must we include urllib just to decode a URL-encoded string, when using Requests?

2013-06-13 Thread Robert Kern
On 2013-06-13 14:25, Dotan Cohen wrote: On Thu, Jun 13, 2013 at 4:20 PM, Robert Kern wrote: Yes. Do you think there is a problem with doing so? I'm pretty sure that Requests will use either urllib or urllib2, depending on what is available on the server. No, it doesn't. It gets

Re: Eval of expr with 'or' and 'and' within

2013-06-14 Thread Robert Kern
hort-circuit. That is why the (name or month or year) returns the first truthy value while (name and month and year) returns the last truthy value. When "or" finds the first truthy value, it can stop looking since the whole expression must be truthy no matter what the values are a

Re: Eval of expr with 'or' and 'and' within

2013-06-14 Thread Robert Kern
? because that will evaluate to the correct Boolean value How do you mean? Please elaborate. Please read the link I gave. It explains why. http://docs.python.org/2/reference/expressions.html#boolean-operations -- Robert Kern "I have come to believe that the whole world is an enigma

Re: Don't feed the troll...

2013-06-15 Thread Robert Kern
client until they fix that. Sorry, I could have sworn you said you weren't using a mail client for this... He's suggesting that *you* who are using a mail reader to use the "reply to list" functionality or request it if it is not present. -- Robert Kern "I have come

Re: Timsort in Cpython

2013-06-15 Thread Robert Kern
ere, could somebody point to me which one is timsort? listsort() http://hg.python.org/cpython/file/default/Objects/listobject.c#l1896 -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it a

Re: Timsort in Cpython

2013-06-15 Thread Robert Kern
(), etc. C.f. http://hg.python.org/cpython/file/default/Objects/listobject.c#l2362 -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth.&q

Re: weird behavior. bug perhaps?

2013-06-18 Thread Robert Kern
lly, I recommend avoiding the matrix type. It causes too many problems. Stick to plain ndarrays. You will probably want to ask further numpy questions on the numpy-discussion mailing list: http://www.scipy.org/scipylib/mailing-lists.html -- Robert Kern "I have come to believe that

Re: n00b question on spacing

2013-06-25 Thread Robert Kern
That is not necessary. The rule is already there. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for a name for a deployment framework...

2013-06-25 Thread Robert Kern
On 2013-06-24 13:50, Roy Smith wrote: Without forming any opinion on the software itself, the best advice I can offer is that naming puns are very popular. If you're thinking of this as a fabric replacement, I would go with cloth, textile, material, gabardine, etc. brocade -- Robert

Re: n00b question on spacing

2013-06-25 Thread Robert Kern
On 2013-06-25 12:48, Chris Angelico wrote: On Tue, Jun 25, 2013 at 9:19 PM, Robert Kern wrote: There is quite a bit of Python's lexical analysis that is specified in places other than the formal notation. That does not mean it is undefined. It is well defined in the lexer code an

Re: Why is the argparse module so inflexible?

2013-06-27 Thread Robert Kern
ding error(). https://github.com/ipython/ipython/blob/master/IPython/core/magic_arguments.py -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list

Re: Making a pass form cgi => webpy framework

2013-06-28 Thread Robert Kern
different ways of deploying web applications without having to rewrite your code. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- U

Re: Making a pass form cgi => webpy framework

2013-06-28 Thread Robert Kern
On 2013-06-28 11:15, Νίκος wrote: Στις 28/6/2013 12:35 μμ, ο/η Robert Kern έγραψε: On 2013-06-28 04:38, Νίκος wrote: Στις 28/6/2013 2:08 πμ, ο/η Cameron Simpson έγραψε: Pick a simple framework or templating engine and try it. I have no recommendations to make in this area myself. Can you

Re: Problems with subclassing enum34

2013-06-28 Thread Robert Kern
Switching the order of the two might work. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems with subclassing enum34

2013-06-28 Thread Robert Kern
On 2013-06-28 16:32, Thomas Heller wrote: Am 28.06.2013 17:25, schrieb Thomas Heller: Robert Kern: enum.EnumMeta uses super() in its __new__() implementation but _ctypes.PyCSimpleType doesn't. Thus, only _ctypes.PyCSimpleType.__new__() gets a chance to run. Switching the order of th

Re: ? get negative from prod(x) when x is positive integers

2013-06-28 Thread Robert Kern
ot;import numpy" in my code. The seems to be a result of using ipython, or at least how I am using it "ipython notebook --pylab inline". The --pylab option will do the following import: from matplotlib.pyplot import * That includes a "from numpy import *" in there.

Re: python adds an extra half space when reading from a string or list

2013-06-30 Thread Robert Kern
the gratuitous insults offlist. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listi

Re: python adds an extra half space when reading from a string or list

2013-06-30 Thread Robert Kern
On 2013-06-30 21:14, Νίκος wrote: Στις 30/6/2013 10:58 μμ, ο/η Robert Kern έγραψε: On 2013-06-30 18:24, Νίκος wrote: Στις 29/6/2013 8:00 μμ, ο/η Mark Lawrence έγραψε: Why this when the approach to Nick the Incompetant Greek has been to roll out the red carpet? Your mother is incompetent

Re: python adds an extra half space when reading from a string or list

2013-06-30 Thread Robert Kern
On 2013-06-30 22:57, Joshua Landau wrote: On 30 June 2013 20:58, Robert Kern wrote: On 2013-06-30 18:24, Νίκος wrote: Στις 29/6/2013 8:00 μμ, ο/η Mark Lawrence έγραψε: Why this when the approach to Nick the Incompetant Greek has been to roll out the red carpet? Your mother is

Re: indexerror: list index out of range??

2013-07-01 Thread Robert Kern
27;ll upset the Python Mailing List Police. *doesn't understand* Mark frequently makes similar comments (in content and tone) to people who come here using Google Groups. Presumably, he has received criticism for this (mostly on tone grounds, I imagine), either on or off list. -- Rober

Re: Need explanation of this error

2013-07-01 Thread Robert Kern
but failing. How did you install scipy? If you used a prebuilt binary installer, can you please link to the exact one that you used? Try using depends.exe to find out what DLL it is looking for. http://www.dependencywalker.com/ The file that you want to check in depends.exe: c:\Python

Re: File exists but Python says 'not found'.

2013-07-01 Thread Robert Kern
ion_2.py", line 80, in main train_data = pd.read_csv(train) Since the filename of regression_2.py in the traceback is fully-qualified, I expect that you are running the program from something other than the c:\Project_1\ directory. -- Robert Kern "I have come to believe that the whol

Re: OSError [Errno 26] ?!?!

2013-07-02 Thread Robert Kern
. He is indeed using actual, bona fide CGI scripts. It's not just an antiquated wording for "web app". -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had

Re: Important features for editors

2013-07-04 Thread Robert Kern
On 2013-07-04 10:14, Νίκος wrote: If you guys want to use it i can send you a patch for it. I know its illegal thing to say but it will help you use it without buying it. Please do not use this forum to make such offers. -- Robert Kern "I have come to believe that the whole world

Re: Explain your acronyms (RSI?)

2013-07-06 Thread Robert Kern
' as a choice. "RSI wrist" would probably have been a wiser start. Not all medical conditions have medication associated with them. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt t

Re: Geo Location extracted from visitors ip address

2013-07-08 Thread Robert Kern
with the proper JavaScript to get the geolocation (if the user allows it) and then send it back to your server through a different CGI script (or web application endpoint). http://diveintohtml5.info/geolocation.html -- Robert Kern "I have come to believe that the whole world is an enigma, a h

Re: Stack Overflow moderator “animuson”

2013-07-10 Thread Robert Kern
On 2013-07-10 10:52, Joshua Landau wrote: On 10 July 2013 10:12, Ian Kelly wrote: On Wed, Jul 10, 2013 at 2:46 AM, Mats Peterson wrote: Then they would have full control of this list and what gets pos Ahhh so this is pos, right? Telling the truth? Interesting. I don't know what you me

Re: could you change PYPI downloads number for not-uploaded packages?

2013-07-22 Thread Robert Kern
r package downloads from PyPI itself. There is no good way for PyPI to count downloads from any other source. What you might want to ask for instead is to have the download count not shown when the packages are not hosted on PyPI. That would be a reasonable change that I think the PyPI team woul

Re: Frustrating circular bytes issue

2012-06-26 Thread Robert Kern
fer_new: break lines = re.split(delimiter, buffer_old + buffer_new) buffer_old = lines.pop(-1) for line in lines: yield line yield buffer_old if __name__ == '__main__': d = Dummy() d.load_filename(__file__) -- Robert K

Re: question about numpy, subclassing, and a DeprecationWarning

2012-06-27 Thread Robert Kern
stions on the numpy mailing list. http://www.scipy.org/Mailing_Lists Personally, I recommend not subclassing ndarray at all. It rarely works out well. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad att

Re: lambda in list comprehension acting funny

2012-07-12 Thread Robert Kern
t tests for each would add significantly to those counts. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list

Re: type(None)()

2012-08-16 Thread Robert Kern
pes there is no use case for that. It's simpler to raise an error. What are the use cases for the empty-argument versions of bool(), int(), float(), and str()? -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own m

Re: [CGI] Why is HTML not rendered?

2012-08-17 Thread Robert Kern
you told the browser to treat it like plain text instead of HTML. Use text/html instead. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth."

Re: Private methods

2012-10-09 Thread Robert Kern
that other things don't need to care about. In Python, using an underscore is simply a convention to note that a method is private - it doesn't actually hide it from other things - correct? This is correct. -- Robert Kern "I have come to believe that the whole world is an enigm

Re: Private methods

2012-10-10 Thread Robert Kern
l_analysis.html#reserved-classes-of-identifiers -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list

Re: serialization and versioning

2012-10-12 Thread Robert Kern
ves as implying "version 0". -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list

Re: [on topic] Re: readline trick needed

2012-10-16 Thread Robert Kern
using IPython, the pure Python REPL for CPython, for IronPython, the C# implementation of Python? https://github.com/ipython/ipython -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as

Re: OT Questions

2012-10-17 Thread Robert Kern
well, so don't get uppity with me. No, you misread his sentence. That's not at all what he was saying. He was saying that one of the benefits that a person may get from working with people smarter than said person is that they can ascertain said person's strengths. -- Robert Kern

Re: Aggressive language on python-list

2012-10-18 Thread Robert Kern
tly state so, but the lack of such a statement is not an excuse for the recipient to make the email public. The default assumption must be that they meant to send it to exactly those people they actually sent it to. Thank you for listening. -- Robert Kern "I have come to believe that the w

Re: turn list of letters into an array of integers

2012-10-24 Thread Robert Kern
On 10/24/12 1:03 PM, 8 Dihedral wrote: The list in python is a list of valid python objects. For the number crunching part, please use arrays in numarray and scipy. Your bot's database is laughably out of date. -- Robert Kern "I have come to believe that the whole world is an

Re: Negative array indicies and slice()

2012-11-01 Thread Robert Kern
"step" slot, mgrid will interpret it as the number of items requested instead of the step. [~] |6> numpy.mgrid[1.5:2.5:11j] array([ 1.5, 1.6, 1.7, 1.8, 1.9, 2. , 2.1, 2.2, 2.3, 2.4, 2.5]) -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless

Re: how to perform word sense disambiguation?

2012-11-01 Thread Robert Kern
/ch06.html http://nltk.org/api/nltk.classify.html -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.o

Re: Organisation of python classes and their methods

2012-11-02 Thread Robert Kern
eat each time a new version of the 'official' class file is released. Do not make them methods of the time-series class. Make functions that take a time-series object. Then you can organize the functions in separate modules to your heart's content and import them all into a single

Re: Negative array indicies and slice()

2012-11-02 Thread Robert Kern
index or offset is needed, not just in slices. List indices, file.seek(), mmap.mmap(), etc. The change to use PyIndex_Check() instead of PyInt_Check() was not very difficult or extensive. Even if you were to change the slicing API for your other reasons, __index__() would still be needed. -- Rob

Re: Organisation of python classes and their methods

2012-11-02 Thread Robert Kern
doc/numpy/reference/index.html http://docs.scipy.org/doc/scipy/reference/index.html http://www.sagemath.org/doc/reference/ http://docs.sympy.org/0.7.2/modules/index.html http://scikit-learn.org/stable/modules/classes.html -- Robert Kern "I have come to believe that the whole world is

Re: Organisation of python classes and their methods

2012-11-02 Thread Robert Kern
a analysis environment. Frequently, they not only have to describe what it's doing, but also introduce the whole concept of what it's doing, why you would want to do such a thing, and provide examples of its use. That's why they are so long. For example: http://docs.scipy.org/doc

Re: word sense disambiguation

2012-11-02 Thread Robert Kern
g/api/nltk.classify.html -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list

Re: Proper place for everything

2012-11-02 Thread Robert Kern
be a strange question, but I might as well start somewhere. There are plenty of good, free blog hosting options. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underl

Re: Web Frameworks Excessive Complexity

2012-11-20 Thread Robert Kern
urnal/PaperInformation.aspx?paperID=779 -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list

Re: Web Frameworks Excessive Complexity

2012-11-20 Thread Robert Kern
l. The research is fairly conclusive that CC doesn't measure what you think it measures. The source of bugs is not excessive complexity in a method, just excessive lines of code. LoC is much simpler, easier to understand, and easier to correct than CC. -- Robert Kern "I have come

Re: Web Frameworks Excessive Complexity

2012-11-20 Thread Robert Kern
CC, LoC) it gives your better product. No, refactoring based on CC does not give you a better product, except by accident. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though i

Re: Web Frameworks Excessive Complexity

2012-11-21 Thread Robert Kern
On 21/11/2012 01:43, Steven D'Aprano wrote: On Tue, 20 Nov 2012 20:07:54 +0000, Robert Kern wrote: The source of bugs is not excessive complexity in a method, just excessive lines of code. Taken literally, that cannot possibly the case. def method(self, a, b, c): do_t

Re: Web Frameworks Excessive Complexity

2012-11-21 Thread Robert Kern
#x27;s not because you reduced the CC of the code. It's because of all of those *other* things that you talk about. Those are the things that should drive your refactoring, not CC, because they actually do cause improved code. -- Robert Kern "I have come to believe that the whole world is a

Re: Web Frameworks Excessive Complexity

2012-11-21 Thread Robert Kern
ction. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list

Re: Web Frameworks Excessive Complexity

2012-11-21 Thread Robert Kern
On 21/11/2012 12:47, Andriy Kornatskyy wrote: Hm... what serves an evidence purpose for you? Well-done empirical studies, like the one I gave you. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attem

Re: Numpy outlier removal

2013-01-07 Thread Robert Kern
a is not "really" normal. "Having outliers" literally means that assuming normality is not fine. If assuming normality were fine, then you wouldn't need to remove outliers. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enig

Re: [Offtopic] Line fitting [was Re: Numpy outlier removal]

2013-01-08 Thread Robert Kern
ns of slowing down *should* be alarming. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list

Re: [Offtopic] Line fitting [was Re: Numpy outlier removal]

2013-01-08 Thread Robert Kern
On 08/01/2013 20:14, Chris Angelico wrote: On Wed, Jan 9, 2013 at 2:55 AM, Robert Kern wrote: On 08/01/2013 06:35, Chris Angelico wrote: ... it looks quite significant to show a line going from the bottom of the graph to the top, but sounds a lot less noteworthy when you see it as a half

Re: importing module versus using function?

2012-01-31 Thread Robert Kern
x27;s namespace in which the function is defined, not one of the many namespaces where the function is called from. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an un

Re: Numeric root-finding in Python

2012-02-12 Thread Robert Kern
oximation. This mostly works well, but sometimes the root-finder gets stuck in a cycle. I don't have any advice for fixing your code, per se, but I would just grab mpmath and use their lambertw function: http://mpmath.googlecode.com/svn/trunk/doc/build/functions/powers.html#lambert-w-function

Re: Numerical Linear Algebra in arbitrary precision

2012-02-17 Thread Robert Kern
ic tasks: http://docs.scipy.org/doc/numpy/reference/routines.linalg.html This will not do arbitrary-precision, though. We use the double- and single-precision routines from LAPACK. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by

Re: Python recursive tree, linked list thingy

2012-03-08 Thread Robert Kern
t for this: http://mentat.za.net/source/connected_components.tar.bz2 http://mentat.za.net/cgi-bin/hgwebdir.cgi/ccomp -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had

Re: Raise X or Raise X()?

2012-03-12 Thread Robert Kern
so prefer to always raise instances of exceptions rather than bare exception classes. It simplifies the mental model. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though

Re: concatenate function

2012-03-13 Thread Robert Kern
pletion of other jobs. You will need to read the documentation of your job queue to figure out how to do this. Once you figure out the right arguments to give to qsub, your Python code is already more or less correct. -- Robert Kern "I have come to believe that the whole world is an enigma

Re: concatenate function

2012-03-13 Thread Robert Kern
what you mean when you say "subprocess.Popen seems not accept to run "qsub" over a second program." -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an

Re: concatenate function

2012-03-13 Thread Robert Kern
On 3/13/12 6:01 PM, ferreirafm wrote: Robert Kern-2 wrote When you report a problem, you should copy-and-paste the output that you got and also state the output that you expected. I have no idea what you mean when you say "subprocess.Popen seems not accept to run "qsub" over a

Re: Enchancement suggestion for argparse: intuit type from default

2012-03-15 Thread Robert Kern
es. Not all type(default) types can be called with a string to produce a valid value. Note that "type=" is really a misnomer. argparse doesn't really want a type object there; it wants a converter function that takes a string to an object. -- Robert Kern "I have come to beli

Re: Python is readable

2012-03-15 Thread Robert Kern
of Python's indentation-based ancestors, ABC. Those studies found, empirically, that having the colons helped people read and understand the code faster. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad atte

Re: Python is readable

2012-03-15 Thread Robert Kern
's an unintended side effect. The (automated) syntax highlighting was added to the FAQ much, much later than that entry was written. The syntax highlighting tool does not recognize the first example as Python, so it does not apply Python syntax highlighting to it. -- Robert Kern "I have come

Re: Why not use juxtaposition to indicate function application

2012-03-16 Thread Robert Kern
al language. We just don't do partial function application all that frequently to make it a language feature. Leaving out an argument is a common enough mistake, though, and using curry-by-default would postpone the error and make for even more inscrutable error messages. -- Robert K

Re: avoid import short-circuiting

2012-03-16 Thread Robert Kern
ion myself, but that should not be too hard.. You want to monkeypatch __builtin__.__import__() instead. It always gets called. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as th

Re: avoid import short-circuiting

2012-03-16 Thread Robert Kern
On 3/16/12 10:04 PM, Andrea Crotti wrote: On 03/16/2012 05:19 PM, Robert Kern wrote: On 3/16/12 4:49 PM, Andrea Crotti wrote: I started the following small project: https://github.com/AndreaCrotti/import-tree because I would like to find out what exactly depends on what at run-time, using an

Re: avoid import short-circuiting

2012-03-16 Thread Robert Kern
.orig(). By the way, you really should follow my example of getting the .__name__ from the module object instead of the argument in order to properly account for relative imports inside packages. __import__() will be passed the relative name, not the fully-qualified name. -- Robert Kern "I ha

Re: Python is readable

2012-03-19 Thread Robert Kern
to accord (descriptively) with the uses the "look good" and "look bad" to me: don't use a colon to separate a transitive verb from its objects. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our o

Re: Distribution

2012-03-20 Thread Robert Kern
on, and it doesn't match the rest of your use case. So what do you mean by “distribution”? Maybe we can find a less confusing term. Judging from the context, he means a probability distribution. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma t

Re: Distribution

2012-03-20 Thread Robert Kern
hts))] kind_max = kind_cumsum[-1] max_time = 10.0 # sec t = 0.0 # sec events = [] # (t, kind) while t < max_time: dt = prng.expovariate(avg_rate) u = prng.uniform(0.0, kind_max) kind = bisect.bisect_left(kind_cumsum, u) events.append((t, kind)) t += dt -- Robert Kern "

Re: random number

2012-03-26 Thread Robert Kern
of the set of its digits? I would consider that to be a very odd interpretation of that request. But it *is* an extraordinarily vague request. I'm not sure if even the OP knows what he wants. I suspect he really wants something like a hash. -- Robert Kern "I have come to believe that th

Re: random number

2012-03-26 Thread Robert Kern
nd(characters[0]) ... return ''.join(coll_rand) ... >>> id = 5 >>> print (random_number(id)) puMHCr >>> -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our ow

Re: Is there any difference between print 3 and print '3' in Python ?

2012-03-26 Thread Robert Kern
ou can see, the only difference is in the first instruction. Both of these put the object that you specified by the literal onto the stack. The difference is that one is the int object specified by the literal 3 and the other is the str object specified by the literal "3". Both of these ob

Re: Puzzled by FiPy's use of "=="

2012-03-26 Thread Robert Kern
py/browser/trunk/fipy/terms/term.py#L374 -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about collections.defaultdict

2012-03-26 Thread Robert Kern
s.defaultdict.__missing__ -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about collections.defaultdict

2012-03-26 Thread Robert Kern
On 3/26/12 4:33 PM, Steven W. Orr wrote: On 3/26/2012 9:44 AM, Robert Kern wrote: On 3/26/12 2:33 PM, Steven W. Orr wrote: I created a new class called CaseInsensitiveDict (by stealing from code I found on the web, thank you very much). The new class inherits from dict. It makes it so that if

Re: Threads on google groups not on gmane?

2012-04-02 Thread Robert Kern
kit for Easy GUIs in Python" and "weird behaviour: pygame plays in shell but not in script". Is anyone else seeing the same thing? I also don't see these on GMane. It's possible that they are getting caught in one of GMane's several levels of spam filtering. http:

Re: Python Gotcha's?

2012-04-05 Thread Robert Kern
I'm not sure it deserves to be called a wart. The wart is not that it fails, but that it does not fail atomically. The list inside the tuple gets modified even though an exception is raised for the statement as a whole. -- Robert Kern "I have come to believe that the whole world is

Re: why () is () and [] is [] work in other way?

2012-04-20 Thread Robert Kern
ct 4 2011, 20:03:08) [GCC 4.6.1] ) Is this what it should be or maybe yielding unified result is better? If your code is relying on the difference, or a lack of one, it's buggy. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made

  1   2   3   4   5   6   7   8   9   10   >