Re: Will MySQL ever be supported for Python 3.x?

2012-04-02 Thread Jason
't handle MySQL's zeroed dates, but the latest release seems to be patched now (applied a year after the bug was reported with a small patch to fix it). -- Jason -- http://mail.python.org/mailman/listinfo/python-list

specify end of line character for readline

2012-05-14 Thread Jason
Is there any way to specify the end of line character to use in file.readline() ? I would like to use '\r\n' as the end of line and allow either \r or \n by itself within the line. Thanks, Jason -- http://mail.python.org/mailman/listinfo/python-list

multiprocessing shows no benefit

2017-10-17 Thread Jason
I've got problem that I thought would scale well across cores. def f(t): return t[0]-d[ t[1] ] d= {k: np.array(k) for k in entries_16k } e = np.array() pool.map(f, [(e, k) for k in d] At the heart of it is a list of ~16k numpy arrays (32 3D points) which are stored in a single dict. Using

Re: multiprocessing shows no benefit

2017-10-18 Thread Jason
I've read the docs several times, but I still have questions. I've even used multiprocessing before, but not map() from it. I am not sure if map() will let me use a common object (via a manager) and if so, how to set that up. -- https://mail.python.org/mailman/listinfo/python-list

Re: multiprocessing shows no benefit

2017-10-18 Thread Jason
#When I change line19 to True to use the multiprocessing stuff it all slows down. from multiprocessing import Process, Manager, Pool, cpu_count from timeit import default_timer as timer def f(a,b): return dict_words[a]-b def f_unpack(args): return f(*args) def init():

Re: multiprocessing shows no benefit

2017-10-18 Thread Jason
On Wednesday, October 18, 2017 at 12:14:30 PM UTC-4, Ian wrote: > On Wed, Oct 18, 2017 at 9:46 AM, Jason wrote: > > #When I change line19 to True to use the multiprocessing stuff it all slows > > down. > > > > from multiprocessing import Process, Manager, Pool, cpu_c

Re: multiprocessing shows no benefit

2017-10-18 Thread Jason
I refactored the map call to break dict_keys into cpu_count() chunks, (so each f() call gets to run continuously over n/cpu_count() items) virtually the same results. pool map is much slower (4x) than regular map, and I don't know why. -- https://mail.python.org/mailman/listinfo/python-list

Re: multiprocessing shows no benefit

2017-10-20 Thread Jason
Yes, it is a simplification and I am using numpy at lower layers. You correctly observe that it's a simple operation, but it's not a shift it's actually multidimensional vector algebra in numpy. So the - is more conceptual and takes the place of hundreds of subtractions. But the example dies dem

General Purpose Pipeline library?

