Re: Deeply nested dictionaries - should I look into a database or am I just doing it wrong?
* Andrew Berg (Sat, 30 Jul 2011 22:10:43 -0500) > I'm looking for pointers on design. I'm inexperienced but cautious and > am mostly wondering if there's an easier way to "format" this data or > if this approach will lead to problems. The "QueueItem.x264['avs']['filter']['fft3d']['ffte'])" example does not look right. Especially the mix of "." and "[]" references. Actually, dictionaries in a dictionary don't look right to me either. The design of your data structure won't change. I would think that your program already mimicks it by nested class statements so you're duplicating the already existing class structure via dictionaries in order to have it available in the main class. You say that is necessary but I'm not convinced it is. Another approach would be named tuples instead of dictionaries or flat SQL tables. Thorsten -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP 8 and extraneous whitespace
"OKB (not okblacke)" writes: > Yeah, what I'm suggesting as the cleanest way is to simply make it > all one long string literal, which is wrapped by the editor to the > proper indentation point. I can't show this in a newgroup post, but > it'd be like: > > def somefunc(): > if someCondition(): > "Lorem ipsum dolor sit amet, consectetur adipiscing elit. > Fusce fermentum posuere mi eget molestie. Nulla facilisi. Curabitur et > ultrices massa." > > . . . except that the wrapped lines of the lorem ipsum would all line up > at the same level as the open quote. This is clean because you get to > type it exactly as you wanted it. You don't need to include extraneous > whitespice to get it to line up or wrap in your editor, and you also > don't need to choose the wrap points to put in extra quotes, as in your > example. The irritating thing about doing it your way is that if you > later change the text and it rewraps, you have to move your quote > marks. You can have the text indented and wrapped how you like it, then remove the leading whitespace at run-time with ‘textwrap.dedent’ http://stackoverflow.com/questions/2504411/proper-indentation-for-python-multiline-strings/2504454#2504454>. -- \“Sane people have an appropriate perspective on the relative | `\ importance of foodstuffs and human beings. Crazy people can't | _o__) tell the difference.” —Paul Z. Myers, 2010-04-18 | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: Not able to store data to dictionary because of memory limitation
Hi Ulrich, Thanks for your idea. I resolved the issue by making use of integers instead of strings. Earlier I had many duplicate strings in different rows retrieved from database. I created a list to have unique strings and their indexes are used in actual computations. So lot of space is saved by having integers instead of strings. I am trying differnt approach too, to get ids from database instead of gettign direct values. values will be retrived by using unique ids of different tables. I hope, I will be able to improve perforamnce with this approach. Regards, Rama On 7/6/11, Ulrich Eckhardt wrote: > Rama Rao Polneni wrote: >> After storing 1.99 GB data in to the dictionary, python stopped to >> store the remaining data in to dictionary. > > Question here: > - Which Python? > - "stopped to store" (you mean "stopped storing", btw), how does it behave? > Hang? Throw exceptions? Crash right away? > > >> Memory utilization is 26 GB/34GB. That means, still lot memory is left >> as unutilized. > > 2GiB is typically the process limit for memory allocations on 32-bit > systems. So, if you are running a 32-bit system or running a 32-bit process > on a 64-bit system, you are probably hitting hard limits. With luck, you > could extend this to 3GiB on a 32-bit system. > > >> Is this proplem becasue of large memory utlization. > > I guess yes. > > >> Is there any alternate solution to resolve this issue. Like splitting >> the dictionaries or writing the data to hard disk instead of writing >> to memory. > > If you have lost of equal strings, interning them might help, both in size > and speed. Doing in-memory compression would be a good choice, too, like > e.g. if you have string fields in the DB that can only contain very few > possible values, converting them to an integer/enumeration. > > Otherwise, and this is a more general approach, prefer making a single sweep > over the data. This means that you read a chunk of data, perform whatever > operation you need on it, possibly write the results and then discard the > chunk. This keeps memory requirements low. At first, it doesn't look as > clean as reading the whole data in one step, calculations as a second and > writing results as a third, but with such amounts of data as yours, it is > the only viable step. > > Good luck, and I'd like to hear how you solved the issue! > > Uli > > -- > Domino Laser GmbH > Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Re: Not able to store data to dictionary because of memory limitation
On Sun, Jul 31, 2011 at 9:38 AM, Rama Rao Polneni wrote: > Earlier I had many duplicate strings in different rows retrieved from > database. > I created a list to have unique strings and their indexes are used in > actual computations. So lot of space is saved by having integers > instead of strings. > What you're doing there is called "interning" the strings, and I think it's the right thing to do. You can get the Python interpreter to do this for you by simply passing the strings through the built-in function intern() which will return a string with identical content. (In Python 3, that function has been shoved off to a module, so it's sys.intern() and you need to import sys.) You'll save some space and improve dictionary performance, but you won't lose clarity. Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list
Re: eval, exec and execfile dilemma
100 functions/second installed to global namespace doesn't sound well. What on earth are you doing needing to use exec to create hundreds of functions?? :-) Have you considered not using exec at all, and using a good old-fashioned factory function and closures? def factory(x): def inner(param): return param + x return inner plusone = factory(1) plustwo = factory(2) I'm betting that this will be much faster than exec, and much more readable. I'm working on a program that creates pivot tables from multi-dimensional databases. The user is able to give expressions in a tiny language. These expressions are then converted to Python source code, and compiled into functions. The generated function is called with several different numpy arrays. In most cases, there are only a few functions are created (e.g. when the user changes the expression) and they are called many times. But sometimes (for example, when creating charts from the data) I have to generate a separate function for every fact set in the database. When there are many data series with lots of data in the graph, some 100 functions needs to be generated very fast. This cannot be done using factory functions, because the function code depends on the user's expression. It COULD be done in a different way: parsing the user's expression into an abstract syntax tree and then provide methods in the AST to evaluate itself. But this approach would use too many python method calls. By generating the function source code, I can reduce the number of Python method calls needed from several thousand to ten or so. In most cases, the user will enter an expression that will produce a lambda function (eval+lambda). But with more elaborate expressions, I cannot efficiently convert it to a lambda expression. Of course the user can always write the expression in pure Python source code, but there are obvious problems with that... Best, Laszlo -- http://mail.python.org/mailman/listinfo/python-list
How to avoid confusion with method names between layers of a package
Hi All, I have a package with more layers of code. Bottom layer contains classes and methods for dealing with tabular data. Second layer works with multi-dimensional data. It provides a data model with unified API for accessing multi dimensional databases. Top layer is responsible for displaying views of the data model. The data model can be used in other (non-GUI) applications as well. When I was developing the data model, I have tried to follow PEP 8. For method names, it says: "Use the function naming rules: lowercase with words separated by underscores as necessary to improve readability." I also tried to follow Demeter's law. (http://en.wikipedia.org/wiki/Law_of_Demeter) Here are some classes from different layers: Facts - access facts data (non-visual) Query - query facts with cache, holds a reference to a Facts (non-visual) Cube - drill facts for any number of dimensions, holds a reference to a Query (non-visual) CubeGrid - displays a cube in a pivot grid (visual component) Some methods in one class are also useful in another. For example, a Facts instance can tell the number of measures in the database. A Cube instance indirectly "owns" a Facts instance (through a Query). So Cube.get_measure_count() is a wrapper for Query.get_measure_count() which is a wrapper for Facts.get_measure_count(). This is good, because - given a cube instance - you can call *cube.get_measure_count()* instead of *cube._query._facts.get_measure_count()*. The latter would be ugly, and require extra knowledge about the inner structure of the Cube. So far so good. The problem is that a CubeGrid instance is also a wx.Grid instance. However, different naming conventions apply there. All method names in wxPython are coming from C++. They use CamelCase method names. There is a naming conflict. What should I do? Solution #1: Mix CamelCase and PEP 8 names in the CubeGrid class. Very ugly, inconsistent. Solution #2: Convert old PEP 8 names in the CubeGrid class, so every method in CubeGrid will have CamelCase names. Very inconsistent! Who would understand that CubeGrid.GetMeasureCount() is the same as Facts.get_measure_count()? Solution #3: Drop Demeter's law here, and always use *CubeGrid.GetCube().get_measure_count()* - doesn't look very nice. Any other ideas? Thanks, Laszlo -- http://mail.python.org/mailman/listinfo/python-list
Re: /lib-tk/Tkinter.py", for Tk/python2.7/lib-dynload/_tkinter.so, hon2.
Also happens with python3.1 and OSX 10.6.8 import tkinter #yields: Traceback (most recent call last): File "imptk.py", line 1, in import tkinter File "/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/tkinter/__init__.py", line 39, in import _tkinter # If this fails your Python may not be configured for Tk ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/lib-dynload/_tkinter.so, 2): no suitable image found. Did find: /Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/lib-dynload/_tkinter.so: mach-o, but wrong architecture > On Friday, June 25, 2010 4:54 AM Julien Pauty wrote: > Dear list, > > Last version of my software relies on ttk. Under windows and linux > this is fine. But, OSX users are facing problems (I do not have access > to a Mac myself for testing...). Those with OSX 10.6 can run the > program. It seems that OSX 8.6 ships with Tk8.5. > > People with OSX 8.5 cannot run the app. I told them to install python > 2.7 which seems to be the first version on OSX to ship with Tk8.5. > However, the program still does not run. I asked a person to launch a > python 2.7 interpreter and try to import tkinter. This is an excerpt > of the output: > > =A0 from Tkinter import * > =A0 File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/l= > ib-tk/Tkinter.py", > line 39, in > =A0 =A0 import _tkinter # If this fails your Python may not be configured f= > or Tk > ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/p= > ython2.7/lib-dynload/_tkinter.so, > 2): no suitable image found. =A0Did find: > =A0 =A0 =A0 =A0 /Library/Frameworks/Python.framework/Versions/2.7/lib/pytho= > n2.7/lib-dynload/_tkinter.so: > no matching architecture in universal wrapper > > Full log is there: http://pastebin.com/vky8FbrP > > I asked a person to simply open a python2.7 shell and import Tkinter. > He got the same error. > > All of this is executed with Python 2.7rc1. Archives that are on the > ftp of python.org. > > I have seen this bug http://bugs.python.org/issue9045, which is > related, but deals with the specificities if OSX 64bit. > > Can this problem be solved by installing Active TK 8.5 for OSX ? > > Anybody knows what is the good combination of installer / libraries to > install to run a ttk application on OSX 8.5 ? Ideally, I would like to > document the setup procedure for 8.5 users. > > Cheers, > > Julien >> On Friday, June 25, 2010 9:44 AM Kevin Walzer wrote: >> There has been a lot of traffic on the MacPython list about this--see >> the list archives. >> >> -- >> Kevin Walzer >> Code by Kevin >> http://www.codebykevin.com >>> On Friday, June 25, 2010 1:34 PM Jeff Hobbs wrote: >>> /lib-tk/Tkinter.py", >>> for Tk >>> /python2.7/lib-dynload/_tkinter.so, >>> hon2.7/lib-dynload/_tkinter.so: >>> >>> The OS X equation is confuzzulating due to version and API changes in >>> Mac OS X. Let's review ... >>> >>> OS X 10.5 ships Tcl/Tk 8.4 built 32-bit only i386+ppc using Carbon. >>> OS X 10.6 ships Tcl/Tk 8.5 built 32/64 i386+x86_64 using Cocoa. >>> >>> The Cocoa port of Tk was necessary for 64-bit support, as Apple never >>> did supply the promised 64-bit Carbon. Tk 8.5 has Cocoa as an option, >>> and it is default in Tk 8.6. >>> >>> ActiveTcl 8.5 still ships as 32-bit i386+ppc Carbon because going to >>> Cocoa also means you have to drop OS X 10.4 support (out of curiousity >>> - does anyone care about OS X 10.4 anymore that is not stuck on what is >>> already installed?). 8.5 plans to do so later this year (leaving >>> behind our OS X 10.4 brethren to older versions). ActiveTcl 8.6 (Tcl/ >>> Tk 8.6 is in beta) already ships i386+x86_64 Cocoa. >>> >>> Now there is the issue that Tkinter links to a specific version of Tcl/ >>> Tk. I am currently working on a patch that will remove this >>> limitation (making the binary Tk version independent). >>> >>> So what do you do? >>> >>> Well, it depends on what mix you are trying to make. The easiest is >>> to just run >>> arch -i386 python2.7 >>> and then it will find the compatible i386 Tk. The next release of >>> ActivePython 2.7 (which is building i386+x86_64) will have the Tk >>> version independence, so it could work with core Tk or AT 8.6, or 8.5 >>> in 32-bit mode. >>> >>> Less confuzzulated? >>> >>> Jeff -- http://mail.python.org/mailman/listinfo/python-list
Re: How to avoid confusion with method names between layers of a package
> So far so good. The problem is that a CubeGrid instance is also a wx.Grid instance. However, different naming conventions apply there. All method names in wxPython are coming from C++. They use CamelCase method names. There is a naming conflict. What should I do? > > Solution #1: Mix CamelCase and PEP 8 names in the CubeGrid class. Very ugly, inconsistent. This is what I like to do when working with wx. It's ugly, but it makes it easy to distinguish the methods defined by wx from my own custom methods. -- http://mail.python.org/mailman/listinfo/python-list
[ANN] IPython 0.11 is officially out
Hi all, on behalf of the IPython development team, I'm thrilled to announce, after more than two years of development work, the official release of IPython 0.11. This release brings a long list of improvements and new features (along with hopefully few new bugs). We have completely refactored IPython, making it a much more friendly project to participate in by having better separated and organized internals. We hope you will not only use the new tools and libraries, but also join us with new ideas and development. After this very long development effort, we hope to make a few stabilization releases at a quicker pace, where we iron out the kinks in the new APIs and complete some remaining internal cleanup work. We will then make a (long awaited) IPython 1.0 release with these stable APIs. *Downloads* Download links and instructions are at: http://ipython.org/download.html And IPython is also on PyPI: http://pypi.python.org/pypi/ipython Those contain a built version of the HTML docs; if you want pure source downloads with no docs, those are available on github: Tarball: https://github.com/ipython/ipython/tarball/rel-0.11 Zipball: https://github.com/ipython/ipython/zipball/rel-0.11 * Features * Here is a quick listing of the major new features: - Standalone Qt console - High-level parallel computing with ZeroMQ - New model for GUI/plotting support in the terminal - A two-process architecture - Fully refactored internal project structure - Vim integration - Integration into Microsoft Visual Studio - Improved unicode support - Python 3 support - New profile model - SQLite storage for history - New configuration system - Pasting of code with prompts And many more... We closed over 500 tickets, merged over 200 pull requests, and more than 60 people contributed over 2200 commits for the final release. Please see our release notes for the full details on everything about this release: https://github.com/ipython/ipython/zipball/rel-0.11 * Resources * You can see a talk about this release that was presented at the Scipy 2011 conference: http://www.archive.org/details/Wednesday-203-6- IpythonANewArchitectureForInteractiveAndParallel For reference, the slides that go along with it are here: http://fperez.org/talks/1107_ipython_scipy.pdf And there's an excellent blog post, written by Chris Fonnesbeck, providing a visual tour of our new features: http://stronginference.com/weblog/2011/7/15/innovations-in-ipython.html As usual, if you find any problem, please file a ticket --or even better, a pull request fixing it-- on our github issues site (https://github.com/ipython/ipython/issues/). Many thanks to all who contributed! Fernando, on behalf of the IPython development team. http://ipython.org -- http://mail.python.org/mailman/listinfo/python-list
Re: Deeply nested dictionaries - should I look into a database or am I just doing it wrong?
On 2011.07.31 02:41 AM, Thorsten Kampe wrote: > The "QueueItem.x264['avs']['filter']['fft3d']['ffte'])" example does not > look right. Especially the mix of "." and "[]" references. Actually, > dictionaries in a dictionary don't look right to me either. QueueItem is the class; x264 is a dictionary. > The design of your data structure won't change. I would think that your > program already mimicks it by nested class statements so you're > duplicating the already existing class structure via dictionaries in > order to have it available in the main class. Huh? I only have no nested class statements. > Another approach would be named tuples instead of dictionaries or flat > SQL tables. What would the advantage of that be? -- CPython 3.2.1 | Windows NT 6.1.7601.17592 | Thunderbird 5.0 PGP/GPG Public Key ID: 0xF88E034060A78FCB -- http://mail.python.org/mailman/listinfo/python-list
Re: What Programing Language are the Largest Website Written In?
On Jul 13, 1:04 pm, ccc31807 wrote: > On Jul 12, 7:54 am, Xah Lee wrote: > > > maybe this will be of interest. > > > 〈What Programing Language Are the Largest Website Written > > In?〉http://xahlee.org/comp/website_lang_popularity.html > > About five years ago, I did some pretty extensive research, and > concluded that the biggest sites were written serverside with JSP. > Obviously, this wouldn't include The Biggest site, but if you were a > big, multinational corporation, or listed on the NYSE, you used JSP > for your web programming. > > I doubt very seriously PHP is used for the biggest sites -- I'd still > guess JSP, or maybe a MS technology (not VB), but it's only a guess. > > CC. facebook is php myspace is microsoft aol was tcl and aolserver c embedding tcl interp priceline is lisp reddit is python was lisp orig amazon was perl livejournal was perl -- http://mail.python.org/mailman/listinfo/python-list
Re: /lib-tk/Tkinter.py", for Tk/python2.7/lib-dynload/_tkinter.so, hon2.
In article <201173191847use...@terrranews.com>, Joel Godin wrote: > Also happens with python3.1 and OSX 10.6.8 > > import tkinter #yields: > > > Traceback (most recent call last): > File "imptk.py", line 1, in > import tkinter > File > "/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/tkinter/__i > nit__.py", line 39, in > import _tkinter # If this fails your Python may not be configured for Tk > ImportError: > dlopen(/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/lib-dyn > load/_tkinter.so, 2): no suitable image found. Did find: > > /Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/lib-dynload/_t > kinter.so: mach-o, but wrong architecture What version of python3.1 did you install? This does not happen with the most recent Python 3.1.x's installed by the python.org installers. There were a number of changes included in Python 3.2 (and 2.7) to better support building on Mac OS X 10.6 where 64-bit executables are preferred. If you build your own Python 3.1 on 10.6, you will need to tweak the build, probably the easiest thing is to only build 32-bit only. But Python 3.1 is already in security-fix-only mode: best to move on to Python 3.2 which does not have these issues. See also: http://www.python.org/download/mac/tcltk/ -- Ned Deily, n...@acm.org -- http://mail.python.org/mailman/listinfo/python-list
Hostmonster : Installing MySQLdb at a specific location
I've using MySQLdb for years, but always on servers where I had system-wide access. I have an account on Hostmonster and would like to do some development there, but although python2.6 is available, MySQLdb is not installed. I do not believe there is a system-wide access, nor do I expect sysadmins to do my any favors. I have SSH access and it is a linux OS. uname -a gives me: """ Linux host266.hostmonster.com 2.6.32-42.1.BHsmp #1 SMP Tue Jun 28 17:06:41 MDT 2011 x86_64 x86_64 x86_64 GNU/Linux """ A 'local' bin directory is provided. I have downloaded MySQL-python-1.2.3 and am looking at the docs, but so far I haven't found any documentation that tells me how (or if) I may install to anything other than a default path. Any comments are welcome. TIA tim -- Tim tim at johnsons-web dot com or akwebsoft dot com http://www.akwebsoft.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Hostmonster : Installing MySQLdb at a specific location
* Tim Johnson [110731 11:01]: > I've using MySQLdb for years, but always on servers where I had > system-wide access. > > I have an account on Hostmonster and would like to do some > development there, but although python2.6 is available, MySQLdb is > not installed. I do not believe there is a system-wide access, nor > do I expect sysadmins to do my any favors. > > I have SSH access and it is a linux OS. > uname -a gives me: > """ > Linux host266.hostmonster.com 2.6.32-42.1.BHsmp #1 SMP Tue Jun 28 > 17:06:41 MDT 2011 x86_64 x86_64 x86_64 GNU/Linux > """ > > A 'local' bin directory is provided. I have downloaded > MySQL-python-1.2.3 and am looking at the docs, but so far I haven't > found any documentation that tells me how (or if) I may install > to anything other than a default path. I don't want to discourage any further input, but I'm looking at https://my.hostmonster.com/cgi/help/000531?step=000531 regarding installing django and I think the instructions can be extrapolated for MySQLdb. I will report what happens... -- Tim tim at johnsons-web dot com or akwebsoft dot com http://www.akwebsoft.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Deeply nested dictionaries - should I look into a database or am I just doing it wrong?
On Sun, Jul 31, 2011 at 11:36 AM, Andrew Berg wrote: > On 2011.07.31 02:41 AM, Thorsten Kampe wrote: >> Another approach would be named tuples instead of dictionaries or flat >> SQL tables. > What would the advantage of that be? Less punctuation noise: QueueItem.x264.avs.filter.fft3d.ffte vs. QueueItem.x264['avs']['filter']['fft3d']['ffte'] It would also make clear that your sets of "keys" are static (unlike typical dictionary usage). Cheers, Chris -- http://rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Deeply nested dictionaries - should I look into a database or am I just doing it wrong?
* Andrew Berg (Sun, 31 Jul 2011 13:36:43 -0500) > On 2011.07.31 02:41 AM, Thorsten Kampe wrote: > > Another approach would be named tuples instead of dictionaries or > > flat SQL tables. > What would the advantage of that be? QueueItem.x264['avs']['filter']['fft3d']['ffte'] would be QueueItem.x264.avs.filter.fft3d.ffte. I recently "migrated" from a syntax of - example - datetuple[fieldpositions['tm_year'][0]] (where fieldpositions was a dictionary containing a list) to datetuple.tm_year_start which is much more readable. The advantage of a SQL(ite) database would be simple flat tables but accessing them would be more difficult. Even a INI config file structure could match your problem. Thorsten -- http://mail.python.org/mailman/listinfo/python-list
Re: Deeply nested dictionaries - should I look into a database or am I just doing it wrong?
On 2011.07.31 02:51 PM, Chris Rebert wrote: > Less punctuation noise: > QueueItem.x264.avs.filter.fft3d.ffte > vs. > QueueItem.x264['avs']['filter']['fft3d']['ffte'] > > It would also make clear that your sets of "keys" are static (unlike > typical dictionary usage). I see what Thorsten meant by "named tuple" now. I was thinking of a tuple with a name: x = (1,2) Your usage made me look it up and I see that it means the factory function in the collections module. I wanted to make things look like that, but the only way I knew how to do that would've been to a new create blank class and assign values to its __dict__. Named tuples look useful; I'll read the docs and see if that will work. -- CPython 3.2.1 | Windows NT 6.1.7601.17592 | Thunderbird 5.0 PGP/GPG Public Key ID: 0xF88E034060A78FCB -- http://mail.python.org/mailman/listinfo/python-list
Re: Deeply nested dictionaries - should I look into a database or am I just doing it wrong?
On Jul 31, 2011, at 4:04 PM, Thorsten Kampe wrote: > * Andrew Berg (Sun, 31 Jul 2011 13:36:43 -0500) >> On 2011.07.31 02:41 AM, Thorsten Kampe wrote: >>> Another approach would be named tuples instead of dictionaries or >>> flat SQL tables. >> What would the advantage of that be? > > QueueItem.x264['avs']['filter']['fft3d']['ffte'] would be > QueueItem.x264.avs.filter.fft3d.ffte. I recently "migrated" from a > syntax of - example - datetuple[fieldpositions['tm_year'][0]] (where > fieldpositions was a dictionary containing a list) to > datetuple.tm_year_start which is much more readable. > > The advantage of a SQL(ite) database would be simple flat tables but > accessing them would be more difficult. > > Even a INI config file structure could match your problem. INI files are OK for lightweight use, but I find them very fragile. Since there's no specification for them, libraries don't always agree on how to read them. For instance, some libraries treat # as the comment character, and others think it is ; and others accept both. There's no standard way to specify the encoding, and, as would be critical to the OP who is nesting dicts inside of dicts, not all INI file libraries accept nested sections. To the OP -- if you're looking to write this to disk, I recommend XML or SQLite. JMHO, Philip -- http://mail.python.org/mailman/listinfo/python-list
Re: Deeply nested dictionaries - should I look into a database or am I just doing it wrong?
On 2011.07.31 03:53 PM, Philip Semanchuk wrote: > To the OP -- if you're looking to write this to disk, I recommend XML or > SQLite. I have a method that writes the data to disk, but at this point, I don't see any problems with just pickling the class instance. XML might be a good way to provide something easily read and edited by humans, though (one major goal of the class design is to let the user provide as much or as little info as he/she wants with a pickle or config/XML file and provide the rest with the program's interface). I doubt I'll use a database for storage; it's quite practical to keep everything in memory. -- CPython 3.2.1 | Windows NT 6.1.7601.17592 | Thunderbird 5.0 PGP/GPG Public Key ID: 0xF88E034060A78FCB -- http://mail.python.org/mailman/listinfo/python-list
Re: What's in a name?
I think I'll stick with Maven for the module, but the two others really need names, and I have nothing. -- CPython 3.2.1 | Windows NT 6.1.7601.17592 | Thunderbird 5.0 PGP/GPG Public Key ID: 0xF88E034060A78FCB -- http://mail.python.org/mailman/listinfo/python-list
Re: What's in a name?
Andrew Berg writes: > I think I'll stick with Maven for the module, but the two others really > need names, and I have nothing. Maven is already a well-established name for an existing free-software work http://maven.apache.org/>. I recommend choosing a name which isn't already taken by any well-known project (and wish you luck in that search :-) -- \“Pinky, are you pondering what I'm pondering?” “Wuh, I think | `\so, Brain, but will they let the Cranberry Duchess stay in the | _o__) Lincoln Bedroom?” —_Pinky and The Brain_ | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Hello My Sweet Friends.
Hello Friends. How are you all? Please Visit the following link if you know about Pakistan and what happening in the world. http://bollywoodactresseshotpictures.blogspot.com/ http://jobopportunitiesinpakistan.blogspot.com/ http://hotfemaletennisplayershotphotos.blogspot.com/ http://watchonlineindianmovies.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list
[ANN] PySAL 1.2
On behalf of the PySAL development team, I'm happy to announce the official release of PySAL 1.2. PySAL is a library of tools for spatial data analysis and geocomputation written in Python. PySAL 1.2, the third official release of PySAL, brings a number of new features: - Directional (Space-Time) LISA Analytics - LISA Markov Spillover Test - Spatial Markov Homogeneity Tests - Markov Mobillity Indices - Support for a wide variety of spatial weights formats including - AcGIS SWM, Text, DBF - STATA - MATLAB MAT - MatrixMarket MTX - Lotus WK1 - DAT - and others - RTree spatial index - Getis-Ord G statistics for global and local autocorrelation - Optimized conditional randomization for local statistics - Optimized Block/Regime Spatial Weights - Thin Spatial Sparse Weights Class (WSP) along with many smaller enhancements and bug fixes. PySAL modules - - pysal.core — Core Data Structures and IO - pysal.cg — Computational Geometry - pysal.esda — Exploratory Spatial Data Analysis - pysal.inequality — Spatial Inequality Analysis - pysal.spatial_dynamics — Spatial Dynamics - pysal.spreg - Regression and Diagnostics - pysal.region — Spatially Constrained Clustering - pysal.weights — Spatial Weights - pysal.FileIO — PySAL FileIO: Module for reading and writing various file types in a Pythonic way Downloads -- Binary installers and source distributions are available for download at http://code.google.com/p/pysal/downloads/list Documentation - The documentation site is here http://pysal.org/1.2/contents.html Web sites - PySAL's home is here http://pysal.org/ The developer's site is here http://code.google.com/p/pysal/ Mailing Lists - Please see the developer's list here http://groups.google.com/group/pysal-dev Help for users is here http://groups.google.com/group/openspace-list Bug reports --- To search for or report bugs, please see http://code.google.com/p/pysal/issues/list License information --- See the file "LICENSE.txt" for information on the history of this software, terms & conditions for usage, and a DISCLAIMER OF ALL WARRANTIES. Many thanks to all who contributed! Serge, on behalf of the PySAL development team. -- Sergio (Serge) Rey Professor, School of Geographical Sciences and Urban Planning Arizona State University http://geoplan.asu.edu/rey Editor, International Regional Science Review http://irx.sagepub.com -- http://mail.python.org/mailman/listinfo/python-list
Re: What's in a name?
On 2011.07.31 09:15 PM, Ben Finney wrote: > Maven is already a well-established name for an existing free-software > work http://maven.apache.org/>. Well of course. All the good names are taken. :P I even came up with cavelib and it was taken ( http://www.mechdyne.com/cavelib.aspx ). Maybe I'll just stick to abstract names then. -- CPython 3.2.1 | Windows NT 6.1.7601.17592 | Thunderbird 5.0 PGP/GPG Public Key ID: 0xF88E034060A78FCB -- http://mail.python.org/mailman/listinfo/python-list
how to solve it?
from matplotlib.matlab import * Traceback (most recent call last): File "", line 1, in ImportError: No module named matlab-- http://mail.python.org/mailman/listinfo/python-list
Spam
I've noticed that python-list gets significantly more spam than the other lists I subscribe to. There's an example below. I'm wondering how the list is managed. Can anyone post, or only members? I've picked the email addresses of the list managers out of the list info page, but I wonder if you guys have enough time to skim the list and boot offending members. If not, is there someone who is active on the list that you could delegate administration privileges to? Maybe someone who has been an active member for a long time? I'm willing, but probably not qualified. I've been lurking on the list for a while, but I don't contribute much because I'm not very proficient with Python. Thank you. -- Ghodmode http://www.ghodmode.com/blog -- Forwarded message -- From: Ashraf Ali Date: Mon, Aug 1, 2011 at 10:54 AM Subject: Hello My Sweet Friends. To: python-list@python.org Hello Friends. How are you all? Please Visit the following link if you know about Pakistan and what happening in the world. http://bollywoodactresseshotpictures.blogspot.com/ http://jobopportunitiesinpakistan.blogspot.com/ http://hotfemaletennisplayershotphotos.blogspot.com/ http://watchonlineindianmovies.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Quick question about threads and interpreters.
Lets say I have a program that is running a python interpreter in the main thread. I come along, write a .DLL and throw it into the program. My .dll has its own thread (right?), separate from the main thread, and then makes a pyrun_simplestring call to the pythonxx.dll. The pyrun_simplestring call attempts to make contact with a function in the original python program. In short, I'm attempting to leverage existing functionality in the original python program from my .DLL. I'm sure that sounds confusing, so maybe: PythonInterpreter_MainThread is running some SourceCode, MyDLL_PyRun_SimpleString_OtherThread makes call(?) to the same SourceCode. Now, my question is: What happens? Is another python interpreter instance created in my .dll thread to handle that call? is my call 'separate' from the main thread interpreter? I'm hoping someone can point me towards some material to better understand what might happen if I did what I outlined above. It's a small school project (not homework, just a "hey, remember when I asked you about blahblah, well I got it working!") and I'd appreciate any guidance I could get into the dark arts of multiple threads and how they relate to python interpreters, and if multiple python interpreters are created (one for each thread) how making calls to the same code works. Thank you for your time. -- http://mail.python.org/mailman/listinfo/python-list
Re: Spam
On Mon, Aug 1, 2011 at 5:56 AM, Ghodmode wrote: > I'm willing, but probably not qualified. I've been lurking on the > list for a while, but I don't contribute much because I'm not very > proficient with Python. > I don't see Python proficiency as a prerequisite for recognizing spammers :) If you are willing to take on the job, I would support your application for the power to do it. Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list
Re: Quick question about threads and interpreters.
On Mon, Aug 1, 2011 at 6:04 AM, Ira Gray wrote: > I come along, write a .DLL and throw it into the program. My .dll has its > own thread (right?), Not unless you actually create one. A DLL is simply a puddle of code; the application calls your code, you do whatever you do, you return. At no time will this start another thread, unless you explicitly do so. I think the easiest way to do what you're talking about is to keep it all on the same thread, and then call back into Python. Use the same global and local dictionaries, and then the Python namespace will be common across both your original code and the code your DLL is invoking - which will allow you to call that "existing functionality" you referred to. You will have to be careful to ensure that your DLL calls into the exact same Python library that the main application is. This might be a bit tricky, if you're not 100% sure of where your DLL is going to be called from. It might be easier and safer to have your parent program actually provide a function pointer to the DLL, which the DLL can then use to call on Python; that way, there's no direct linkage from your DLL to the Python library. Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list
Re: Spam
On Sun, Jul 31, 2011 at 9:56 PM, Ghodmode wrote: > I've noticed that python-list gets significantly more spam than the > other lists I subscribe to. There's an example below. > > I'm wondering how the list is managed. Can anyone post, or only > members? Since we're gatewayed to USENET's comp.lang.python anyway, I'd strongly suspect the former. So unfortunately, I doubt your idea could be implemented short of making the list moderated (very unlikely to happen due to the level of activity) or disabling the gateway (again unlikely due to historical momentum and USENET dinosaurs). I understand that there are spam filters in place though, so it might be worth asking that they be tweaked. (e.g. I doubt there are many legit posts involving Bollywood.) > I've picked the email addresses of the list managers out of > the list info page, but I wonder if you guys have enough time to skim > the list and boot offending members. If not, is there someone who is > active on the list that you could delegate administration privileges > to? Maybe someone who has been an active member for a long time? > > I'm willing, but probably not qualified. I've been lurking on the > list for a while, but I don't contribute much because I'm not very > proficient with Python. > > Thank you. > > -- > Ghodmode > http://www.ghodmode.com/blog > > > -- Forwarded message -- > From: Ashraf Ali And off to ab...@gmail.com I dash. Fsck you Mr. Ali. (Yeah, not their real name, I know. Still worth reporting such accounts.) Cheers, Chris > Date: Mon, Aug 1, 2011 at 10:54 AM > Subject: Hello My Sweet Friends. > To: python-list@python.org > > > Hello Friends. > How are you all? > Please Visit the following link if you know about Pakistan and what > happening in the world. P.S. Please redact the actual spam links next time so that they don't get further Google juice. -- http://mail.python.org/mailman/listinfo/python-list
Re: What's in a name?
Andrew Berg wrote: Well of course. All the good names are taken. :P I even came up with cavelib and it was taken ( http://www.mechdyne.com/cavelib.aspx ). A couple of ideas that don't seem to turn up anything software-related: Flummux Flavius -- Greg -- http://mail.python.org/mailman/listinfo/python-list
Re: Deeply nested dictionaries - should I look into a database or am I just doing it wrong?
Andrew Berg wrote: I have a method that writes the data to disk, but at this point, I don't see any problems with just pickling the class instance. Just keep in mind that if you're not careful, pickles can end up being tied more closely that you would like to various internal details of your program, such as the precise names of the classes involved and which modules they live in. -- Greg -- http://mail.python.org/mailman/listinfo/python-list
Re: Spam
Chris Rebert wrote: On Sun, Jul 31, 2011 at 9:56 PM, Ghodmode wrote: I'm wondering how the list is managed. Can anyone post, or only members? Since we're gatewayed to USENET's comp.lang.python anyway, I'd strongly suspect the former. You may get a better experience by reading the usenet group instead, and doing it through a good news site. I'm using news.individual.de, and seeing near enough to zero spam on comp.lang.python, so they must be doing a good job of filtering. -- Greg -- http://mail.python.org/mailman/listinfo/python-list