On Mar 28, 3:33 am, "Gabriel Genellina"
wrote:
> En Thu, 26 Mar 2009 12:20:17 -0300, Scott David Daniels
> escribió:
>
> > (2) Why, oh why, do people feel so comforted adding double_underscores
> > to data structures?
Probably because other authors feel too comfortable using single
unders
On the one hand, I can 110% see why you want to reduce boilerplate
code and provide a discoverable, common mechanism for automating the
two and three-quarters parsers that a lot of applications have to
write to handle a config file, CLI, and/or registry values, but why
introduce a syntax for it? A
1) How random is random enough? Some PRNGs are very fast, and some are
very random, but theres always a compromise.
2) How closely related can the files be? It would be easy to generate
1GB of pseudorandom numbers, then just append UUIDs to them
3) Unique filenames can be generated with tmpnam
--
> I just mean that there should be a
> clear and easy way to do it, that it should be considered a basic
> service, and that if the best way to satisfy all the goals is to
> integrate it directly into the language, that shouldn't be shied away
> from.
Honestly, the programming language and the con
> But how do I get a usable reference from the id value?
> For example, if "foo" has a method "bar()", how can I call "foo.bar()"
> from "str(id(foo))" (say, 149466208).
can you just use a weakref instead? It is certainly cleaner than
trying to store id's,
since an id is only guaranteed to be uniq
> You could create a dict with the string as the key and the object as the
> value.
This will create a strong reference to the object, which is (I'm
assuming) undesired behavior.
--
http://mail.python.org/mailman/listinfo/python-list
> I don't know what is the best:
> * using an additional dict and maintaining it
It works, but as you say, is somewhat inelegant.
> * or using the "di" module proposed by CTO
Let me be clear: I am not proposing that you use it. It *does* do what
you
ask- but what y
Correction: the UserString will be dead on the final line. When I
typed
it in I had a strong reference still hanging around.
--
http://mail.python.org/mailman/listinfo/python-list
how about sympy? http://code.google.com/p/sympy/
--
http://mail.python.org/mailman/listinfo/python-list
I'm writing a Python graph library (called Graphine) that's
pretty easy to use and does what you want. It is pre-alpha
right now, but if you're interested please let me know- I'm
very interested in hearing outside opinions.
--
http://mail.python.org/mailman/listinfo/python-list
At the risk of self-promotion, you may want to try this recipe . Then just do
the following:
>>> @C_function("/home/luca/Desktop/luca/progetti_eric/Pico/libusbtc08-1.7.2/src/.libs/libusbtc08.so")
... def usb_tc08_get_single(handle: "c_short", temp: "*c_float",
overflow_flags: "*c_short", units: "
I'd add http://diveintopython.org/ to that list as you gain more
experience with Python, or if you already know at least one language.
--
http://mail.python.org/mailman/listinfo/python-list
Make doNothing a classmethod.
class SomeClass:
@classmethod
def doNothing(cls):
pass
def function1(self):
print "Running function 1"
def function2(self, passedFunction=SomeClass.doNothing):
print "Running passed function"
passedFunction()
someObj
Not OP, but I'd actually like to know if there's an answer to this one
that doesn't involve platform-specific tools.
--
http://mail.python.org/mailman/listinfo/python-list
> Careful, bearophiles' answer remains the best one.
>
> The only reason your example worked is that you had already had
> SomeClass defined (probably from a previous experiment).
Scott is correct, and if bearophile and I ever give you conflicting
advice, take bearophile's.
A (corrected) bit of c
> sys.getsizeof() [a suggested solution] isn't platform-specific.
So, to answer the OP's question, you'd just do something like
def get_totalsize(obj):
total_size = sys.getsizeof(obj)
for value in vars(obj).values():
try: total_size += get_total_size(value)
ctypes.byref()
--
http://mail.python.org/mailman/listinfo/python-list
> > PS) The asizeof(obj) function from this recipe > code.activestate.com/recipes/546530> does size the object plus its
> > references, recursively.
>
> Correction, the last sentence should be: The asizeof(obj) ... plus its
> referents, recursively.
I will admit, I have *no idea* what that code i
On May 2, 10:13 pm, Ross wrote:
> I'm trying to set up a simple filter using a list comprehension. If I
> have a list of tuples, a = [(1,2), (3,4), (5,None), (6,7), (8, None)]
> and I wanted to filter out all tuples containing None, I would like to
> get the new list b = [(1,2), (3,4),(6,7)].
try
On Sat, May 2, 2009 at 9:41 PM, Soumen banerjee
wrote:
Hello,
I was trying to find a method to make global hotkeys with python
in
linux. I found this one which uses a library called python-xlib.
The
point is that since i dont have much experience with this, i cant
understand s
> File "/usr/lib/python2.6/email/message.py", line 790, in Message
> from email.Iterators import walk
Well, the module is called email.iterators (rather than
email.Iterators),
for starters. It looks like __all__ exports both names (which seems a
little dodgy to me, but hey, y'all are the exp
Alright, it's pretty obvious that I have a lot to learn before I'll be
able
to intelligently address this problem, but if somebody could point me
at
something that would help me figure out the terminology at least I'd
really
appreciate it. From what you're saying, it sounds like a combination
of th
Probably better just to check HEAD and see if its updated within the
time you're
looking at before any unpack. Even on a 56k that's going to be pretty
fast, and
you don't risk unpacking an old file while a new version is on the
way.
If you still want to be able to unpack the old file if there's an
> In addition, the zip file format stores the directory at the end of the
> file. So you can't process it until it's completely downloaded.
> Concurrency doesn't help here.
Don't think that's relevant, if I'm understanding the OP correctly.
Lets say you've downloaded the file once and you're d
> Which brings us backs to the "20 questions"-part of my earlier post. It
> could be, but it could also be that processing takes seconds. Or it takes
> so long that even concurrency won't help. Who knows?
Probably the OP ;)
Geremy Condra
--
http://mail.python.org/mailman/listinfo/python-list
On May 4, 7:51 pm, Emile van Sebille wrote:
> On 5/4/2009 4:30 PM Amber said...
>
>
>
>
>
> > My PHB is insane.
>
> > Today he drops 50,000 databases in MS Access format on my desk, and
> > tells me that by Friday I need to:
> > * Remove all of the "junk content" in the record fields;
> > * Remove
On May 4, 10:30 pm, Soumen banerjee wrote:
> Hello,
> I had used python on windows and one of the features i liked best was
> that you could start a module-docs server and then use firefox to
> access it.
pydoc -p
--
http://mail.python.org/mailman/listinfo/python-list
On May 5, 2:00 am, Joel Juvenal Rivera Rivera
wrote:
> I want to make something very similar to the command tail -f (follow a
> file), i have been trying with some while True and some microsleeps
> (about .1 s); did someone has already done something like this?
>
> And about the file is the apac
On May 5, 2:08 am, Steven D'Aprano
wrote:
> On Mon, 04 May 2009 17:54:50 -0400, Terry Reedy wrote:
> > bearophileh...@lycos.com wrote:
>
> >> Another possible syntax:
>
> >> def fact(n):
> >> return 1 if n <= 1 else n * return(n - 1)
>
> >> But I guess most people don't see this problem as imp
> root.change_attributes(event_mask = X.KeyPressMask)
This asks X to send this application keypress events
> root.grab_key(keycode, X.AnyModifier, 1,X.GrabModeAsync, X.GrabModeAsync)
This tells X to grab the keyboard if the given keycode is generated
and
any modifier is pressed, not to stop proc
On May 5, 2:30 pm, Gökhan SEVER wrote:
> Hi,
>
> Even though I don't know what your project does, you will need to use
> "Sphinx" to create semi-automatic documentation out of your project.
>
> I would recommend you to take a look a quality "free" Python module:
> Matplotlib (http://matplotlib.sou
On May 7, 9:12 am, Scott David Daniels wrote:
> Daniel Fetchinson wrote:
> >> Other features include an ordered dictionary implementation
>
> > Are there plans for backporting this to python 2.x just as
> > multiprocessing has been?
>
> Why not grab the 3.1 code and do it yourself for your 2.X's?
On May 8, 2:04 pm, Filip Gruszczyński wrote:
> Hi!
>
> I need to create a script, that performs ECG segmentation, but I can
> hardly find any useful materials on the web. Did anyone try to do this
> and could point me to some good materials/snippets about this?
>
> --
> Filip Gruszczyński
How are
On May 13, 12:10 am, godshorse wrote:
> Hello,
>
> I want to find out the shortest path tree from a root to several nodes
> in a graph data structure. I found a Dijkstra code from internet that
> finds shortest path between only two nodes. How can i extend it to a
> tree?. And what is the best way
> But let me clear the my problem again. I have a graph. and I want to
> find 'shortest path tree' from a root node to several nodes. as a
> example if we have a graph of 5 nodes from 1 to 5, I need to build the
> shortest path tree from node 1 to nodes 2,3,5. So my question is
> instead of keeping
On May 13, 8:19 am, bearophileh...@lycos.com wrote:
> godshorse, you may use the "shortestPaths" method of this graph class
> of mine:http://sourceforge.net/projects/pynetwork/
>
> (It uses the same Dijkstra code by Eppstein).
> (Once you have all distances from a node to the other ones, it's not
>
On May 13, 1:26 pm, "J. Cliff Dyer" wrote:
> On Wed, 2009-05-13 at 09:40 -0700, Mohan Parthasarathy wrote:
> > Hi,
>
> > I am new to Python. I tried searching this but could not find an
> > answer. In the interactive shell, I write a new function and I want to
> > be able to see all the code that
On May 14, 7:01 pm, TomF wrote:
> I'm looking for a medium-sized Python system with very good coding
> style and good code organization, so I can learn from it. I'm reading
> various books on Python with advice on such things but I'd prefer to
> see a real system.
>
> By medium-sized I mean 5-20
> Ah! I should have been careful before asking such "general" question about
> performance. I agree with you. But mine was more academic. I should not given
> a specific example.
>
> AFAIK, for java on the client side, JVM performance is one of the critical
> things which has been tuned to death
On May 26, 12:47 am, oyster wrote:
> I want to extract some pages from vary pdf files, then write them
> with/witout rotation into one new pdf file. something likes this
> [py]
> import gfx
> doc = gfx.open("pdf", r"Theory.pdf")
> pdf = gfx.PDF()
> for pagenr in [1,5,7]:
> page = doc.getPage(p
On May 26, 3:23 am, Lawrence D'Oliveiro wrote:
> In message , Steven
>
> D'Aprano wrote:
> > On Tue, 26 May 2009 18:31:56 +1200, Lawrence D'Oliveiro wrote:
>
> >> In message >> b201-4b2445732...@v35g2000pro.googlegroups.com>, LittleGrasshopper
> >> wrote:
>
> >>> ... I am looking for suitable syn
On May 25, 11:05 pm, thushiantha...@gmail.com wrote:
> Hi everyone,
>
> I am planning to develop a chatting software in Python, for my college
> project. I am using Windows Vista. Is it possible to do sockets
> programming in Python ? Any books or websites ? Also, i want to
> develop a gui for tha
On May 26, 2:12 pm, lone_eagle wrote:
> Hi all,
>
> On Linux, I do something like this
>
> $ program_to_execute < input_file
> ... get some output ...
>
> I have the content of the input_file as a string inside a python
> program and would like to pass this string to the external program
> from in
On May 28, 1:53 pm, Aaron Brady wrote:
> On May 27, 11:07 pm, Steven D'Aprano
> cybersource.com.au> wrote:
> > On Wed, 27 May 2009 12:58:02 +, Albert van der Horst wrote:
>
> > >>And how is reduce() supposed to know whether or not some arbitrary
> > >>function is commutative?
>
> > > Why woul
On May 30, 4:12 am, Ken Seehart wrote:
> A couple years ago I stumbled upon an interesting technology but I can't
> seem to find it, and I can remember what it is called. Unfortunately
> this makes it difficult to search for. I am am aware of several partial
> matches (items that meet a subset o
On May 30, 8:49 pm, John Machin wrote:
> > import time
> You are in a maze of twisty little functions, all alike.
Quote of the week. Perhaps the year. I hope you don't mind
me using it in the future.
Geremy Condra
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 27, 5:36 am, Steven D'Aprano wrote:
> I'm pretty sure the answer to this is No, but I thought I'd ask just in
> case...
>
> Is there a fast way to see that a dict has been modified? I don't care
> what the modifications are, I just want to know if it has been changed,
> where "changed" mean
On Sep 28, 1:11 am, Steven D'Aprano
wrote:
> On Sun, 27 Sep 2009 21:42:10 -0700, CTO wrote:
> >> Is there a fast way to see that a dict has been modified?
>
> ...
>
> > d = {"a": "b", "c": "d"}
> > d2 = d.copy()
&g
On Jun 9, 11:58 pm, William Clifford
wrote:
> I've become interested in basic graphs and networks and I'm wondering
> about what algorithms are there for generating basic regular graphs
> like the simplex graph or dodecahedron graph, etc (I'm sure there are
> many). I'm particularly keen on unders
On Jun 26, 1:29 am, Tom Reed wrote:
> Whynotrees in the standard library, if not as a built in? I searched
> the archive but couldn't find a relevant discussion. Seems like a
> glaring omission considering the batteries included philosophy,
> particularly balanced binary search trees.Nointerest,no
On Sep 12, 4:39 pm, Peng Yu wrote:
> Hi,
>
> I have see some discussion on the implementation of finite state
> machine in python. Can somebody point to me the best way in implenting
> an FSM in python?
>
> http://code.activestate.com/recipes/146262/
>
> Regards,
> Peng
I wrote an example of how
51 matches
Mail list logo