2017-11-20 Thread Jason
a pipeline can be described as a sequence of functions that are applied to an input with each subsequent function getting the output of the preceding function: out = f6(f5(f4(f3(f2(f1(in)) However this isn't very readable and does not support conditionals. Tensorflow has tensor-focused pip

Re: General Purpose Pipeline library? (Posting On Python-List Prohibited)

2017-11-21 Thread Jason
On Monday, November 20, 2017 at 4:02:31 PM UTC-5, Lawrence D’Oliveiro wrote: > On Tuesday, November 21, 2017 at 4:49:01 AM UTC+13, Jason wrote: > > a pipeline can be described as a sequence of functions that are > > applied to an input with each subsequent function getting the ou

Re: General Purpose Pipeline library?

2017-11-21 Thread Jason
On Monday, November 20, 2017 at 10:49:01 AM UTC-5, Jason wrote: > a pipeline can be described as a sequence of functions that are applied to an > input with each subsequent function getting the output of the preceding > function: > > out = f6(f5(f4(f3(f2(f1(in)) > > Ho

Re: Please tell me how to execute python file in Ubuntu by double clicking on file.

2017-12-05 Thread Jason
On Monday, December 4, 2017 at 4:49:11 AM UTC-5, dhananjays...@gmail.com wrote: > Respected Sir/Mam, > I am Dhananjay Singh,Student of IIIT Manipur. Sir/Mam when i am > double click in python program (Dhananjay.py),it is opening in Text Editor by > Default in Ubuntu.I want to run this pro

csv.DictReader line skipping should be considered a bug?

2017-12-05 Thread Jason
I ran into this: https://stackoverflow.com/questions/27707581/why-does-csv-dictreader-skip-empty-lines # unlike the basic reader, we prefer not to return blanks, # because we will typically wind up with a dict full of None # values while iterating over two files, which are line-by-line correspond

Where did csv.parser() go?

2018-01-02 Thread jason
I need record the starting offsets of csv rows in a database for fast seeking later. Unfortunately, using any csv.reader() (or DictReader) tries to cache, which means: example_Data = "'data 0123456789ABCDE 1123456789ABCDE 2123456789ABCDE 3123456789ABCDE ... ''' for line in reader: offsets[r

Re: Numpy and Terabyte data

2018-01-02 Thread jason
I'm not sure if I'll be laughed at, but a statistical sampling of a randomized sample should resemble the whole. If you need min/max then min ( min(each node) ) If you need average then you need sum( sum(each node)) sum(count(each node))* *You'll likely need to use log here, as you'll probably o

Re: Where did csv.parser() go?

2018-01-02 Thread jason
Wow, awesome!!! Thank you! -- https://mail.python.org/mailman/listinfo/python-list

Defer, ensure library is loaded

2018-02-13 Thread Jason
I have a variety of scripts that import some large libraries, and rather than create a million little scripts with specific imports, I'd like to so something like psycopg2 = ensure_imported (psycopg2) This way, regardless of invocation I can know psycopg2 is loaded, if it hasn't already been l

Getting the exit code of a subprocess

2021-12-15 Thread Jason
tried something like this: e_stat = p.communicate(input=msg) but the value of e_stat is always '(None, None)' -- Thanks & best regards, Jason Rissler -- https://mail.python.org/mailman/listinfo/python-list

Re: Getting the exit code of a subprocess

2021-12-15 Thread Jason
On Wed, Dec 15, 2021 at 08:19:16PM -0800, Kushal Kumaran wrote: > On Wed, Dec 15 2021 at 09:38:48 PM, Jason wrote: > > Hello, > > > > How can I find out the exit code of a process when using the > > subprocess module? I am passing an email message to a shell script and

Struggling with basics

2005-09-25 Thread Jason
A week ago I posted a simple little hi-score routine that I was using to learn Python. I've only just managed to examine the code, and the responses that people gave, and I'm now seriously struggling to understand why things aren't working correctly. At present my code is as follows... import

Re: Struggling with basics

2005-09-25 Thread Jason
Rather than reply to those individuals, just a big "thanks" to those that have helped. It's definitely making sense, the fact that I need to show the two-element tuple to show correctly was one of those head-slapping moments. And Dennis Lee Bieber hit the nail on the head when he mentioned that

Re: Struggling with basics

2005-09-25 Thread Jason
Reinhold Birkenfeld wrote: > Jason wrote: >> Rather than reply to those individuals, just a big "thanks" to those >> that have helped. >> >> It's definitely making sense, the fact that I need to show the >> two-element tuple to show correctly w

Re: Struggling with basics

2005-09-25 Thread Jason
Tom, best explanation yet! Entertaining as well as educational. The "%05i" trick is very neat, must remember that one! Everything working a charm apart from the viewScores is still returning the results from the lowest score (at the top) to the highest score. What I'd like to know is do you th

Re: Struggling with basics

2005-09-25 Thread Jason
George Sakkis wrote: > "Jason" <[EMAIL PROTECTED]> wrote: > >> What I'd like to know is do you think it would be better to sort the >> list in memory, or print it out sorted? If the latter, then naturally >> I'd need to change the showScores se

Plotting points to screen

2005-09-26 Thread Jason
If I'm wanting to plot points to the screen (nothing fancy at all for the moment), would you recommend PyGame, PyOpenGL or PIL? Like I said, it's nothing complicated, no flashing wotsits or 3d quad-linear vertexes with bi-linear real-time shading, just simple 'points' a few lines or circles and

Re: Plotting points to screen

2005-09-26 Thread Jason
jay graves wrote: > I've used both pygame and PIL for this in the past. (i'm plotting a > non-standard 3d data format from a in-house app) > Pygame was nice because I put a key handler in to reload the file and > do a little zooming/panning and when I wanted to save a particular plot > I would jus

Distributing programs

2005-10-02 Thread Jason
A non-python programming friend of mine has said that any programs made with Python must be distributed with, or an alternative link, to the source of the program. Is this true? -- http://mail.python.org/mailman/listinfo/python-list

wxPython date

2005-07-18 Thread Jason
8) thanks, jason -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython date

2005-07-18 Thread Jason
Thanks, Peter. I must have been having a bit of the stupids, your example worked fine for me too. Back to the salt mines! -- http://mail.python.org/mailman/listinfo/python-list

Python CGI and Firefox vs IE

2005-09-07 Thread Jason
et in field['display']: [MiniFieldStorage('display', 'All Servers'), MiniFieldStorage('display', 'WKPEA1'), MiniFieldStorage('display', 'WKNHA2')] I see what's happening, but I'm at a loss to figure out what to do about it. Any help would be appreciated. thanks, jason -- http://mail.python.org/mailman/listinfo/python-list

Re: Python CGI and Firefox vs IE

2005-09-07 Thread Jason
IE... Have to come up with a workaround, go back to the old . I'm about the only one who uses firefox in our facility. Thanks for the reply and the link. -- http://mail.python.org/mailman/listinfo/python-list

Can someone explain what I've done wrong...

2005-09-17 Thread Jason
"I am on the only person here." else: print "We have %d persons here." % Person.population Jason=Person("Jason") Jason.sayHi() Jason.howMany() Sophie=Person("Sophie") Sophie.sayHi() Sophie.howMany() Jason.sayHi() The code, when run, should produce

Re: Can someone explain what I've done wrong...

2005-09-17 Thread Jason
Thanks for the explanation JP Calderone. Have to say, I was confused with the post (I received via email, can't see it on the newsgroup yet) from Astan Chee saying he couldn't understand how the Person class was destroyed. I'm still new(ish) with Python but I was lead to believe the __del__ ca

How am I doing?

2005-09-18 Thread Jason
Please don't laugh, this is my FIRST Python script where I haven't looked at the manual for help... import string import random class hiScores: hiScores=['1Alpha','07500Beta','05000Gamma','02500Delta','0Epsilon'] def showScores(self): for entry in self.hiScores:

Re: How am I doing?

2005-09-18 Thread Jason
George Sakkis wrote: > "Jason" <[EMAIL PROTECTED]> wrote: > >> Please don't laugh, this is my FIRST Python script where I haven't >> looked at the manual for help... > > Sooner or later you should ;) > >> import string >

Re: How am I doing?

2005-09-19 Thread Jason
I've restructured my code with the assistance of George and Mike which is now as follows... import random class HiScores: def __init__(self,hiScores): self.hiScores=[(entry[:5],entry[5:]) for entry in hiScores] def showScores(self): for name,score in self.hiScores:

Re: How am I doing?

2005-09-20 Thread Jason
Tom Anderson wrote: > On Mon, 19 Sep 2005, Brett Hoerner wrote: > >> Wouldn't the standard idiom be to actually put the code under the >> if-name, and not make a whole new main() function? > > Yes. > > The nice thing about the main() function, though, is that you can do the > most basic argume

Calling a derived class's constructor from a parent method

2015-01-14 Thread jason
If I have a class hierarchy like so: class A(object): def __init__(self, s): self.s = s def foo(self, s): return A(s) class B(A): def __init__(self, s): A.__init__(self, s) If I make a B: b = B(0) I'd like b.foo(1) to return an instance o

Re: Calling a derived class's constructor from a parent method

2015-01-14 Thread jason
On Wednesday, January 14, 2015 at 12:05:55 PM UTC-5, Mark Lawrence wrote: > I'm confused, can you please explain what you're trying to achieve > rather than how you're trying to achieve it and I'm sure that others > will give better answers than I can :) > Good call. Coming up with a minimal

Re: do people really complain about significant whitespace?

2006-08-07 Thread Jason
infidel wrote: > Where are they-who-hate-us-for-our-whitespace? Are "they" really that > stupid/petty? Are "they" really out there at all? "They" almost sound > like a mythical caste of tasteless heathens that "we" have invented. > It just sounds like so much trivial nitpickery that it's hard to

Re: do people really complain about significant whitespace?

2006-08-07 Thread Jason
[EMAIL PROTECTED] wrote: > Jason wrote: > > He points out that if some code gets accidentally dedented, it is > > difficult for another programmer to determine which lines were supposed > > to be in the indented block. I pointed out that if someone > > accidentally mo

Re: newb question: file searching

2006-08-08 Thread Jason
[EMAIL PROTECTED] wrote: > Mike Kent wrote: > > What you want is os.walk(). > > > > http://www.python.org/doc/current/lib/os-file-dir.html > > I'm thinking os.walk() could definitely be a big part of my solution, > but I need a little for info. If I'm reading this correctly, os.walk() > just goes

Re: New to Python-- Help

2006-08-08 Thread Jason
John & Mary Cook wrote: > I just installed Python on Windows XP Pro. When I enter 'python' at the >>> > prompt in Pythonwin IDE I get the following: > > Traceback (most recent call last): >File "", line 1, in ? > Name Error: name 'python' is not defined > > Can anyone help? > > Thank you, > >

Re: [OT] John Salerno

2006-08-12 Thread jason
John Salerno wrote: > Alan Connor wrote: > >> Almost certainly bogus. I wouldn't believe anything in this >> fellow's headers or articles. >> >> TROLL. >> I don't help trolls. > > > Ok, I don't know how seriously to take this post, so I won't spend much > time addressing it. All I will say is y

Re: [OT] John Salerno

2006-08-13 Thread jason
Alan Connor wrote: > Looks like pretty much all trolls to me. > > Note: I won't be downloading any articles on this thread. > > Alan > Funny how you keep saying that but keep downloading and responding. -- http://mail.python.org/mailman/listinfo/python-list

Re: trouble understanding inheritance...

2006-08-17 Thread Jason
e: good, hopefully useful >>> >>> CheckAllStrings(stringValue) Is a string: Hello, world! >>> CheckAllStrings(unicodeValue) Is a string: These are different strings >>> CheckAllStrings(myStringValue) Is a string: good, hopefully useful >>> CheckAllStrings(42) Not a string: 42 >>> How do you know when you should use type() checks, when you should use isinstance(), and when you should just try to use the data? That depends, and there have been many lively debates on this subject in the newsgroup. I recommend that you should only use as much type checking as needed, and the less is better. A bit long, but I hope this helps you out. --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: Python wrapper for C++ core

2006-10-17 Thread Jason
can give you is flexibility. Whether or not this is useful for you depends entirely on the goals of your program, and the design of your program. I'm sure there are other things Python can do for you, but you'll need to figure them out (or post more information about your program). --Jason -- http://mail.python.org/mailman/listinfo/python-list

Accessing ClarifyCRM with Python

2006-10-27 Thread Jason
now how much work it will be. Any pointers would be greatly appreciated. --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: create global variables?

2006-10-30 Thread Jason
e are many cases where they will "obviously" work far better than ugly procedural-level hacks. (By obviously, I mean that it will be pretty easy to understand exactly what you did later on.) Python's website has a tutorial section (http://www.python.org/doc/Intros.html) and many people recommend the "Dive Into Python" tutorial series (http://www.diveintopython.org/). Do a google search for "Python tutorials" for more information. --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: Singleton Class Exception

2006-11-13 Thread Jason
of those, so I cannot tell you how they differ.) Still, if you're dead set on a Singleton class, I'll post one in a little bit. --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: Singleton Class Exception

2006-11-13 Thread Jason
I threw together two different singleton classes. They both ensure that the initializers and destructors can be called at most once. (The ImmortalSingleton won't ever have its destructor called unless the programmer manually forces things.) I haven't extensively tested these things, so handle th

Re: what are you using python language for?

2006-06-07 Thread Jason
I've been working on an RPG character generator for consistent (yet varied) set of role-playing systems. Nothing like a pen-and-pencil RPG to throw in tons of special cases and strange rulesets. Python's turned out to be very useful for this project: 1. Fast prototyping and testing. I'm not sta

Re: Python with Eclipse

2006-06-20 Thread Jason
into, step over, step return, continue, and others. One of the buttons there looks like a couple of "X" symbols. This button officially shuts down a python interpreter. (Be careful and don't actually click the "X" symbol that closes the debug area!) --Jason Stan Co

Re: error with string (beginner)

2006-06-25 Thread Jason
I believe what you are trying to do is something like the following. [code] def isIntLike(x): try:int(x) except: return False else: return True something = raw_input("Enter something and I will tell you the type: ") if isIntLike(something):print "I am an int

Re: function that modifies a string

2006-07-09 Thread Jason
r string. In the following example, s gets rebound to the new string while t keeps the original string value: >>> def changeString(varName): ... globalDict = globals() ... globalDict[varName] = '||' + globalDict[varName] + '>>' ... return ... >>> s = 'Char' >>> t = s >>> changeString('s') >>> s '||Char>>' >>> t 'Char' Further note that this only affects variables in the global scope. I hope this helps! --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: function that modifies a string

2006-07-10 Thread Jason
Simon Forman wrote: > greenflame wrote: > > Jason wrote: > > > > > > There /are/ a few hacks which will do what you want. However, if you > > > really need it, then you probably need to rethink your program design. > > > Remember, you can't

Re: Accessors in Python (getters and setters)

2006-07-10 Thread Jason
setters in C++/Java before you feel like shooting your source code. Please don't bring this code-rage into Python. To refactor a name in your code, take a look at Bicycle Repair Man [http://bicyclerepair.sourceforge.net/]. It integrates into Eclipse via PyDev, and allows you to refactor variable names, class names, and method names fairly easily. Good luck! --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: refering to base classes

2006-08-29 Thread Jason
that the creature class's __init__ sets self.noise to the empty string. In this case, the superclass's __init__() method should be called first: class dog(creature): def __init__(self): creature.__init__(self) self.noise = "bark" def voice(self): print "brace your self:" creature.voice(self) --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: How to run Python file?

2006-09-02 Thread Jason
d your program will run in it. Once the Python program is done running, the command window will probably close immediately. --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: data structure

2006-09-03 Thread Jason
#x27; > and 'factory2' point to the same object. i would like to have 2 > different objects of FACTORY. making FACTORY a template and not an > object. > > i'll appreciate any comment > amit You can make a shallow copy of a dictionary using the dictionary's copy method. To make a completely new copy, use the deepcopy function in the copy module. Please see the copy module's documentation on the limits and differences between deep copies and shallow copies. (http://docs.python.org/lib/module-copy.html) --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: Python newbie with a problem writing files

2006-09-04 Thread Jason
yfile.write = "Gonna replace write method with this string!" >>> myfile.write 'Gonna replace write method with this string!' >>> Of course, you can no longer easily access the original write method after re-assigning it like that. (limodou, I thought this might need a little bit of extra explanation for the original poster. I apologize if I seem rude here.) --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: python vs java

2006-09-06 Thread Jason
on demo provides lots of neat interactive examples. --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: How to build extensions on Windows?

2006-09-07 Thread Jason
olkit is deprecated. While you must register each Visual Studio Express module that you download, I don't think the actual command-line tools are encumbered. Why not try it out and let us know how it goes? (Visual Studio 2005 Express: http://msdn.microsoft.com/vstudio/express/) --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: python vs java

2006-09-07 Thread Jason
y. And this point should be emphasized for any cross-platform language, especially for folk who may not have done such development before. The "write once, run everywhere" phrase does have a footnote. Python's documentation is very good at pointing out what is platform independent a

Re: Method resolution for super(Class, obj).

2006-09-07 Thread Jason
d2 = D2() >>> d2.met() D2.met B2.met You don't need super() to call a superclass method. It can help with complex class heirarchies, but most single-descendent class structures don't need it. Either way, when designing a class heirarchy, you should either always use super() or never use super(). Mixing non-super-using and super-using can give you problems. (Rhetorical Q: Does this make me more or less super?) --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: super and __init__

2006-09-08 Thread Jason
times in that case. I do wish there was a way to kinda combine the two methods: Explicitly call the super-classes, but do so that each super-method can get called one or no times. Unfortunately, I haven't (yet) found a way to do so that can resolve things right. That's not to say that there isn't a better way. I'm sure that the Python developers had a devil of a time working on this thing. --Jason -- http://mail.python.org/mailman/listinfo/python-list

newbie: datastructure `dictionary' question

2006-09-09 Thread jason
an static example of the datastructure that I am using to clear any confusion on the datastructure part: records = { 'fam/jason-a' : { 'date': 'Fri Sep 8 16:45:55 2006', 'from': 'jason', &#

Re: newbie: datastructure `dictionary' question

2006-09-09 Thread jason
On Sat, 09 Sep 2006 09:00:35 -0700, John Machin wrote: > jason wrote: >> Hello, >> >> I am completely new to python and I have question that I unfortunately >> could not find in the various documentation online. My best guess is >> that the answer should be quitt

Re: Running python from a usb drive

2006-09-11 Thread Jason
a single percentage sign. So you'd want "%%1". --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: Running python from a usb drive

2006-09-13 Thread Jason
hich restores the associations. These associations are also stored in the registry. You could back up the registry keys which you know will be modified, make the registry changes yourself, and restore the registry settings at finish. It would require Python's win32 extension modules, though.

Re: how are dictionary literals handled by the interpreter?

2006-09-13 Thread Jason
18 LOAD_ATTR1 (get) 21 LOAD_FAST0 (a) 24 CALL_FUNCTION1 27 LOAD_CONST 0 (None) 30 DUP_TOP 31 EXEC_STMT 3 32 LOAD_NAME3 (retval) 35 RETURN_VALUE >>> dis.dis(caseFunction.doIt) 3 0 LOAD_FAST0 (self) 3 LOAD_ATTR1 (caseDict) 6 LOAD_ATTR2 (get) 9 LOAD_FAST1 (a) 12 CALL_FUNCTION1 15 LOAD_CONST 0 (None) 18 DUP_TOP 19 EXEC_STMT 4 20 LOAD_NAME4 (retval) 23 RETURN_VALUE >>> Take a look at what happens before the 'get' attribute is loaded in each case. In case 3, you've simply created a dictionary literal, which is a very fast operation under Python. In case 4, you've created a dictionary literal, then you call the dict() function. The dict function will create a dictionary from the supplied dictionary, and return the shallow copy. Case 3 is slower, but the Python developers have worked to make dictionary creation and look-up very fast. Did you use the timeit module to test your functions? --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: Are Python's reserved words reserved in places they dont need tobe?

2006-09-14 Thread Jason
o indicate purpose of your python programs! So, your identifiers must be between and tags. You strings will have to sit inside of a CDATA section to work right, and you get all sorts of entity substitutions for free! "My program doesn't work anymore." "Are your function names between h3 tags?" (Secretly repulsed, yet fascinated) --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: add without carry

2006-09-15 Thread Jason
maxBound: ... value -= maxBound ... return value ... >>> bound(5 + 6, 10) 1 >>> bound(8 + 7, 10) 5 See? I'm definitely not Dutch. --Jason -- http://mail.python.org/mailman/listinfo/python-list

Builder Pattern

2006-01-28 Thread Jason
amp;rnum=25#200adefeefa5f3fa Unfortunately I can't read the discussion it's possibly in Spanish. Does anyone know of a builder example for python? Thanking you in advance for your help. Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: Builder Pattern

2006-02-02 Thread Jason
I have converted another example of strategy which I prefer to the 2 described earlier, here it is: class FindMinima: def algorithm(self):raise NotImplementedError class LeastSquares (FindMinima): def algorithm(self,line): return (1.1,2.2) class NewtonsMethod (F

NumPy error

2006-02-05 Thread jason
Hello: I am using the following versions of Python and packages on Windows XP (SP2): Python 2.4.2 NumPy 0.9.4.win32-py2.4 SciPy 0.4.4 for Python 2.4 and Pentium 4/SSE2 In the Python Shell I am running the following: >>> from scipy.optimize import fmin >>> def rosen(x): return su

Re: NumPy error

2006-02-05 Thread jason
again. "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > jason wrote: > >> Hello: >> >> I am using the following versions of Python and packages on Windows XP >> (SP2): >> >> Python 2.4.2 >> NumPy 0.9.4.win32

RPy / R

2006-02-06 Thread jason
Hello: I installed the following: python-2.4.2.msi pywin32-207.win32-py2.4.exe R-2.2.1-win32.exe rpy-0.4.6-R-2.0.0-to-2.2.1-py24.win32.exe on a Windows XP (SP2) box. When I try to run the following (source: http://rpy.sourceforge.net/plotting-with-RPy.html) in IDLE >>> from rpy import * >>> x

Re: RPy / R

2006-02-08 Thread jason
e not installed Numeric. Is that different from NumPy? If so, which version do you have? Thanks. "Eddie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi Jason > > I had more success, being able to run a few test programs. > Not sure why yours would be

Re: Help a C++ escapee!

2007-06-07 Thread Jason
= 5 * x ... import math # Math won't be imported until this function is called ... return math.pow(x, 2) ... >>> spam(1) # This should import the math module, executing its contents import math # builtin 25.0 >>> spam(2) # spam() will now use the previously import math module. (This is >>> fast) 100.0 Hope this helps! --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: The best platform and editor for Python

2007-07-05 Thread Jason
um amount of working code that causes or demonstrates the problem. You may get twenty different answers sometimes (like for your question here), but that's twenty answers or perspectives that you may not have known before you asked. --Jason [1] http://www.diveintopython.org/ [2]

Re: Copy List

2007-07-19 Thread Jason
nd so forth, so the lists guaranteed to be truly disconnected: >>> from copy import deepcopy >>> originalList = [1, [2, [3, 4]]] >>> fullCopy = deepcopy(originalList) >>> originalList[1][1].append(100) >>> print originalList, '\n', fullCopy [1, [2, [3, 4, 100]]] [1, [2, [3, 4]]] >>> --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: preferred windows text editor?

2007-05-09 Thread Jason
On May 9, 12:06 pm, "T. Crane" <[EMAIL PROTECTED]> wrote: > Right now I'm using Notepad++. What are other people using? > > trevis IDLE for short scripts, PyDev under Eclipse for big Python projects, and the Python shell for basic one-offs. --Jason -- http://ma

Re: Inheritance problem

2007-05-09 Thread Jason
elf, name): ... SayHi.__init__(self, name) # Call the superclass's init ... def Talk(self): ... print "Hello,", self.name ... >>> moreTalk = SayHello("World") >>> moreTalk.Talk() Hello, World Basically, you need to: 1. Assign your lists in setList to "self.a" instead of the local variable "a". 2. Pass the object to the superclass method in setList ("shortList.setList(self)") There are other things that may be improved with your design. Keep plugging at it! --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: File writing success

2007-05-11 Thread Jason
On May 11, 12:21 pm, HMS Surprise <[EMAIL PROTECTED]> wrote: > If file writing has no return value (http://docs.python.org/lib/bltin- > file-objects.html), how do you know if the write was successful? > Should one assume that if the open was successful then write are also? > > Thanks, > > jvh In P

Re: Anyone else has seen "forrtl: error (200) ..."

2007-05-30 Thread Jason
be little that you can do, especially if you don't have the Fortran source code in question and/or can't recompile it. Maybe someone with some Fortran/Python experience can assist you. --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: decorators tutorials

2007-07-23 Thread Jason
verywhere, we can simply assign the wrapped function object to the DivXY name. Instead of: DebugDivXY = WrapWithHelpDebug(DivXY) We use: DivXY = WrapWithHelpDebug(DivXY) Now, all calls to DivXY call the HelpDebug object that uses our original DivXY function! This is *exactly* what a decorator does. Inste

Re: decorators tutorials

2007-07-23 Thread Jason
On Jul 23, 11:25 am, Jason <[EMAIL PROTECTED]> wrote: > On Jul 23, 2:13 am, james_027 <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I am learning python by learning django, and I stumble upon decorator > > which is very cool, any beginners resources for python d

Re: Closures / Blocks in Python

2007-07-24 Thread Jason
a name: not name.startswith('J'), nameList) # Filter with lambda # Explicit for-loop newListOfNames = [] for name in nameList: if not name.startswith('J'): newListOfNames.append(name) Take a look at "http://ivan.truemesh.com/archives/000392.html"; for a

Re: wxPython - How to add sorting to a ListCtrl?

2007-07-24 Thread Jason
forums. Still, take a look at the wxPython demo [1]. Under the "Core Windows/ Controls" category, the ListCtrl demo does exactly what you describe. They have code and comments built into the demo itself. [1] http://www.wxpython.org/download.php --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: 'Advanced' list comprehension? query

2007-08-08 Thread Jason
s! Here's how I would do it: >>> noShowList ['one', 'two', 'four'] >>> myList ['item one', 'item two', 'item three', 'item four', 'item five'] >>> [x for x in myList if not any(y in x for y in noShowList)] ['item three', 'item five'] >>> --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: tests

2007-08-09 Thread Jason
he results of os.stat are used to compare the two files, so if they have the same size, change times, etc, they're considered the same. If the shallow flag is given and is false, their contents are compared. In either case, the results are cached for efficiency's sake. --Jason The

Re: Icons for GUI development

2007-08-14 Thread Jason
suggestions? Try out the Silk icon set, too. http://www.famfamfam.com/lab/icons/silk/ --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: How to setup pyOpenGL3.0.a6 for window xp?

2007-08-19 Thread Jason
et in the "wx.glcanvas" module. The widget only requires PyOpenGL. The wxPython Demo shows how to set up and program the widget quite easily. Another example is at: "http:// aspn.activestate.com/ASPN/Cookbook/Python/Recipe/325392". Unfortunately, I don't have much e

Re: I Need help from all the group participants

2007-08-20 Thread Jason
se, and can have many ambiguities that can only be resolved through knowledge of the subjects and verbs involved. Good luck on your project. Just remember: Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo [2]. [1] The NLTK website is at "http://nltk.sourceforge.net/index.php/ Main_Page" [2] That's actually valid English. See "http://en.wikipedia.org/wiki/ Buffalo_buffalo_Buffalo_buffalo_buffalo_buffalo_Buffalo_buffalo" --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: Check for dict key existence, and modify it in one step.

2007-08-28 Thread Jason
e collections module [1]. (This class is trivial to implement in prior versions of Python, too.) >>> from collections import defaultdict >>> myDict = defaultdict(lambda: 1) >>> myDict['spam'] = 5 >>> myDict['spam'] += 10 >>> m

Re: list index()

2007-09-03 Thread Jason
is that the return value is always a guaranteed good index into the list. Any errors (including calling .index() on a non-list instance that doesn't have a .index method) are exceptional, and should probably follow a very different code path. Returning -1 is not a good return value to indic

Re: Python syntax wart

2007-09-10 Thread Jason
1, ... 2, ... 3 ... )\ ... : ... print\ ... "This is "\ ... "poorly "\ ... "formatted!",\ ... l ... This is poorly formatted! 1 This is poorly formatted! 2 This is poorly formatted! 3 >>> Looks like it runs to me. In general, I'd recommend that you avoid such nonsense spacing and alignment, and use wrappers, generators, and other Python constructs to help write more sensible code. --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: why brackets & commas in func calls can't be ommited? (maybe it could be PEP?)

2007-03-21 Thread Jason
ity to consider: result = func1 Is the name "result" bound to the function func1? Or is func1 called, and its result is bound to the name "result"? Good luck with your PEP. --Jason -- http://mail.python.org/mailman/listinfo/python-list

Re: yield, curry, mix-in, new.function, global, closure, .... what will work?

2007-04-16 Thread Jason
ython documentation with some casual browsing, but one can be implemented from the existing thread locking mechanisms. Your description of what you want to do is rather vague, so I can't get too specific. You've described how you want to do things, but I don't know what you're trying to accomplish. Where possible, simplify your design. --Jason -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   7   8   9   10   >