Re: Fractal
Am 16.05.2013 02:00, schrieb alex23: My favourite is this one: http://preshing.com/20110926/high-resolution-mandelbrot-in-obfuscated-python Not only is this blog entry an interesting piece of art, there's other interesting things to read there, too. Thanks! Uli -- http://mail.python.org/mailman/listinfo/python-list
Re: Fractal
On Thu, May 16, 2013 at 5:11 PM, Ulrich Eckhardt wrote: > Am 16.05.2013 02:00, schrieb alex23: > >> My favourite is this one: >> >> http://preshing.com/20110926/high-resolution-mandelbrot-in-obfuscated-python > > > Not only is this blog entry an interesting piece of art, there's other > interesting things to read there, too. I'm quite impressed, actually. Most people don't use Python for code art. Significant indentation is not usually a good thing there :) ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Determine actually given command line arguments
On 16.05.2013 08:08, Jussi Piitulainen wrote: Henry Leyh writes: But now I would also like to be able to _write_ such a config file FILE that can be read in a later run. And FILE should contain only those arguments that were given on the command line. Say, I tell argparse to look for arguments -s|--sopt STRING, -i|--iopt INT, -b|--bopt [BOOL], -C CONFFILE. Then 'prog -s bla -i 42 -C cfile' should produce a confparser compatible cfile which contains [my_options] sopt = blah iopt = 42 and not 'bopt = False' (if False was the program's default for bopt). Could you instead write those options that differ from the defaults? You could parse an actual command line and an empty command line, and work out the difference. So 'prog -i 3' would not cause 'iopt = 3' to be written if 3 is the default for iopt, but would that be a problem? That's what the program does at the moment. However, I'm not quite happy with it. Generally, the user doesn't know what's the default and it would be confusing if 'prog -i 3' doesn't make 'iopt = 3' turn up in the file at the end. There may also be the case when the user (for whatever reason) _wants_ the default in the file. I think I will try the opposite instead: the program writes the whole set of options to the file. This would produce a complete and consistent configuration which automatically reflects the hierarchy in which the options were set. And the user can sort it out by hand if he wants. Regards, Henry -- http://mail.python.org/mailman/listinfo/python-list
executing python scripts that are symlinked
Hi. How can I say, from the cmd line, that python should take my CWD as my CWD, and not the directory where the script actually is? I have a python script that works fine when it sits in directory WC, but if I move it out of WC to H and put a symlink from H/script to WC, it doesn't find the packages that are in WC. Also, if I use the absolute path to H, it won't find them, but I guess I can understand that. Someone said on the net that python doesn't know whether a file is real or a symlink, but I think that somehow, python is able to find out where the real file is and treat that as its base of operations. Charles. -- http://www.creative-telcom-solutions.de -- http://mail.python.org/mailman/listinfo/python-list
EuroPython 2014/2015 Conference Team - Call for Proposals
The EuroPython Society (EPS) is happy to announce the Call for Proposals for the EuroPython Conference in 2014 and 2015. This Call for Proposals is meant to collect proposals from teams that volunteer for organizing the EuroPython conference in 2014-2015. The Call for Proposals document containing all the details and information about the proposals and selection process can be found here: https://docs.google.com/file/d/0B8YBdLoQM_6fbVpuM2ZWUGp3Slk/edit?usp=sharing If you are part of a great team organizing amazing Python events you could be the team organizing the next EuroPython! Please also forward this Call for Proposals to anyone that you feel may be interested. The Call for Proposals will run until Friday, June 14th. Proposals must be submitted to europython-cont...@python.org before that day, and must adhere the requirements specified in the CFP document. Regards, -- Marc-Andre Lemburg Director EuroPython Society http://www.europython.eu/ -- http://mail.python.org/mailman/listinfo/python-list
Re: executing python scripts that are symlinked
On 2013.05.16 02:48, Charles Smith wrote: > Hi. > > How can I say, from the cmd line, that python should take my CWD as my > CWD, and not the directory where the script actually is? > > > I have a python script that works fine when it sits in directory WC, > but if I move it out of WC to H and put a symlink from H/script to WC, > it doesn't find the packages that are in WC. Also, if I use the > absolute path to H, it won't find them, but I guess I can understand > that. Symlinks can find their targets, but targets have absolutely no way of knowing where symlinks to them are. It's one-way. It would work if the actual file were in WC and you created a symlink inside H. -- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: executing python scripts that are symlinked
On 05/16/2013 03:48 AM, Charles Smith wrote: Hi. How can I say, from the cmd line, that python should take my CWD as my CWD, and not the directory where the script actually is? I have a python script that works fine when it sits in directory WC, but if I move it out of WC to H and put a symlink from H/script to WC, it doesn't find the packages that are in WC. Also, if I use the absolute path to H, it won't find them, but I guess I can understand that. Someone said on the net that python doesn't know whether a file is real or a symlink, but I think that somehow, python is able to find out where the real file is and treat that as its base of operations. You'd really better specify your environment - exact OS and Python version. symlink and cwd usually imply a Unix-type system, but cmd is a Windows thing. Then give examples of what your cwd is, what string you're typing at the shell prompt, and what's happening. For example windows is good at changing cwd long before the executable gets control, in some situations. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: executing python scripts that are symlinked
On 16 Mai, 10:18, Dave Angel wrote: > On 05/16/2013 03:48 AM, Charles Smith wrote: > > > Hi. > > > How can I say, from the cmd line, that python should take my CWD as my > > CWD, and not the directory where the script actually is? > > > I have a python script that works fine when it sits in directory WC, > > but if I move it out of WC to H and put a symlink from H/script to WC, > > it doesn't find the packages that are in WC. Also, if I use the > > absolute path to H, it won't find them, but I guess I can understand > > that. > > > Someone said on the net that python doesn't know whether a file is > > real or a symlink, but I think that somehow, python is able to find > > out where the real file is and treat that as its base of operations. > > You'd really better specify your environment - exact OS and Python > version. symlink and cwd usually imply a Unix-type system, but cmd is a > Windows thing. > > Then give examples of what your cwd is, what string you're typing at the > shell prompt, and what's happening. Well, I'm on a ubuntu platform, running subversion, but I can't commit this debugging tool into the working copy where I'm using it, so I maintain it in my home directory. The tool does use production packages, though. So, if I say, $ python fapi-test.py and fapi-test.py really is there, then it works, using the codec production package. But if I use a symlink instead, it says Traceback (most recent call last): File "test2", line 1, in from codec.support import * ImportError: No module named codec.support Python tells me Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) -- http://www.creative-telcom-solutions.de -- http://mail.python.org/mailman/listinfo/python-list
Python C-API: how to define nested classes?
Hi, I'm currently writing a C extension module for python using the "raw" C-API. I would like to be able to define "nested classes" like in the following python code class A: class B: def __init__(self): self.i = 2 def __init__(self): self.b = A.B() a = A() b = A.B() print(a.b.i) print(b.i) How can I create such nested class with the C-API? Serge WEINSTOCK ___ This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is prohibited. Please refer to http://www.bnpparibas.co.uk/en/email-disclaimer/ for additional disclosures. -- http://mail.python.org/mailman/listinfo/python-list
Re: executing python scripts that are symlinked
On Thu, 16 May 2013 00:48:45 -0700, Charles Smith wrote: > Hi. > > How can I say, from the cmd line, that python should take my CWD as my > CWD, and not the directory where the script actually is? *scratches head* Python does use your current working directory as your current working directory. I think you are misdiagnosing the problem. Here's a demonstration: steve@runes:~$ cat test.py import os print os.getcwd() steve@runes:~$ ln -s ~/test.py /tmp/test steve@runes:~$ ls -l /tmp/test lrwxrwxrwx 1 steve steve 19 May 16 18:58 /tmp/test -> /home/steve/test.py steve@runes:~$ cd /etc/ steve@runes:/etc$ python /tmp/test /etc > I have a python script that works fine when it sits in directory WC, but > if I move it out of WC to H and put a symlink from H/script to WC, it > doesn't find the packages that are in WC. Also, if I use the absolute > path to H, it won't find them, but I guess I can understand that. The obvious solution is to make sure that WC is in the Python path. You can do that by adding it the environment variable PYTHONPATH, or by adding it to sys.path at the start of your script. I think you can also use a .pth file as well. Another solution may be to add this to the beginning of your script: os.setcwd('path/to/WC') but that's a crappy solution, you generally don't want to be changing the working directory from inside scripts if you can avoid it. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: executing python scripts that are symlinked
On 16 Mai, 11:04, Steven D'Aprano wrote: > Python does use your current working directory as your current working > directory. I think you are misdiagnosing the problem. That's usually how it ends up ... > > Here's a demonstration: > > steve@runes:~$ cat test.py > import os > print os.getcwd() > > steve@runes:~$ ln -s ~/test.py /tmp/test > steve@runes:~$ ls -l /tmp/test > lrwxrwxrwx 1 steve steve 19 May 16 18:58 /tmp/test -> /home/steve/test.py > steve@runes:~$ cd /etc/ > steve@runes:/etc$ python /tmp/test > /etc You're right. I can believe that python doesn't really change it's notion of the CWD. It seems like when I'm in WC and invoke ./script (which is symlinked to H/script), python says, "I have a specification somewhere that says I can look for modules where my script is, and since I'm really smart, I happen to know that I'm in WC but the script is not, but is really in H, where the stupid operator better have his packages set up" > > > I have a python script that works fine when it sits in directory WC, but > > if I move it out of WC to H and put a symlink from H/script to WC, it > > doesn't find the packages that are in WC. Also, if I use the absolute > > path to H, it won't find them, but I guess I can understand that. > > The obvious solution is to make sure that WC is in the Python path. ... > but that's a crappy solution, Right. Other tools don't try to figure out what I really want to do with a symlink, but just accept that it's a file. Python should do the same ... But, as you say, I'm surely misdiagnosing the problem. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 2.7.x - problem with obejct.__init__() not accepting *args and **kwargs
On 16 May 2013 03:06, Steven D'Aprano wrote: > On Wed, 15 May 2013 13:16:09 +0100, Oscar Benjamin wrote: > > >> I don't generally use super() > > Then you should, especially in Python 3. > > If you're not using super in single-inheritance classes, then you're > merely making your own code harder to read and write, and unnecessarily > difficult for others to use with multiple-inheritance. > > If you're not using super in multiple-inheritance[1] classes, then your > code is probably buggy. > > There really is no good reason to avoid super in Python 3. I should have been clearer. I don't generally use super() because I don't generally use Python in a very object-oriented way. My comment was intended as a qualification of my advice rather than a suggestion that there is something wrong with super(). I can certainly see how that would be misinterpreted given the article I linked to: >> but I did see some advice about it in this article: >> https://fuhm.net/super-harmful/ > > It's not a good article. The article started off claiming that super was > harmful, hence the URL. He's had to back-pedal, and *hard*. The problem > isn't that super is harmful, it is that the problem being solved -- > generalized multiple inheritance -- is inherently a fiendishly difficult > problem to solve. Using super and cooperative multiple inheritance makes > it a merely difficult but tractable problem. > > The above article is useful to see the sorts of issues that can come up > in multiple inheritance, and perhaps as an argument for avoiding MI > (except in the tamed versions provided by mixins or straits). But as an > argument against super? No. I read that article when I was trying to do something with multiple inheritance. It was helpful to me at that time as it explained why whatever I was trying to do (I don't remember) was never really going to work. > > A much better article about super is: > > http://rhettinger.wordpress.com/2011/05/26/super-considered-super/ This is a good article and I read it after Ian posted it. > > >> From the conclusion: >> "Never use positional arguments in __init__ or __new__. Always use >> keyword args, and always call them as keywords, and always pass all >> keywords on to super." > > Even that advice is wrong. See Super Considered Super above. Raymond's two suggestions for signature are: ''' One approach is to stick with a fixed signature using positional arguments. This works well with methods like __setitem__ which have a fixed signature of two arguments, a key and a value. This technique is shown in the LoggingDict example where __setitem__ has the same signature in both LoggingDict and dict. A more flexible approach is to have every method in the ancestor tree cooperatively designed to accept keyword arguments and a keyword-arguments dictionary, to remove any arguments that it needs, and to forward the remaining arguments using **kwds, eventually leaving the dictionary empty for the final call in the chain. ''' The first cannot be used with object.__init__ and the second is not what the OP wants. I think from the article that the appropriate suggestion is to do precisely what the OP has done and make everything a subclass of a root class that has the appropriate signature. Perhaps instead of calling it my_object it could have a meaningful name related to what the subclasses are actually for and then it wouldn't seem so much like a dirty trick. > [1] To be precise: one can write mixin classes without super, and > strictly speaking mixins are a form of multiple inheritance, but it is a > simplified version of multiple inheritance that avoids most of the > complications. They're also mostly the only kind of multiple inheritance that I would think of using. Oscar -- http://mail.python.org/mailman/listinfo/python-list
PyDev 2.7.4 Released
Hi All, PyDev 2.7.4 has been released Details on PyDev: http://pydev.org Details on its development: http://pydev.blogspot.com Release Highlights: --- * Improved Jython scripting startup time (so, the editor should start up faster). * PyDev no longer causing JSP problem annotation disappear (fix by Danny Ju). * Restored invalidateTextPresentation on save due to issue on annotations kept. * Thank you everyone for helping to keep PyDev going: http://pydev.blogspot.com.br/2013/05/pydev-crowdfunding-finished.html What is PyDev? --- PyDev is a plugin that enables users to use Eclipse for Python, Jython and IronPython development -- making Eclipse a first class Python IDE -- It comes with many goodies such as code completion, syntax highlighting, syntax analysis, refactor, debug and many others. Cheers, -- Fabio Zadrozny -- Software Developer PyDev - Python Development Environment for Eclipse http://pydev.org http://pydev.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Fwd: Fwd: Fwd: Python for philosophers
On May 16, 5:55 am, Citizen Kant wrote: > As a matter of > class, the word python names first a python snake than a Monty Python, > which is 50% inspired by that python word, word that's been being > considered the given name of a particular kind of snake since times in > which Terry Gilliam wasn't even alive. alex23 wrote: >> "Namespaces are one honking great idea -- let's do more of those!" Or >> to put it another way: context is important. >> I find it both funny and sad that you think the name of the language >> is preventing _others_ from seeing it as it is, when you're the only >> one who seems to be fixated upon it. Maybe would be good if I share with you guys some basics of scientific humor. As alex23 well pointed out, there's a kind of funny and sad behind this typical human reaction. There's a lot of science observing you as a plain humans, science has been being observing you for a long time, and science says that people tend to laugh_at when their intuition realizes that is in front of whatever phenomena that could undermine its thought foundations. Believe it or not, laughing_at is mostly a sign that one's afraid of losing his reason, a manifest sign of psychological fear. For example, being informed about that in a few hours an asteroid named X-21 will crash your planet destroying it would also first make you "react" neglecting it, then react with the typical smile_at the messenger, then if this given messenger insists you would normally tend to "overreact" and laugh_at the previously mentioned messenger, and all this will happen even if the information brought to you says the truth. Same happens if one's mom come one day and tells that the guy one always believed is his father is in fact not, that there's a real father of yours that will remain forever lost in the crowd with whom she once had an occasional sex intercourse inside the bathroom of a bar. Then first you'll smile_at her, then if she keeps on insisting with the funny/sad subject that alex23 well pointed out you'll eventually start overreacting and laugh_at her. At this point, only if she keeps on insisting with her truth until you're tired enough of overreacting because overreacting won't ever change the fact that the guy you (need to) believe is your biological father could keep on being whatever you please but not that, she can reach the goal of making you understand. I'm just an honest and polite guy asking you guys a couple of simple out of the box questions that are important for me. Everyone here has the freedom to keep on with their own assumptions and beliefs. If someone's interested on thinking outside the box with me for the sake of helping me, that would be great and highly appreciated. Thinking outside the box isn't just a cheap thing since it's highly creative. Take note that being able to think and write in English doesn't make you writers as, put, Faulkner. Same happens with any other language, same happens with Python. -- http://mail.python.org/mailman/listinfo/python-list
Re: Fwd: Fwd: Fwd: Python for philosophers
On May 16, 5:28 pm, Citizen Kant wrote: > > I'm just an honest and polite guy asking you guys a couple of simple out of > the box questions that are important for me. Everyone here has the freedom > to keep on with their own assumptions and beliefs. If someone's interested > on thinking outside the box with me for the sake of helping me, that would > be great and highly appreciated. Thinking outside the box isn't just a > cheap thing since it's highly creative. Take note that being able to think > and write in English doesn't make you writers as, put, Faulkner. Same > happens with any other language, same happens with Python. Let me quote your first post (OP): > I roughly came to the idea that Python could be considered as an *economic > mirror for data*, one that mainly *mirrors* the data the programmer types > on its black surface, not exactly as the programmer originally typed it, > but expressed in the most economic way possible. And let me suggest that you follow your own advise -- Can you say what you have to say in 1/10th the number of words? Ok if not 1/10th then 1/5th? 1-third? If you can, you are on the way to appreciating something which you almost came to and then lost in interminable prolixity, to wit: > The starting question I make to myself about Python is: > which is the single and most basic use of Python as the entity it is? IOW a programmer is one who quickly and easily comes to the nub/core/ kernel/essence of a problem and as easily and adroitly shaves off the irrelevant. Else: (you cant /wont reduce your prolixity) You are bullshitting us and we are being trolled by you -- http://mail.python.org/mailman/listinfo/python-list
Re: Fwd: Fwd: Fwd: Python for philosophers
On Thu, May 16, 2013 at 11:46 PM, rusi wrote: > IOW a programmer is one who quickly and easily comes to the nub/core/ > kernel/essence of a problem and as easily and adroitly shaves off the > irrelevant. +1. This is a fairly good description of a programmer's job. Of course, that's the theoretical and pure programmer... a professional programmer often has to: * Figure out what the problem *is* based on an incomplet description from an incompetent user via a bored telephone operator * Traverse a morass of bureaucratic requirements and politicking just to get the necessary hardware/software to do his work * Deal with the Layer Eight firewalling against the implementation of the solution he comes up with * Attend inane meetings with bikeshedding non-technical people who have some kind of authority over the project * Etcetera, etcetera, etcetera. But yeah, that's what a programmer is. :) ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: [Off topic] Software epigrams
On 2013-05-16, F?bio Santos wrote: >> If I want to bake bread I hope I don't have to till a garden, >> plant the wheat, harvest the wheat, and grind the wheat. But >> gardening is relevant to bread baking weather or not I do it. > > Then memory management t is relevant to every python program > even though it's done by the interpreter? Yes, I think so. If you didn't understand how Python managed memory, you couldn't write it effectively. You would end up making unecessary copies, and other pathological programming practices. > And in Java we have factories, builders and builderfactories. > What's so relevant about them? Java is high level, no? When I tried to pin down what an irrelevant detail in a computer program could be, I couldn't do it. I guess comment decorations, maybe? But those would have no bearing on the level of problem for which a programming language is most appropriate. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list
Re: Python for philosophers
Maybe the implementation of the Python Interpreter could be seen as transition function. This can be understand in detail, but it even if you know how the interpreter works, you don't really know to work _with_ the interpreter. Even more, there are a lot of decisions, which are made 'by design' and don't have a clear answer. to see why somethings are done in the way they are done you have to understand the philosophy of programming with python. bg, Johannes On 13.05.2013 02:34, Gregory Ewing wrote: Citizen Kant wrote: What I do here is to try to "understand". That's different from just knowing. Knowledge growth must be consequence of understanding's increasing. As the scope of my understanding increases, the more I look for increasing my knowledge. Never vice versa, because, knowing isn't like to be right, it's just knowing. It doesn't always work that way. With some facts plus a theory, you can deduce more facts. But it's always possible for there to be more facts that you can't deduce from what you already know. But take in account that with "shortening" I refer to "according to Python's axiomatic parameters". I think what you're trying to say is that it takes an expression and reduces it to a canonical form, such as a single number or single string. That's true as far as it goes, but it barely scratches the surface of what the Python interpreter is capable of doing. In the most general terms, the Python interpeter (or any other computer system, for that matter) can be thought of as something with an internal state, and a transition function that takes the state together with some input and produces another state together with some output: F(S1, I) --> (S2, O) (Computer scientists call this a "finite state machine", because there is a limited number of possible internal states -- the computer only has so much RAM, disk space, etc.) This seems to be what you're trying to get at with your game-of-chess analogy. What distinguishes one computer system from another is the transition function. The transition function of the Python interpreter is rather complicated, and it's unlikely that you would be able to figure out all its details just by poking in inputs and observing the outputs. If you really want to understand it, you're going to have to learn some facts, I'm sorry to say. :-) -- GLOBE Development GmbH Königsberger Strasse 260 48157 MünsterGLOBE Development GmbH Königsberger Strasse 260 48157 Münster 0251/5205 390 -- http://mail.python.org/mailman/listinfo/python-list
Re: Python for philosophers
On 2013-05-16, Tim Daneliuk wrote: > On 05/15/2013 08:01 PM, Ned Batchelder wrote: >> On 5/11/2013 4:03 PM, Citizen Kant wrote: >>> Don't get me wrong. I can see the big picture and the amazing things that >>> programmers write on Python, it's just that my question points to the >>> lowest level of it's existence. >> >> Sometimes a cigar is just a cigar. Python is a tool, it does what you tell >> it. To make an analogy, or maybe to clarify your philosophical view of the >> world, consider a hammer. What is the "lowest level of its existence"? >> >> --Ned. > > All You People are making this way too hard. To understand how > questions like the OPs ought be resolved, please read: > > http://pvspade.com/Sartre/cookbook.html Yea, I've decided we're being trolled... -- Grant Edwards grant.b.edwardsYow! I'd like MY data-base at JULIENNED and stir-fried! gmail.com -- http://mail.python.org/mailman/listinfo/python-list
Re: [Off topic] Software epigrams
On Fri, May 17, 2013 at 12:23 AM, Neil Cerutti wrote: > On 2013-05-16, F?bio Santos wrote: >> And in Java we have factories, builders and builderfactories. >> What's so relevant about them? Java is high level, no? > > When I tried to pin down what an irrelevant detail in a computer > program could be, I couldn't do it. I guess comment decorations, > maybe? But those would have no bearing on the level of problem > for which a programming language is most appropriate. Let me give you a real example. One of the programs I wrote at work is a simple daemon that runs on every node in a network. It periodically sends out a heartbeat signal that the other nodes hear, and if any node hasn't been heard from in X seconds, it is deemed "down". (It might technically not be down, if there's a network problem, but the point is that we don't care about the difference. It's down.) There's also some incidental statussy data included, for convenience. This is implemented using UDP. Do I care about how a UDP packet is structured? No. Do I care about the mechanics of IP routing? No. Do I care about MAC addresses? No. They might feature in our IPv6 addresses, but I still don't care - the IP addresses (v4 or v6) of the nodes are treated as opaque tokens. All I care about is that I call a function with a string of data and a corresponding function gets called in the other program with that same string. All the details of how that happens in between aren't important to my program. They're somewhat of note in the design phase, but not to the program itself. They are, in fact, irrelevant. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: executing python scripts that are symlinked
On 05/16/2013 04:29 AM, Charles Smith wrote: On 16 Mai, 10:18, Dave Angel wrote: On 05/16/2013 03:48 AM, Charles Smith wrote: Hi. How can I say, from the cmd line, that python should take my CWD as my CWD, and not the directory where the script actually is? I have a python script that works fine when it sits in directory WC, but if I move it out of WC to H and put a symlink from H/script to WC, it doesn't find the packages that are in WC. Also, if I use the absolute path to H, it won't find them, but I guess I can understand that. Someone said on the net that python doesn't know whether a file is real or a symlink, but I think that somehow, python is able to find out where the real file is and treat that as its base of operations. You'd really better specify your environment - exact OS and Python version. symlink and cwd usually imply a Unix-type system, but cmd is a Windows thing. Then give examples of what your cwd is, what string you're typing at the shell prompt, and what's happening. Well, I'm on a ubuntu platform, Good. Linux seldom gets in the way. running subversion, but I can't commit this debugging tool into the working copy where I'm using it, so I maintain it in my home directory. The tool does use production packages, though. So, if I say, $ python fapi-test.py and fapi-test.py really is there, where? Be explicit. When copying the python invocation line above, you never bothered to include the current directory that's generally displayed right in front of that $ prompt. then it works, using the codec production package. What codec production package. And where is it installed? And how do you intend that Python find it? But if I use a symlink instead, So you delete the pfapi-tst.py out of the current directory, and create instead a symlink in the current directory that points to its real location And without changing current directory, you run the same command and it runs till it gets to the import line, at which point it gives a traceback that has nothing to do with the file you're running??? The traceback thinks you're running test2.py. it says Traceback (most recent call last): File "test2", line 1, in from codec.support import * ImportError: No module named codec.support Python tells me Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) Take a look at Stephen's example. He runs some things, shows you exactly what he's running, and what happens. The things he runs may not match what you did, but we cannot tell. From within your script, you can display os.getcwd(), you can ... import sys, os print "cwd is", os.getcwd() print "file is", __file__ print "PATH is", os.getenv("PATH") print "python-path is", os.getenv("PYTHONPATH") print "sys.path is", sys.path import codec print "codec file is", codec.__file__ if you run that both as a regular file and on a symlink pointing to that file, comparing the two runs could give you a clue as to what's different. My suspicion is that you have a different cwd when you test it the second way. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
spilt question
I want to split a string so that I always return everything BEFORE the LAST underscore HELLO_.lst # should return HELLO HELLO_GOODBYE_.ls # should return HELLO_GOODBYE I have tried with rsplit but cannot get it to work. Any help appreciated -- http://mail.python.org/mailman/listinfo/python-list
Re: Software epigrams
On May 16, 7:37 pm, Chris Angelico wrote: > On Fri, May 17, 2013 at 12:23 AM, Neil Cerutti wrote: > > On 2013-05-16, F?bio Santos wrote: > >> And in Java we have factories, builders and builderfactories. > >> What's so relevant about them? Java is high level, no? > > > When I tried to pin down what an irrelevant detail in a computer > > program could be, I couldn't do it. I guess comment decorations, > > maybe? But those would have no bearing on the level of problem > > for which a programming language is most appropriate. > > Let me give you a real example. > > One of the programs I wrote at work is a simple daemon that runs on > every node in a network. It periodically sends out a heartbeat signal > that the other nodes hear, and if any node hasn't been heard from in X > seconds, it is deemed "down". (It might technically not be down, if > there's a network problem, but the point is that we don't care about > the difference. It's down.) There's also some incidental statussy data > included, for convenience. This is implemented using UDP. > > Do I care about how a UDP packet is structured? No. > > Do I care about the mechanics of IP routing? No. > > Do I care about MAC addresses? No. They might feature in our IPv6 > addresses, but I still don't care - the IP addresses (v4 or v6) of the > nodes are treated as opaque tokens. > > All I care about is that I call a function with a string of data and a > corresponding function gets called in the other program with that same > string. All the details of how that happens in between aren't > important to my program. They're somewhat of note in the design phase, > but not to the program itself. They are, in fact, irrelevant. > > ChrisA You are just saying (in specific detail) what I said, viz that the programmer is one who 'relevates' ie sifts the relevant from the irrelevant and a good programming language is one that gives good relevating tools: http://blog.languager.org/2013/02/c-in-education-and-software-engineering.html -- http://mail.python.org/mailman/listinfo/python-list
Re: spilt question
str.split takes a limit argument. Try your_string.split('_', 1) On 16 May 2013 16:11, "loial" wrote: > I want to split a string so that I always return everything BEFORE the > LAST underscore > > HELLO_.lst # should return HELLO > HELLO_GOODBYE_.ls # should return HELLO_GOODBYE > > I have tried with rsplit but cannot get it to work. > > Any help appreciated > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Re: Software epigrams
On Fri, May 17, 2013 at 1:06 AM, rusi wrote: > On May 16, 7:37 pm, Chris Angelico wrote: >> On Fri, May 17, 2013 at 12:23 AM, Neil Cerutti wrote: >> > When I tried to pin down what an irrelevant detail in a computer >> > program could be, I couldn't do it. I guess comment decorations, >> > maybe? But those would have no bearing on the level of problem >> > for which a programming language is most appropriate. >> >> Let me give you a real example. >> [snip] > > You are just saying (in specific detail) what I said, viz that the > programmer is one who 'relevates' ie sifts the relevant from the > irrelevant and a good programming language is one that gives good > relevating tools: > http://blog.languager.org/2013/02/c-in-education-and-software-engineering.html Right. All I'm adding is a concrete example - which, I think, will be helpful to Neil, and perhaps to others too. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: spilt question
On Thu, 16 May 2013 08:00:25 -0700, loial wrote: > I want to split a string so that I always return everything BEFORE the > LAST underscore > > HELLO_.lst # should return HELLO > HELLO_GOODBYE_.ls # should return HELLO_GOODBYE > > I have tried with rsplit but cannot get it to work. > mystr.rsplit("_",1)[0] -- http://mail.python.org/mailman/listinfo/python-list
Re: spilt question
On 05/16/2013 11:00 AM, loial wrote: I want to split a string so that I always return everything BEFORE the LAST underscore HELLO_.lst # should return HELLO HELLO_GOODBYE_.ls # should return HELLO_GOODBYE I have tried with rsplit but cannot get it to work. Any help appreciated The rsplit() method was a good idea; it will work. So exactly what did you try and what about it did not work. How are you stuck going from your partial answer to a complete one? While you're at it, you need to consider at least two more cases HELLO.txt#should return "" HELLO_and_goodbye#should return "HELLO_and" -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: spilt question
On Fri, May 17, 2013 at 1:00 AM, loial wrote: > I want to split a string so that I always return everything BEFORE the LAST > underscore > > HELLO_.lst # should return HELLO > HELLO_GOODBYE_.ls # should return HELLO_GOODBYE > > I have tried with rsplit but cannot get it to work. > > Any help appreciated Try with a limit: >>> "HELLO_GOODBYE_.ls".rsplit("_",1) ['HELLO_GOODBYE', '.ls'] >>> "HELLO_GOODBYE_.ls".rsplit("_",1)[0] 'HELLO_GOODBYE' You can easily get docs on it: >>> help("".rsplit) Help on built-in function rsplit: rsplit(...) S.rsplit(sep=None, maxsplit=-1) -> list of strings Return a list of the words in S, using sep as the delimiter string, starting at the end of the string and working to the front. If maxsplit is given, at most maxsplit splits are done. If sep is not specified, any whitespace string is a separator. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: spilt question
On 2013-05-16 08:00, loial wrote: > I want to split a string so that I always return everything BEFORE > the LAST underscore > > HELLO_.lst # should return HELLO > HELLO_GOODBYE_.ls # should return HELLO_GOODBYE > > I have tried with rsplit but cannot get it to work. .rsplit takes an optional "how many splits do you want?" parameter that defaults to giving you all of them. Just ask for one right-most split: TESTS = [ ("HELLO_xxx.lst", "HELLO"), ("HELLO_GOODBYE_x.ls", "HELLO_GOODBYE"), ] for input, expected in TESTS: result = input.rsplit('_', 1)[0] if result == expected: verdict = "passed" else: verdict = "failed" print "%r -> %r == %r (%s)" % ( input, result, expected, verdict, ) -tkc -- http://mail.python.org/mailman/listinfo/python-list
Re: spilt question
On 5/16/2013 11:00 AM, loial wrote: I want to split a string so that I always return everything BEFORE the LAST underscore HELLO_.lst # should return HELLO HELLO_GOODBYE_.ls # should return HELLO_GOODBYE I have tried with rsplit but cannot get it to work. Any help appreciated >>> "HELLO_GOODBYE_.ls".rpartition('_') ('HELLO_GOODBYE', '_', '.ls') >>> "HELLO_GOODBYE_.ls".rsplit('_', 1) ['HELLO_GOODBYE', '.ls'] >>> "HELLO_GOODBYE_.ls".rpartition('_')[0] 'HELLO_GOODBYE' >>> "HELLO_GOODBYE_.ls".rsplit('_', 1)[0] 'HELLO_GOODBYE' For the future, getting help works better if you show what you tried, and what it produced. --Ned. -- http://mail.python.org/mailman/listinfo/python-list
Re: spilt question
On 05/16/2013 11:15 AM, Chris Angelico wrote: On Fri, May 17, 2013 at 1:00 AM, loial wrote: I want to split a string so that I always return everything BEFORE the LAST underscore HELLO_.lst # should return HELLO HELLO_GOODBYE_.ls # should return HELLO_GOODBYE I have tried with rsplit but cannot get it to work. Any help appreciated Try with a limit: "HELLO_GOODBYE_.ls".rsplit("_",1) ['HELLO_GOODBYE', '.ls'] "HELLO_GOODBYE_.ls".rsplit("_",1)[0] 'HELLO_GOODBYE' You can easily get docs on it: help("".rsplit) Help on built-in function rsplit: rsplit(...) S.rsplit(sep=None, maxsplit=-1) -> list of strings Return a list of the words in S, using sep as the delimiter string, starting at the end of the string and working to the front. If maxsplit is given, at most maxsplit splits are done. If sep is not specified, any whitespace string is a separator. ChrisA Now that you've all done his homework for him, see if The OP can spot the one case where that won't work. It's easy to test for, but still important to get right (for some definition of right). -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Fractal
On Thu, May 16, 2013 at 5:04 AM, Sharon COUKA wrote: > I have to write the script, and i have one but the zoom does not work That doesn't answer my question. Perhaps if you would share with us what you already have, then we could point out what you need to do and where to get your "zoom" working. -- http://mail.python.org/mailman/listinfo/python-list
Re: python 2.7 vs 2.5
- Original Message - >I am using python 2.7 to write > the cgi file and my web server is using python 2.5. The answer lies in your question. JM -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: Fractal
On Thu, May 16, 2013 at 10:55 AM, Sharon COUKA wrote: > # Register events > c.bind('i', zoom) > c.bind('i', unzoom) > c.bind('i', mouseMove) I'm not an expert at Tkinter so maybe one of the other residents can help you better with that. The code above looks wrong to me, though. As far as I know, 'i' is not a valid event sequence in Tkinter, and besides you probably want to bind these functions to three *different* events. See here for the docs on event sequences: http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/event-sequences.html Based on your code, it looks like you would probably want something like: c.bind('', zoom) c.bind('', unzoom) c.bind('', mouseMove) -- http://mail.python.org/mailman/listinfo/python-list
Re: Python for philosophers
On 05/16/2013 09:27 AM, Grant Edwards wrote: On 2013-05-16, Tim Daneliuk wrote: On 05/15/2013 08:01 PM, Ned Batchelder wrote: On 5/11/2013 4:03 PM, Citizen Kant wrote: Don't get me wrong. I can see the big picture and the amazing things that programmers write on Python, it's just that my question points to the lowest level of it's existence. Sometimes a cigar is just a cigar. Python is a tool, it does what you tell it. To make an analogy, or maybe to clarify your philosophical view of the world, consider a hammer. What is the "lowest level of its existence"? --Ned. All You People are making this way too hard. To understand how questions like the OPs ought be resolved, please read: http://pvspade.com/Sartre/cookbook.html Yea, I've decided we're being trolled... " I want to create an omelet that expresses the meaninglessness of existence, and instead they taste like cheese. " -- Tim Daneliuk tun...@tundraware.com PGP Key: http://www.tundraware.com/PGP/ -- http://mail.python.org/mailman/listinfo/python-list
wil anyone ressurect medusa and pypersist?
www.prevayler.org in python = pypersist medusa = python epoll web server and ftp server eventy and async -- http://mail.python.org/mailman/listinfo/python-list
so if zodb has no index or search, how run fast query?
how? and what package provides such? -- http://mail.python.org/mailman/listinfo/python-list
any cherypy powred sites I can check out?
anyone? -- http://mail.python.org/mailman/listinfo/python-list
Number of cells, using CSV module
I'm using the csv module to get information from a csv file. I have items listed in Column A. I want to know how many items are listed in Column A. import csv with open('test.csv', 'r') as f: reader = csv.reader(f) for column in reader: column = (column[0]) print(column) We are given >a >b >c >d >e >f How would I go about getting the amount of numbers that are printed? If I try printing len(column), I get >1 >1 >1 >1 >1 >1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Number of cells, using CSV module
Perhaps you want len(reader) instead? Or a counter which increments for every row read which has an item in column A? Skip -- http://mail.python.org/mailman/listinfo/python-list
Re: any cherypy powred sites I can check out?
On Fri, May 17, 2013 at 4:17 AM, wrote: > anyone? > -- > http://mail.python.org/mailman/listinfo/python-list You're firing off a bunch of minimal-content threads that ask other people to do work for you. I recommend you put a bit more thought into your posts, and show that you're willing to do a basic web search before you just ask a question :) Have a read of this: http://www.catb.org/esr/faqs/smart-questions.html ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Number of cells, using CSV module
On Thursday, May 16, 2013 2:40:08 PM UTC-4, Skip Montanaro wrote: > Perhaps you want len(reader) instead? Or a counter which increments for > every row read which has an item in column A? > > > > Skip len(reader) gives me an error. I tried a counter, but unfortunately due to the simplicity of CSV files, any formulas are not saved. -- http://mail.python.org/mailman/listinfo/python-list
Re: Number of cells, using CSV module
I guess another way to accomplish this would be, is there any way that I can turn the returned value for (column) into 1 list? So rather than >a >b >c >d >e >f I would get [a, b, c, d, e, f] -- http://mail.python.org/mailman/listinfo/python-list
Re: Number of cells, using CSV module
> len(reader) gives me an error. Apologies. len(list(reader)) should work. Of course, you'll wind up loading the entire CSV file into memory. You might want to just count row-by-row: n = 0 for row in reader: n += 1 Skip -- http://mail.python.org/mailman/listinfo/python-list
Re: Number of cells, using CSV module
> So rather than >>a >>b >>c >>d >>e >>f > I would get [a, b, c, d, e, f] all_items = [] for row in reader: all_items.append(row[0]) Skip -- http://mail.python.org/mailman/listinfo/python-list
Re: any cherypy powred sites I can check out?
On Thu, 16 May 2013 11:17:37 -0700, visphatesjava wrote: > anyone? Questions asked in that fashion stand little chance of eliciting helpful responses. -- http://mail.python.org/mailman/listinfo/python-list
Re: any cherypy powred sites I can check out?
On Thu, May 16, 2013 at 1:17 PM, wrote: > anyone? Perhaps asking this question (or a more precise one) on a CherryPy mailing list would elicit more (helpful) responses. If you just repeat the above though, I'm afraid most of the answers will just be, "yes." Hint: Read through this before asking the CherryPy folks for help: http://www.catb.org/esr/faqs/smart-questions.html Skip -- http://mail.python.org/mailman/listinfo/python-list
Re: Number of cells, using CSV module
On 2013-05-16 14:07, Skip Montanaro wrote: > > len(reader) gives me an error. > > Apologies. len(list(reader)) should work. Of course, you'll wind > up loading the entire CSV file into memory. You might want to just > count row-by-row: > > n = 0 > for row in reader: > n += 1 which can nicely be rewritten as n = sum(1 for row in reader) :-) -tkc -- http://mail.python.org/mailman/listinfo/python-list
Re: Number of cells, using CSV module
On 2013-05-16 14:08, Skip Montanaro wrote: > > So rather than > >>a > >>b > >>c > >>d > >>e > >>f > > I would get [a, b, c, d, e, f] > > all_items = [] > for row in reader: > all_items.append(row[0]) And following up here, this could be tidily rewritten as all_items = [row[0] for row in reader] -tkc -- http://mail.python.org/mailman/listinfo/python-list
How to use relative Import
Hello Python developers I want to know how relative imports are different than import. I have found lots of examples on internet explaining about the relative import but I want to know about the basic aspects of relative import that make it different than import. *Regards * *Chitrank Dixit * *IIPS-DAVV * *Indore (M.P.) , India * *MCA * *trackleech.blogspot.in* -- http://mail.python.org/mailman/listinfo/python-list
Re: Number of cells, using CSV module
Thank you Skip, worked great. And thank you Tim for Tidying things up! -- http://mail.python.org/mailman/listinfo/python-list
Re: Python C-API: how to define nested classes?
Serge WEINSTOCK於 2013年5月16日星期四UTC+8下午4時55分07秒寫道: > Hi, > > > > I'm currently writing a C extension module for python using the "raw" C-API. > I would like to be able to define "nested classes" like in the following > python code > > > > > > class A: > > class B: > > def __init__(self): > > self.i = 2 > > def __init__(self): > > self.b = A.B() > > a = A() > > b = A.B() > > print(a.b.i) > > print(b.i) > > > > > > How can I create such nested class with the C-API? > > > > Serge WEINSTOCK > > > > > > > ___ > > This e-mail may contain confidential and/or privileged information. If you > are not the intended recipient (or have received this e-mail in error) please > notify the sender immediately and delete this e-mail. Any unauthorised > copying, disclosure or distribution of the material in this e-mail is > prohibited. > > > Please refer to http://www.bnpparibas.co.uk/en/email-disclaimer/ for > additional disclosures. The nested class is just defining the scope of the nested class object that can be used solely in all outer proper classes. It is not very useful in a language which supports dynamical run-time attribute binding in the instance level. in the outer -- http://mail.python.org/mailman/listinfo/python-list
Re: python 2.7 vs 2.5
On Thursday, May 16, 2013 07:17:57 PM Jean-Michel Pichavant wrote: > - Original Message - > > >I am using python 2.7 to write > > > > the cgi file and my web server is using python 2.5. > > The answer lies in your question. > > JM > I appreciate the response, However, My question was wrong. The traceback I got couldn't be because of a difference in versions because I programmed the cgi on the site. I found that the path to the cgi had to be complete, something like this: /home/users/web/xxx/yyy.inqvista/public_html/home/read/mail anything else gets a traceback. jd -- http://mail.python.org/mailman/listinfo/python-list
Re: How to use relative Import
On Fri, 17 May 2013 01:35:49 +0530, Chitrank Dixit wrote: > I want to know how relative imports are different than import. I have > found lots of examples on internet explaining about the relative import > but I want to know about the basic aspects of relative import that make > it different than import. Relative imports search the directory containing the current package, absolute imports search the entire contents of sys.path. That is the only difference. The purpose of relative imports is to make it easy for modules inside a package to import each other without worrying about other modules *outside* the package being imported by mistake. You can read the PEP here: http://www.python.org/dev/peps/pep-0328/ to learn about the motivation for absolute and relative imports. Optional in Python 2.5 and 2.6, and compulsory in 2.7, when you write: import moduleX Python looks at sys.path for a list of directories to search for "moduleX.py". This is an absolute import. But consider a package with this structure: package/ +-- __init__.py +-- moduleA.py +-- moduleB.py +-- moduleX.py +-- subpackage/ +-- __init__.py +-- moduleY.py +-- moduleZ.py Inside moduleA, if you write "import moduleX" it will be an absolute import, the entire sys.path will be searched, and the "top level" module.X will be found. But if you write this instead: from . import moduleX you have a relative import, and Python will only search the current package directory, so it will find the moduleX inside the package. You can also write: from .subpackage import moduleZ to find the moduleZ inside the subpackage, again without searching the entire sys.path. Inside moduleY in the subpackage, all of these will find the same moduleZ: # Relative to the current module: from . import moduleZ # Relative to the parent of the current module: from ..subpackage import moduleZ from .. import subpackage.moduleZ # Absolute: import package.subpackage.moduleZ -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: any cherypy powred sites I can check out?
is a cherrypy list accessible here on web thru google groups? -- http://mail.python.org/mailman/listinfo/python-list
Re: any cherypy powred sites I can check out?
fuck straight off -- http://mail.python.org/mailman/listinfo/python-list
Re: so if zodb has no index or search, how run fast query?
On May 17, 4:14 am, visphatesj...@gmail.com wrote: > how? > > and what package provides such? https://pypi.python.org/pypi/zope.index https://pypi.python.org/pypi/zope.app.catalog I can see how those would be pretty difficult to find... -- http://mail.python.org/mailman/listinfo/python-list
Re: any cherypy powred sites I can check out?
On May 17, 10:00 am, visphatesj...@gmail.com wrote: > is a cherrypy list accessible here on web thru google groups? Is an apology for your offensive response to Chris Angelico forthcoming? -- http://mail.python.org/mailman/listinfo/python-list
How to write fast into a file in python?
I need to write numbers into a file upto 50mb and it should be fast can any one help me how to do that? i had written the following code.. --- def create_file_numbers_old(filename, size): start = time.clock() value = 0 with open(filename, "w") as f: while f.tell()< size: f.write("{0}\n".format(value)) value += 1 end = time.clock() print "time taken to write a file of size", size, " is ", (end -start), "seconds \n" -- it takes about 20sec i need 5 to 10 times less than that. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to write fast into a file in python?
On Thu, 16 May 2013 20:20:26 -0700, lokeshkoppaka wrote: > I need to write numbers into a file upto 50mb and it should be fast can > any one help me how to do that? > i had written the following code.. > -- > def create_file_numbers_old(filename, size): start = time.clock() > > value = 0 > with open(filename, "w") as f: > while f.tell()< size: > f.write("{0}\n".format(value)) > value += 1 > > end = time.clock() > > print "time taken to write a file of size", size, " is ", (end -start), > "seconds \n" > > it takes about 20sec i need 5 to 10 times less than that. 20 seconds to write how many numbers? If you are doing create_file_numbers_old(filename, 5) then 20 seconds is really slow. But if you are doing: create_file_numbers_old(filename, 50) then 20 seconds is amazingly fast. Try this instead, it may be a little faster: def create_file_numbers_old(filename, size): count = value = 0 with open(filename, 'w') as f: while count < size: s = '%d\n' % value f.write(s) count += len(s) value += 1 If this is still too slow, you can try three other tactics: 1) pre-calculate the largest integer that will fit in `size` bytes, then use a for-loop instead of a while loop: maxn = calculation(...) with open(filename, 'w') as f: for i in xrange(maxn): f.write('%d\n' % i) 2) Write an extension module in C that writes to the file. 3) Get a faster hard drive, and avoid writing over a network. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: How to write fast into a file in python?
On Friday, May 17, 2013 8:50:26 AM UTC+5:30, lokesh...@gmail.com wrote: > I need to write numbers into a file upto 50mb and it should be fast > > can any one help me how to do that? > > i had written the following code.. > > --- > > def create_file_numbers_old(filename, size): > > start = time.clock() > > > > value = 0 > > with open(filename, "w") as f: > > while f.tell()< size: > > f.write("{0}\n".format(value)) > > value += 1 > > > > end = time.clock() > > > > print "time taken to write a file of size", size, " is ", (end -start), > "seconds \n" > > -- > > it takes about 20sec i need 5 to 10 times less than that. size = 50mb -- http://mail.python.org/mailman/listinfo/python-list
Re: Python C-API: how to define nested classes?
Serge WEINSTOCK, 16.05.2013 10:55: > I'm currently writing a C extension module for python using the "raw" C-API. > I would like to be able to define "nested classes" like in the following > python code > > > class A: > class B: > def __init__(self): > self.i = 2 > def __init__(self): > self.b = A.B() > a = A() > b = A.B() > print(a.b.i) > print(b.i) > > > How can I create such nested class with the C-API? Assuming you really mean Python classes and not extension types, you might get away with defining them separately and then assigning A.B = B Recent Python versions added a __qualname__ attribute for classes that you might want to fix up in this case. If you need better compatibility, consider writing your code in Cython. Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: Fwd: Fwd: Python for philosophers
On Thursday, May 16, 2013 5:28:11 AM UTC-7, Citizen Kant wrote: > On May 16, 5:55 am, Citizen Kant wrote: > If someone's interested on thinking outside the box with me for the sake of helping me, that would be great and highly appreciated. Sorry, but you're asking for more than just thinking outside the box. What you want would seem to require thinking from within the bottle. -- http://mail.python.org/mailman/listinfo/python-list
Re: so if zodb has no index or search, how run fast query?
visphatesj...@gmail.com writes: > ... The only service of the ZODB is storing (persistent) objects persistently and providing (almost) transparent acces to them. Persistent objects have a (usually) implicitely managed attribute which contains the object's "object id" and the ZODB can (quite) efficiently access the objects based on its "object id" (it is using caches and indexes for this). The objects managed by the ZODB form a (directed) graph with a distinguished root node - where all nodes are (persistent) Python objects. You essentially work with those persistent objects as with normal Python objects: the ZODB transparently accesses the persistent storage, when necessary, to give you the feeling as if those objects were normal Python objects. There are a few caveats with respect to modifications - but most modifications work as you would expect for "normal" Python objects (however, you must call "transaction.commit()", in order to persist the modifications). That is essentially all, the ZODB does for you. When you need searches, you must use appropriate datatypes -- in the same way, you would need to do this in a "normal" Python program. The ZODB comes with a collection of datatypes (so called "BTrees") which may form the base for searches. "BTrees" are essentially persistent dicts - however, they are not build from a fixed number of persistent subobjects but the persistent substructure is changed automatically to accommodate efficiently for various tree sizes. Someone else has already mentioned some higher level packages which can provide search capabilities. -- http://mail.python.org/mailman/listinfo/python-list