Re: Killing a thread
Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > > >> it cannot be done in a portable way, so that's not very likely. > > > def __run(self): > > """Hacked run function, which installs the trace.""" > > sys.settrace(self.globaltrace) > > self.__run_backup() > > self.run = self.__run_backup > > I'm not sure using a non-portable API to run the code under a "custom > debugger" qualifies as a "portable implementation", though... Everything used is a part of the standard library, which is portable, AFAICT. Could you say specifically what is non-portable? > have you benchmarked this, btw? It has some overhead, but it should only be used in situations where one line will either return before the timeout or take far too long. E. g. an eval() statement with code generated from user input should return quickly for reasonable entries, but something like "9**9**9" will trigger the timeout. > -- http://mail.python.org/mailman/listinfo/python-list
Re: how to match u'\uff00' - u'\uff0f' in re module?
yichao.zhang wrote: > I'm trying to match the characters from u'\uff00' to u'\uff0f'. > the code below and get a TypeError. > p = re.compile(u'\uff00'-u'\uff0f') > Traceback (most recent call last): > File "", line 1, in ? > TypeError: unsupported operand type(s) for -: 'unicode' and 'unicode' > > > so re module does NOT support this operation > however, is there any alternative way to solve my problem? > > Any comments/suggestions much appreciated! re DOES work with unicode, you're just subtracting two unicode stings as the agrument, which is not defined. Try this: p = re.compile(u'[\uff00-\uff0f]') -- http://mail.python.org/mailman/listinfo/python-list
Re: Confusion over calling a nested function inside a parent function
Pyenos wrote: > [code] > class WORK: > def getwork(self): > def choosetable(self):pass > choosetable() #TypeError: choosetable() takes exactly 1 > #argument (0 given) > [/code] > > Calling choosetable() at the above location gives me the error > described above. Although choosetable is a memeber of an instance method, it is not one itself. It should not have self as it's first formal parameter. -- http://mail.python.org/mailman/listinfo/python-list
Re: How do you refer to an iterator in docs?
On Thursday, April 19, 2012 5:21:20 AM UTC-7, Roy Smith wrote: > Let's say I have a function which takes a list of words. I might write > the docstring for it something like: > > def foo(words): >"Foo-ify words (which must be a list)" > > What if I want words to be the more general case of something you can > iterate over? How do people talk about that in docstrings? Do you say > "something which can be iterated over to yield words", "an iterable over > words", or what? > > I can think of lots of ways to describe the concept, but most of them > seem rather verbose and awkward compared to "a list of words", "a > dictionary whose keys are words", etc. When I talk about an iterable, I say "iterable". Based on my recent readings of the style guide PEPs I would write something like: """Foo-ify some words. Arguments: words -- an iterable of words """ Just remember that types don't matter (until you get down to the C, really), just the methods associated with an object. Have fun and happy coding! -- http://mail.python.org/mailman/listinfo/python-list
Re: with statement
On Thursday, April 19, 2012 10:15:23 AM UTC-7, Kiuhnm wrote: > A with statement is not at the module level only if it appears inside a > function definition or a class definition. > Am I forgetting something? > > Kiuhnm That sounds about right to me. However, I haven't really used with's very much. So why would it matter where the statement is? (The only possibility that occurs to me is if your __enter__ or __exit__ methods reference a variable at some arbitrary level.) -- http://mail.python.org/mailman/listinfo/python-list
Re: os.system()
On Thursday, April 19, 2012 11:09:22 AM UTC-7, Yigit Turgut wrote: > When I use os.system() function, script waits for termination of the > windows that is opened by os.system() to continue thus throwing errors > and etc. How can i tell Python to let it go and keep on with the next > execution after os.system() ? You have to use threads. As in most programming languages (I believe), the program waits for a line to finish before moving on. So you'll have to create a new thread to deal with the windows, then move on to other stuff. Read the docs on the threading modules. -- http://mail.python.org/mailman/listinfo/python-list
Re: can I overload operators like "=>", "->" or something like that?
On Thursday, April 19, 2012 12:28:50 PM UTC-7, dmitrey wrote: > hi all, > can I somehow overload operators like "=>", "->" or something like > that? (I'm searching for appropriate overload for logical implication > "if a then b") > Thank you in advance, D. I don't believe that you could overload those particular operators, since to my knowledge they do not exist in Python to begin with. -- http://mail.python.org/mailman/listinfo/python-list
Re: can I overload operators like "=>", "->" or something like that?
On Thursday, April 19, 2012 11:09:52 PM UTC-7, Ben Finney wrote: > alex23 writes: > > > On Apr 20, 5:54 am, Jacob MacDonald wrote: > > > > > On Thursday, April 19, 2012 12:28:50 PM UTC-7, dmitrey wrote: > > > > can I somehow overload operators like "=>", "->" or something like > > > > that? > > > I don't believe that you could overload those particular operators, > > > since to my knowledge they do not exist in Python to begin with. > > There is no ‘=>’ operator, and no ‘->’ operator, in Python > http://docs.python.org/reference/lexical_analysis.html#operators>. > > > > It all depends on if the operators use special methods on objects: > > http://docs.python.org/reference/datamodel.html#special-method-names > > > > You can overload => via object.__le__, for example. > > No, ‘<=’ is the less-than-or-equal operator. There is no ‘=>’ operator > in Python. > > -- > \ “I knew things were changing when my Fraternity Brothers threw | > `\ a guy out of the house for mocking me because I'm gay.” | > _o__) —postsecret.com, 2010-01-19 | > Ben Finney Thought so. -- http://mail.python.org/mailman/listinfo/python-list
Re: How do you refer to an iterator in docs?
On Friday, April 20, 2012 6:41:25 AM UTC-7, Roy Smith wrote: > In article <4f910c3d$0$29965$c3e8da3$54964...@news.astraweb.com>, > Steven D'Aprano wrote: > > > I refer you to your subject line: > > > > "How do you refer to an iterator in docs?" > > > > In documentation, I refer to an iterator as an iterator, just as I would > > refer to a list as a list, a dict as a dict, or a string as a string. > > Except that "list of foos" and "sequence of foos" make sense from a > grammar standpoint, but "iterator of foos" does not. Or maybe it does? Unless you're writing the docstring for end users, I think you should be fine using Python words. After all, this is Python :) -- http://mail.python.org/mailman/listinfo/python-list
C API : Creating a Py_Method object from a C function.
I've got a pure python module that parses a certain type of file. It has a load() function that allows a callback function to be passed for getting progress information. In straight python, this works fine. However, I'm now trying to use this from a C++ program. The current flow that I'm trying to get is as follows: C++ calls python interface function, passing a C++ function pointer Python interface function stores C++ function pointer Python interface function generates new Py_Object method pointer pointing to a different C python function. (This different function calls the stored C++ function pointer) Python interface function calls python function Python function calls the python method pointer it was passed C python function then calls the stored C++ function pointer. The problem in this workflow is taking the C python function that I've defined (using the standard "static PyObject *someFunction(PyObject *self, PyObject *args)" method) and converting this into a Py_Object. Any ideas? Py_Method doesn't seem to allow you to generate a new one with your own pointers inside... and I can't see anything else in the docs that might allow me to do this... Thanks for any advice! -- Hugh Macdonald -- http://mail.python.org/mailman/listinfo/python-list
Re: C API : Creating a Py_Method object from a C function.
Thanks Martin - that worked wonderfully For the record (and for anyone searching for this in future), here's the code that worked (with names changed to protect my job...) myPython is the C++/Python interface class containing static methods which pass on calls to the underlying python module. It's not really commented, but if you're trying to do this kind of thing, it should give you what you need. // myPython.h #ifndef ___MYPYTHON_H___ #define ___MYPYTHON_H___ #include using namespace std; typedef struct _object PyObject; typedef void (*loadCallback)(string message, int progress, void *callbackData); staticPyObject *myPython_doLoadCallback(PyObject *self, PyObject *args); class myPython { public: staticlist *loadDetails(string file, loadCallback callbackFunc = NULL, void *callbackData = NULL); staticvoid doLoadCallback(string message, int progress); private: staticPyObject *getResults(char *moduleName, char *functionName, PyObject *args); staticloadCallback callbackFunc; staticvoid *callbackData; }; #endif // ___MYPYTHON_H___ // myPython.cpp #include #include loadCallbackmyPython::callbackFunc = NULL; void*myPython::callbackData = NULL; list *myPython::loadDetails(string file, loadCallback newCallbackFunc, void *newCallbackData) { PyObject *pArgs, *pResult; callbackFunc = newCallbackFunc; callbackData = newCallbackData; PyMethodDef *callbackFunctionDef = new PyMethodDef; callbackFunctionDef->ml_name = "doLoadCallback"; callbackFunctionDef->ml_meth = &myPython_doLoadCallback; callbackFunctionDef->ml_flags = 1; PyObject *pyCallbackFunc = PyCFunction_New(callbackFunctionDef, NULL); pArgs = Py_BuildValue("(sO)", file.c_str(), pyCallbackFunc); pResult = getResults("myPythonModule", "loadDetails", pArgs); if(!pResult) { Py_DECREF(pArgs); return NULL; } if(PyList_Check(pResult)) { // Convert pResult into a list and return that. } return NULL; } PyObject *myPython_doLoadCallback(PyObject *self, PyObject *args) { char *message; int progress; if(!PyArg_ParseTuple(args, "si", &message, &progress)) return NULL; myPython::doLoadCallback(message, progress); return Py_None; } void myPython::doLoadCallback(string message, int progress) { if(callbackFunc) callbackFunc(message, progress, callbackData); } -- http://mail.python.org/mailman/listinfo/python-list
Reading in external file - error checking and line numbers...
I'm writing a tool at the moment that reads in an external file (which can use any Python syntax) At the moment, I'm reading the file in using: scriptLines = open(baseRippleScript).read() exec scriptLines However, if I raise an exception in my main code, in a function that is called from the external script, the stack trace just has: File "", line 8, in ? Ideally, I'd want to be able to avoid throwing exceptions and would like to, from my main code, print out an error that included the script name (easily accessible) and the line number (less easily accessible). Is there a better way of executing an external script that would let me access at any time the line number from the external script that is being executed. More specifically, if a function is called from an external script with an invalid parameter type, I want to be able to flag it accurately to the user Hope this made sense - let me know if I've confused you at all. -- Hugh Macdonald -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading in external file - error checking and line numbers...
Thankyou! That was much easier than I expected. One more thing on a similar note. When raising exceptions, is it possible to remove a few items from the top of the stack trace? My stack trace is looking something like: File "ripple", line 160, in ? File "ripple", line 94, in executeRipple File "test.rip", line 8, in ? dependsOnFrame = new) File "ripple", line 133, in __init__ File "ripple", line 148, in addDependsOnFrame __main__.RippleError: 'Cannot add frame dependency to non frame-based node' I'd like to be able to remove the last two items in the stack so that it just shows the user: File "ripple", line 160, in ? File "ripple", line 94, in executeRipple File "test.rip", line 8, in ? dependsOnFrame = new) __main__.RippleError: 'Cannot add frame dependency to non frame-based node' Unfortunately, I don't know how many 'ripple' stack items there will be... This is why I'd much rather, if I can, do this without exceptions and just be able to print out my own error message with the problem line number marked Or am I asking too much? ;) -- Hugh Macdonald -- http://mail.python.org/mailman/listinfo/python-list
Interpreting Unicode scripts
Hello, I am considering embedding Python in a C++ application, which works internally in UTF-16. The only API I can find for running scripts is PyRun_SimpleString(const char*). Does that mean that Python is unable to execute scripts containing characters from more than one code page? Thanks, Keith MacDonald -- http://mail.python.org/mailman/listinfo/python-list
Re: Interpreting Unicode scripts
That document did help, thanks, although I was initially disconcerted to see that it's written in the future tense. Anyway, it works with Python 2.4. Keith MacDonald "Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > reading PEP 263 might help: > >http://www.python.org/peps/pep-0263.html > > (summary: encode as utf-8, prepend "# coding: utf-8\n", and you're done) > > > > > -- http://mail.python.org/mailman/listinfo/python-list
Hacking the scope to pieces
We're starting to version a number of our python modules here, and I've written a small function that assists with loading the versioned modules... A module would be called something like: myModule_1_0.py In anything that uses it, though, we want to be able to refer to it simply as 'myModule', with an environment variable ("MYMODULE_VERSION" - set to "1.0") that defines the version. I've written a module called 'moduleLoader' with the follwing function in: def loadModule(module, version, v = globals()): import compiler loadStr = "import %s_%s as %s" % (module, version.replace(".", "_"), module) eval(compiler.compile(loadStr, "/tmp/%s_%s_errors.txt" % (module, version.replace(".", "_")), "single")) v[module] = vars()[module] The ideal situation with this would be to be able, in whatever script, to have: import moduleLoader moduleLoader.loadModule("myModule", os.getenv("MODULE_VERSION")) However, this doesn't work. The two options that do work are: import moduleLoader moduleLoader.loadModule("myModule", os.getenv("MODULE_VERSION"), globals()) import moduleLoader moduleLoader.loadModule("myModule", os.getenv("MODULE_VERSION")) from moduleLoader import myModule What I'm after is a way of moduleLoader.loadModule working back up the scope and placing the imported module in the main global scope. Any idea how to do this? -- Hugh Macdonald -- http://mail.python.org/mailman/listinfo/python-list
Re: Hacking the scope to pieces
I will take a look! Thanks Skip -- Hugh -- http://mail.python.org/mailman/listinfo/python-list
Re: Hacking the scope to pieces
Maybe I misunderstood what you meant, but I couldn't quite manage to get this one working My initial hopes about __import__() were that I could define it inside my new module (moduleLoader) and, when the module is imported, it could do stuff (like try to hold onto the vars() and globals() from the importing scope). However, I couldn't get it to import... The route I've ended up going (which is just about as simple) is just to return the new module from moduleLoader.loadModule, so my loading code is: import moduleLoader myModule = moduleLoader.loadModule("myModule", os.getenv("MODULE_VERSION")) I've also switched over to using 'inp' for this, rather than creating a compiler string - much nicer Anyway, thanks Skip -- Hugh -- http://mail.python.org/mailman/listinfo/python-list
Probably simple syntax error
Hi everyone. This is my first time posting to this newsgroup, and although I maintain my netiquette I might've missed something specific to the newsgroup, so hopefully you can avoid flaming me if I have :) I apologize for the length of this post but I figure the more information the better. My problem is that I'm getting a syntax error in some Python code that looks quite simple. The original code was in Object Pascal as I'm a recent Delphi-turned-Python programmer. I took the code (which is only about 130 lines in OP) and 'translated' it the best I could into Python (ended up being one line shy of 80 when I was done). I can't see any problems with the code but it's coming up with a bunch of errors, which I'm guessing are probably my assuming something is the same in Python as it is in Pascal, and being wrong. Anyway, here's the code I'm having trouble with (the same error comes up several times but this is the first part of the code it shows up in): [code] randomizing_counter = 0 # Put the loop counter for the randomizing to zero. until_val = 36 # Set the "until val" to 36. We'll compare them to make sure we're not at the end of our wordlist_both. while randomizing_counter < until_val: big_randomized_int = RandRange(0,100) # Make a random value and store it. small_randomized_int = big_randomized_int / 100 # Divide that random value and store it in a different variable. small_randomized_int = Round(small_randomized_int, 2) # Round that value to 2 decimal places **weights_array(randomizing_counter) = small_randomized_int # Assign the first randomized value to our first word to be weighted. randomizing_counter = randomizing_counter + 1 # Up the counter and repeat. [/code] The starred line is the one getting the error message: "SyntaxError: can't assign to function call" Now, I do understand what this means. I'm trying to assign to a function instead of the value that the function should create. But since when is weights_array or small_randomizing_int a function? Both are being declared in the code on their first usage. This one has got me stumped, maybe you guys can help me out with it? Thanks, ~Dustin -- http://mail.python.org/mailman/listinfo/python-list
Re: Probably simple syntax error
Ah. Thank you everyone. Sorry for not replying earlier, real life got in the way :) Gerry Herron, Tim Delaney, Mark Peters: Thank you. Switching from parentheses to square brackets fixed the code, and yes, Tim, you were right. It was a list I was working with. And thanks for those links Tim. John Machin: Thank you for all the pointers/code fixes there. They'll help alot. Ptn: I was unaware of that period added, Thanks, I'll have to watch out for it. :) And Cameron: Ah, yes. It does reduce the confusion. I do know that square brackets are used for *creating* a dictionary (blah = ["A", "B", "C"], so I figured the same would apply to accessing it (which is why for my list, which I created with parenthesis I assumed I accessed with parenthesis). Thank you =] ~Dustin -- http://mail.python.org/mailman/listinfo/python-list
Re: import pysqlite2 or import sqlite3?
On Nov 21, 3:02 pm, Hertha Steck <[EMAIL PROTECTED]> wrote: > Hello, > > I'm using Python 2.5.1, Pysqlite 2.3.5 and SQLite 3.4.1 on Gentoo Linux. > I've always imported pysqlite using > > from pysqlite2 import dbapi2 > > and that works. If I try > > import sqlite3 > > I get > > Traceback (most recent call last): > File "", line 1, in > File "/usr/lib/python2.5/sqlite3/__init__.py", line 24, in > from dbapi2 import * > File "/usr/lib/python2.5/sqlite3/dbapi2.py", line 27, in > from _sqlite3 import * > ImportError: No module named _sqlite3 > > And I thought that's normal, there is no Python module called sqlite3. > > Then, after a discussion in the Gentoo forum, I saw this in the Python > library reference: > > > To use the module, you must first create a Connection object that > > represents the database. Here the data will be stored in the /tmp/example > file: > > > > > conn = sqlite3.connect('/tmp/example') > > No import statement, though, so the module might have been renamed in that > statement. Possibly not a really good idea in the documentation. > > But now I see an old post to c.p.l: > > > I'm using Ubuntu Feisty: > > * Python 2.5.1 (r251:54863, May 2 2007, 16:56:35) > > [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2 > > * SQLite version 3.3.13 > > > Suppose I run the following program: > > import sqlite3 > > > conn = sqlite3.connect('example') > > ... > > And from the rest of the posting that import seems to work. Has that module > different names for different Linux distributions? Or what's the matter > here? Make sure you built python with the "sqlite" USE flag. -- http://mail.python.org/mailman/listinfo/python-list
import urllib2 fails with Python 2.6.1 on Vista
I googled a bit this morning search for an answer to this problem but have come up empty so far. Can anyone help? Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import urllib2 Traceback (most recent call last): File "", line 1, in File "C:\dev\opt\Python25\Lib\urllib2.py", line 92, in import httplib File "C:\dev\opt\Python25\Lib\httplib.py", line 71, in import socket File "C:\dev\opt\Python25\Lib\socket.py", line 70, in _realssl = ssl NameError: name 'ssl' is not defined >>> NameError: name 'ssl' is not defined By way of comparison here is Python 2.5.2 on the same machine: Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import urllib2 >>> Whats going on?? Thanks, Scott -- http://mail.python.org/mailman/listinfo/python-list
Re: import urllib2 fails with Python 2.6.1 on Vista
Yes, I see your point. Not sure how that would happen. It is possible to have multiple versions of python on the same machine I assume? During the installation I have specified the directory to install python in, otherwise I have not changed anything. Could it be an environment variable or something like that? Thanks, Scott On Sun, Jan 18, 2009 at 12:44 AM, Gabriel Genellina wrote: > En Sat, 17 Jan 2009 17:13:00 -0200, Scott MacDonald > escribió: > > I googled a bit this morning search for an answer to this problem but have >> come up empty so far. Can anyone help? >> >> Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit >> > ^ > >> (Intel)] >> on win32 >> Type "help", "copyright", "credits" or "license" for more information. >> >>> import urllib2 >>>>> >>>> Traceback (most recent call last): >> File "", line 1, in >> File "C:\dev\opt\Python25\Lib\urllib2.py", line 92, in >> > > > It seems your have a confusing setup. Why is Python 2.6 using > C:\dev\opt\Python25? > > -- > Gabriel Genellina > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Re: import urllib2 fails with Python 2.6.1 on Vista
Ah yes, with your help I seem to have solved my own problem. I had PYTHONPATH defined to point to the 2.5 directory. Thanks! Scott On Sun, Jan 18, 2009 at 11:01 AM, Scott MacDonald < scott.p.macdon...@gmail.com> wrote: > Yes, I see your point. Not sure how that would happen. It is possible to > have multiple versions of python on the same machine I assume? > > During the installation I have specified the directory to install python > in, otherwise I have not changed anything. Could it be an environment > variable or something like that? > > Thanks, > Scott > > > > > On Sun, Jan 18, 2009 at 12:44 AM, Gabriel Genellina < > gagsl-...@yahoo.com.ar> wrote: > >> En Sat, 17 Jan 2009 17:13:00 -0200, Scott MacDonald >> escribió: >> >> I googled a bit this morning search for an answer to this problem but >>> have >>> come up empty so far. Can anyone help? >>> >>> Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit >>> >> ^ >> >>> (Intel)] >>> on win32 >>> Type "help", "copyright", "credits" or "license" for more information. >>> >>>> import urllib2 >>>>>> >>>>> Traceback (most recent call last): >>> File "", line 1, in >>> File "C:\dev\opt\Python25\Lib\urllib2.py", line 92, in >>> >> >> >> It seems your have a confusing setup. Why is Python 2.6 using >> C:\dev\opt\Python25? >> >> -- >> Gabriel Genellina >> >> -- >> http://mail.python.org/mailman/listinfo/python-list >> > > -- http://mail.python.org/mailman/listinfo/python-list
Re: import urllib2 fails with Python 2.6.1 on Vista
I think I set it a long time ago to get the python VTK bindings working... On Mon, Jan 19, 2009 at 5:58 AM, Gabriel Genellina wrote: > En Sun, 18 Jan 2009 16:08:07 -0200, Scott MacDonald < > scott.p.macdon...@gmail.com> escribió: > > Ah yes, with your help I seem to have solved my own problem. I had >> PYTHONPATH defined to point to the 2.5 directory. >> > > Best to avoid setting PYTHONPATH at all. If you install new packages into a > standard place like site-packages, and use .pth files for those libraries > that aren't packages, there should be no need to set PYTHONPATH. > > > -- > Gabriel Genellina > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Dictionary Algorithm Question
You might be interested in the "Beautiful Code" book: http://oreilly.com/catalog/9780596510046/ It has a chapter on Python's dict implementation that is pretty good. On Tue, Dec 16, 2008 at 10:51 AM, Brigette Hodson wrote: > Hello! I am in a beginning algorithms class this semester and I am working > on a presentation. I want to discuss in some detail the algorithm python > uses to determine the hash function for python dictionaries. Does anyone > know what this algorithm is? Or where I can go to find information on it? > > Thanks. > > -- > http://mail.python.org/mailman/listinfo/python-list > > -- http://mail.python.org/mailman/listinfo/python-list
Re: Programming exercises/challenges
What size of a project are you looking to work on? I enjoy learning in a similar way as you it seems. Recently I have been interested in data visualization problems. Maybe trying to replicate something from a website like: http://www.visualcomplexity.com/vc/ would interest you? Scott On Tue, Nov 18, 2008 at 5:39 PM, <[EMAIL PROTECTED]> wrote: > Hi guys, > > I'm learning Python by teaching myself, and after going through several > tutorials I feel like I've learned the basics. Since I'm not taking a class > or anything, I've been doing challenges/programs to reinforce the material > and improve my skills. I started out with stuff like "Guess my number" > games, hangman, etc. and moved on to making poker and card games to work > with classes. For GUIs I created games like minesweeper, and a GUI stock > portfolio tracker. I am out of ideas and am looking for programming > projects, challenges, or programs that have helped you'll learn. I'm working > on the project Euler problems, but I find that they don't really help my > programming skills; they are more math focused. Suggestions? What has been > useful or interesting to you? I'd also welcome sources of textbook type > problems, because the ones provided in tutorials tend to be repetitive. > > Thanks, > Ben > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Strange affinity side effect with multiprocessing.
Hi Everyone, I'm having a strange problem with the multiprocessing package and Panda3D. Importing panda modules causes multiprocessing to only use one of my cores. I've created an example test case. It uses an infinite loop to ping the cores so you'll have to manually kill the python processes. So if I run the following I can see in my task manager that both cores are at 100%. Code: #from pandac.PandaModules import Point2 from multiprocessing import Pool def dummyWorker(a): while True: continue class DummyTester(object): def __init__(self): self.pool = Pool(2) def go(self): result = self.pool.map_async(dummyWorker, range(2)) result.get() if __name__ == "__main__": DummyTester().go() But if I uncomment out that one line there it only uses one of my cores. This is with a fresh download of panda 1.7.0 on windows xp, python 2.6, and intel core2 duo. I'm completely at a loss so any thoughts would be greatly appreciated. Thx. -Greg -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Developer - HFT Trading firm - Chicago, IL
Possibly relevant: http://www.nanex.net/FlashCrash/FlashCrashAnalysis_NBBO.html On Sat, Aug 21, 2010 at 4:22 PM, Lawrence D'Oliveiro wrote: > In message > , > Raymond > Hettinger wrote: > > > On Aug 21, 2:30 am, Lawrence D'Oliveiro > > > wrote: > > > >> Wasn’t HFT an exacerbating factor in just about every major stockmarket > >> downturn since, oh, 1987? > > > > IMO, it was a mitigating factor. > > HFT firms provide liquidity and help price discovery. > > Investor sentiment is what drives rallys and crashes. > > Someone who doesn’t understand how positive feedback can lead to > instabilities in a dynamical system. > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Express thanks
I wanted to give a shout out to the wonderfully passionate contributions to python I've witnessed following this and other mailing lists over the last little bit. The level of knowledge and willingness to help I've seen are truly inspiring. Super motivating. Probably the wrong forum for such a message but what the hey. Hamish -- -- https://mail.python.org/mailman/listinfo/python-list