Archives and magic bytes

2005-03-23 Thread andrea
, I'm still a python novice (but it's a great language) Andrea -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie help

2005-03-23 Thread andrea
[EMAIL PROTECTED] wrote: I want to pass and index number and a file name from the command line. This index number corresponds to a buffer. I need to maintain 2 such buffers for my test. Passing options is very easy, just import sys and you can find your options in sys.argv. To do something mor

Re: Archives and magic bytes

2005-03-24 Thread andrea
Chris Rebert (cybercobra) wrote: Have you tried the tarfile or zipfile modules? You might need to ugrade your python if you don't have them. They look pretty easy and should make this a snap. You can grab the output from the *nix "file" command using the new subprocess module. Good Luck - Chris ===

creating very small types

2005-04-27 Thread andrea
I was thinking to code the huffman algorithm and trying to compress something with it, but I've got a problem. How can I represent for example a char with only 3 bits?? I had a look to the compression modules but I can't understand them much... Thank you very much Any good link would be appreciate

Re: creating very small types

2005-04-27 Thread andrea
Jeremy Bowers wrote: >On Wed, 27 Apr 2005 22:17:07 +0200, andrea wrote: > > > >>I was thinking to code the huffman algorithm and trying to compress >>something with it, but I've got a problem. >>How can I represent for example a char with only 3 bits?? >&g

Re: Automatic import PEP

2006-09-23 Thread Andrea
> Opinions? Great :) -- http://mail.python.org/mailman/listinfo/python-list

Re: 2.5 updates for syntax file

2006-09-25 Thread Andrea
> Hi everyone. I'm updating my UltraEdit syntax file for Python 2.5 and > was wondering if anyone knew of other additions to make besides these. I > found all of these in the What's New document, but wasn't sure if there > were other important things to add for highlight. Great :) - Two new built

Re: Designing a graph study program

2007-06-07 Thread andrea
On 10 Mag, 16:52, Alexander Schliep <[EMAIL PROTECTED]> wrote: > andrea <[EMAIL PROTECTED]> writes: > > On 9 Mag, 09:10, Alexander Schliep <[EMAIL PROTECTED]> wrote: > >> Check outhttp://gato.sf.net(LGPLlicense). It does exactly what you > >>

textmate and execute line

2007-06-19 Thread andrea
Hi, I have the latest bundle for python (upgraded from svn) but I don't understand how execute line works.. It only works if I play with arithmetic operations, something like this works: 2*2 4 but for example trying to execute this line gives me this error, any help? x = 1; x + 1 Traceback (mos

Re: textmate and execute line

2007-06-27 Thread andrea
On 19 Giu, 14:20, andrea <[EMAIL PROTECTED]> wrote: > Hi, > I have the latest bundle for python (upgraded from svn) but I don't > understand how execute line works.. > > It only works if I play with arithmetic operations, something like > this works: > 2*2 > 4 &g

Rappresenting infinite

2007-06-27 Thread andrea
I would like to have a useful rappresentation of infinite, is there already something?? I was thinking to something like this class Inf(int): """numero infinito""" def __init__(self,negative=False): self.negative = negative def __cmp__(self,y):

Re: Rappresenting infinite

2007-07-02 Thread andrea
Mm very interesting thread, for my needs from numpy import inf is more than enough :) -- http://mail.python.org/mailman/listinfo/python-list

Designing a graph study program

2007-05-08 Thread andrea
I'm studying some graphs algorithm (minumum spanning tree, breath search first topological sort etc etc...) and to understand better the theory I'm implementing them with python... I made my own graph class, the constructor is simply this: class graph: "in forma di matrice e' una matrice n

Re: Designing a graph study program

2007-05-08 Thread andrea
On 8 Mag, 13:02, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > Well then I wanted to draw graphs and I found that pydot is working > > really nicely. > > BUT I'd like to do this, an interactive program to see ho the > > algorithms works... > > For example in the breath search first, every time

Re: Designing a graph study program

2007-05-08 Thread andrea
On 8 Mag, 13:55, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > Ok thank you very much I'll try with that. > > But I have some design doubts, I'd like to keep the algorithm (for > > example bfs) as clean as possible, being independent from the drawing > > methods. > > And how could I make it ste

Re: Designing a graph study program

2007-05-10 Thread andrea
On 9 Mag, 09:10, Alexander Schliep <[EMAIL PROTECTED]> wrote: > andrea <[EMAIL PROTECTED]> writes: > > Well then I wanted to draw graphs and I found that pydot is working > > really nicely. > > BUT I'd like to do this, an interactive program to see ho the >

Path python versions and Macosx

2007-05-11 Thread andrea
Hi everyone, I use python on macosx with textmate as editor (great program). I also use macport to install unix programs from the command line and I find it great too. Well I would like to have all my modules in the path when I'm using textmate AND when I use the commandline (ipython), but because

Re: Path python versions and Macosx

2007-05-14 Thread andrea
On 12 Mag, 01:09, [EMAIL PROTECTED] wrote: > On May 11, 1:36 pm, andrea <[EMAIL PROTECTED]> wrote: > > > > > Hi everyone, > > I use python on macosx with textmate as editor (great program). > > > I also use macport to install unix programs from the c

Re: Path python versions and Macosx

2007-05-20 Thread andrea
On 14 Mag, 23:00, [EMAIL PROTECTED] wrote: > On May 14, 4:46 am, andrea <[EMAIL PROTECTED]> wrote: > > > > > On 12 Mag, 01:09, [EMAIL PROTECTED] wrote: > > > > On May 11, 1:36 pm, andrea <[EMAIL PROTECTED]> wrote: > > > > > Hi everyone, >

Problem with extremely small real number

2007-09-03 Thread Andrea
to produce a program that provide a set of data of this probability on varying n and p, in order to plot a surface with this data set with gnuplot, any comments or suggestion? thanks in advance, Andrea -- http://mail.python.org/mailman/listinfo/python-list

Pattern_Recognition_School+Conf_2006:Deadline_Approaching

2006-04-28 Thread andrea
Approaching Deadlines!! PATTERN RECOGNITION EVENTS THIS SUMMER, 2006 ___ 4TH INTERNATIONAL SUMMER SCHOOL ON PATTERN RECOGNITION (ISSPR, 2006), 23-28 JULY, UK WWW.PatternRecognitionSchool.com The 4th International Summer School on Pattern Recognition will be organised at t

ISSPR2006_School_etc.:NEW_EXTENDED_Deadline

2006-05-05 Thread andrea
REGISTER NOW FOR PATTERN RECOGNITION EVENTS THIS SUMMER, 2006 ___ 4TH INTERNATIONAL SUMMER SCHOOL ON PATTERN RECOGNITION (ISSPR, 2006) 23-28 JULY, UK http://www.PatternRecognitionSchool.com NEW...EXTENDED Early Bird Deadline for Registration. New Deadline 25th May 2006! and

Final_Call_SummerSchool2006

2006-05-25 Thread andrea
REGISTER NOW FOR PATTERN RECOGNITION EVENTS THIS SUMMER, 2006 Early Registration Deadline for ISSPR is 25 MAY, 2006 ___ 4TH INTERNATIONAL SUMMER SCHOOL ON PATTERN RECOGNITION (ISSPR, 2006) 23-28 JULY, UK http://www.PatternRecognitionSchool.com NEW...EXTENDED Early Bird Deadli

Re: Building truth tables

2008-10-24 Thread andrea
On 26 Set, 20:01, "Aaron \"Castironpi\" Brady" <[EMAIL PROTECTED]> wrote: > > Good idea.  If you want prefixed operators: 'and( a, b )' instead of > 'a and b', you'll have to write your own.  ('operator.and_' is bitwise > only.)  It may be confusing to mix prefix with infix: 'impl( a and b, > c )',

Re: Creating huge data in very less time.

2009-03-31 Thread andrea
On 31 Mar, 12:14, "venutaurus...@gmail.com" wrote: > > That time is reasonable. The randomness should be in such a way that > MD5 checksum of no two files should be the same.The main reason for > having such a huge data is for doing stress testing of our product. In randomness is not necessary (

Building truth tables

2008-09-26 Thread andrea
Well I would like to make a little program that given a certain logical expression gives the complete truth table. It's not too difficult in fact, I just have some doubts on how to design it. I thought something like that: class Term: class Table: def and(... def or(... But I'm not con

pip and different branches?

2013-05-20 Thread andrea crotti
We use github and we work on many different branches at the same time. The problem is that we have >5 repos now, and for each repo we might have the same branches on all of them. Now we use pip and install requirements such as: git+ssh://g...@github.com/repo.git@dev Now the problem is that the r

Re: Getting a callable for any value?

2013-05-29 Thread andrea crotti
On 05/29/2013 06:46 PM, Croepha wrote: Is there anything like this in the standard library? class AnyFactory(object): def __init__(self, anything): self.product = anything def __call__(self): return self.product def __repr__(self): return "%s.%s(%r)" % (self.__class__.__module__, self.__class__

decorator to fetch arguments from global objects

2013-06-18 Thread andrea crotti
Using a CouchDB server we have a different database object potentially for every request. We already set that db in the request object to make it easy to pass it around form our django app, however it would be nice if I could set it once in the API and automatically fetch it from there. Basically

Re: python-django for dynamic web survey?

2013-06-18 Thread andrea crotti
Django makes your life a lot easier in many ways, but you still need some time to learn it. The task you're trying it's not trivial though, depending on your experience it might take a while with any library/framework.. -- http://mail.python.org/mailman/listinfo/python-list

Re: decorator to fetch arguments from global objects

2013-06-18 Thread andrea crotti
2013/6/18 Wolfgang Maier > andrea crotti gmail.com> writes: > > > > > > > Using a CouchDB server we have a different database object potentially > for > every request. > > > > We already set that db in the request object to make it easy to pass it &

Re: decorator to fetch arguments from global objects

2013-06-18 Thread andrea crotti
2013/6/18 Terry Reedy > On 6/18/2013 5:47 AM, andrea crotti wrote: > >> Using a CouchDB server we have a different database object potentially >> for every request. >> >> We already set that db in the request object to make it easy to pass it >> around form

using SQLalchemy

2012-06-21 Thread andrea crotti
sing SQLalchemy instead of the MySqlDB interface? For the second point I guess that we might have a bit less fine tuning, but the amount of data is not so much and speed is also not a bit issue (also because all the queries are extremely inefficient now). Any other possible issue? Thanks,

retry many times decorator

2012-06-28 Thread andrea crotti
Hi everyone, I'm replacing a perl system that has to work a lot with databases and perforce (and a few other things). This script have to run completely unsupervisioned, so it's important that it doesn't just quit at the first attempt waiting for human intervent.. They say that the network someti

Re: retry many times decorator

2012-06-28 Thread andrea crotti
> Returning a boolean isn't very Pythonic. It would be better, IMHO, if > it could swallow a specified exception (or specified exceptions?) > raised when an attempt failed, up to the maximum permitted number of > attempts. If the final attempt fails, propagate the exception. > -- > http://mail.pyth

Re: retry many times decorator

2012-06-28 Thread Andrea Crotti
On 06/28/2012 06:43 PM, Steven D'Aprano wrote: On Thu, 28 Jun 2012 17:26:36 +0100, andrea crotti wrote: I disagree. If you make a coding error in your function, why do you think it is useful to retry that buggy code over and over again? It's never going to get less buggy unless y

Re: retry many times decorator

2012-06-29 Thread andrea crotti
On the other hand now that I think again even supposing there is a permanent error like MySql completely down, retrying continuosly won't do any harm anyway because the machine will not be able to do anything else anyway, when someone will fix MySql it would restart again without human intervention

adding a simulation mode

2012-07-04 Thread andrea crotti
I'm writing a program which has to interact with many external resources, at least: - mysql database - perforce - shared mounts - files on disk And the logic is quite complex, because there are many possible paths to follow depending on some other parameters. This program even needs to run on many

Re: adding a simulation mode

2012-07-04 Thread andrea crotti
make the engine more generic would avoid this dirty hack def __init__(self, *args, **kwargs): # self.engine = create_engine('sqlite:home/andrea/testdb.sqlite', echo=True) self.engine = create_engine('sqlite://', echo=True) self.meta = MetaData(bind

Re: adding a simulation mode

2012-07-04 Thread andrea crotti
> Yes there is no easy solution apparently.. But I'm also playing > around with vagrant and virtual machine generations, suppose I'm able > to really control what will be on the machine at time X, creating it > on demand with what I need, it might be a good way to solve my > problems (a bit overki

Re: adding a simulation mode

2012-07-05 Thread andrea crotti
2012/7/5 Dieter Maurer : > > There is a paradigm called "inversion of control" which can be used > to handle those requirements. > > With "inversion of control", the components interact on the bases > of interfaces. The components themselves do not know each other, they > know only the interfaces t

Re: stuck in files!!

2012-07-06 Thread andrea crotti
2012/7/6 Chirag B : > i want to kno how to link two applications using python for eg:notepad > txt file and some docx file. like i wat to kno how to take path of > those to files and run them simultaneously.like if i type something in > notepad it has to come in wordpad whenever i run that code. >

Re: adding a simulation mode

2012-07-12 Thread andrea crotti
One thing that I don't quite understand is why some calls even if I catch the exception still makes the whole program quit. For example this try: copytree('sjkdf', 'dsflkj') Popen(['notfouhd'], shell=True) except Exception as e: print("here") behaves differently f

Re: adding a simulation mode

2012-07-12 Thread andrea crotti
One way instead that might actually work is this def default_mock_action(func_name): def _default_mock_action(*args, **kwargs): print("running {} with args {} and {}".format(func_name, args, kwargs)) return _default_mock_action def mock_fs_actions(to_run): """Take a function

Re: adding a simulation mode

2012-07-12 Thread andrea crotti
Well that's what I thought, but I can't find any explicit exit anywhere in shutil, so what's going on there? -- http://mail.python.org/mailman/listinfo/python-list

Re: adding a simulation mode

2012-07-12 Thread andrea crotti
2012/7/12 John Gordon : > In andrea crotti > writes: > >> Well that's what I thought, but I can't find any explicit exit >> anywhere in shutil, so what's going on there? > > Try catching SystemExit specifically (it doesn't inherit from Ex

Re: adding a simulation mode

2012-07-13 Thread andrea crotti
2012/7/13 Steven D'Aprano : > Well of course it does. If copytree fails, the try block ends and > execution skips straight to the except block, which runs, and then the > program halts because there's nothing else to be done. > > That at least is my guess, based on the described symptoms. > Well

assertraises behaviour

2012-07-16 Thread andrea crotti
I found that the behaviour of assertRaises used as a context manager a bit surprising. This small example doesn't fail, but the OSError exception is cathed even if not declared.. Is this the expected behaviour (from the doc I would say it's not). (Running on arch-linux 64 bits and Python 2.7.3, bu

Re: assertraises behaviour

2012-07-16 Thread andrea crotti
2012/7/16 Christian Heimes : > > The OSError isn't catched as the code never reaches the line with "raise > OSError". In other words "raise OSError" is never executed as the > exception raised by "assert False" stops the context manager. > > You should avoid testing more than one line of code in a

Re: assertraises behaviour

2012-07-16 Thread andrea crotti
Good thanks, but there is something that implements this behaviour.. For example nose runs all the tests, and if there are failures it goes on and shows the failed tests only in the end, so I think it is possible to achieve somehow, is that correct? -- http://mail.python.org/mailman/listinfo/pytho

Re: Diagramming code

2012-07-16 Thread Andrea Crotti
On 07/16/2012 02:26 AM, hamilton wrote: Is there any software to help understand python code ? Thanks hamilton Sometimes to get some nice graphs I use gprof2dot (http://code.google.com/p/jrfonseca/wiki/Gprof2Dot) or doxygen (http://www.stack.nl/~dimitri/doxygen/) gprof2dot analyses the out

Re: assertraises behaviour

2012-07-17 Thread andrea crotti
2012/7/16 Peter Otten <__pete...@web.de>: > No, I don't see how the code you gave above can fail with an OSError. > > Can you give an example that produces the desired behaviour with nose? Maybe > we can help you translate it to basic unittest. > > -- > http://mail.python.org/mailman/listinfo/pytho

Re: assertraises behaviour

2012-07-17 Thread Andrea Crotti
To clarify my "problem", I just thought that assertRaises if used as context manager should behave as following: - keep going if the exception declared is raised - re-raise an error even if catched after the declared exception was catched I was also confused by the doc a bit: "Test that an excep

reloading code and multiprocessing

2012-07-19 Thread andrea crotti
We need to be able to reload code on a live system. This live system has a daemon process always running but it runs many subprocesses with multiprocessing, and the subprocesses might have a short life... Now I found a way to reload the code successfully, as you can see from this testcase: def

Re: reloading code and multiprocessing

2012-07-23 Thread andrea crotti
2012/7/20 Chris Angelico : > On Thu, Jul 19, 2012 at 8:15 PM, andrea crotti > wrote: >> We need to be able to reload code on a live system. This live system >> has a daemon process always running but it runs many subprocesses with >> multiprocessing, and the subprocesses

Re: reloading code and multiprocessing

2012-07-25 Thread andrea crotti
2012/7/23 Chris Angelico : > > That would probably be correct. However, I still think you may be > fighting against the language instead of playing to its strengths. > > I've never fiddled with sys.modules like that, but I know some have, > without problem. > > ChrisA > -- > http://mail.python.org/

Dumping all the sql statements as backup

2012-07-25 Thread andrea crotti
I have some long running processes that do very long simulations which at the end need to write things on a database. At the moment sometimes there are network problems and we end up with half the data on the database. The half-data problem is probably solved easily with sessions and sqlalchemy (

Re: Dumping all the sql statements as backup

2012-07-25 Thread andrea crotti
2012/7/25 Jack Since you know the content of what the sql code is, why not just build > the sql file(s) needed and store them so that in case of a burp you can > just execute the code file. If you don't know the exact sql code, dump > it to a file as the statements are constructed... The only prob

regexps to objects

2012-07-27 Thread andrea crotti
I have some complex input to parse (with regexps), and I would like to create nice objects directy from them. The re module doesn't of course try to conver to any type, so I was playing around to see if it's worth do something as below, where I assign a constructor to every regexp and build an obje

Re: reloading code and multiprocessing

2012-07-27 Thread andrea crotti
2012/7/25 andrea crotti : > > I would also like to avoid this in general, but we have many > subprocesses to launch and some of them might take weeks, so we need > to have a process which is always running, because there is never a > point in time where we can just say let's

Re: py2c - an open source Python to C/C++ is looking for developers

2012-07-30 Thread andrea crotti
2012/7/30 : > I created py2c ( http://code.google.com/p/py2c )- an open source Python to > C/C++ translator! > py2c is looking for developers! > To join create a posting in the py2c-discuss Google Group or email me! > Thanks > PS:I hope this is the appropiate group for this message. > -- > http:/

Re: Pass data to a subprocess

2012-07-31 Thread andrea crotti
> > > def procs(): > mp = MyProcess() > # with the join we are actually waiting for the end of the running time > mp.add([1,2,3]) > mp.start() > mp.add([2,3,4]) > mp.join() > print(mp) > I think I got it now, if I already just mix the start before another add, inside th

Re: Pass data to a subprocess

2012-07-31 Thread andrea crotti
2012/7/31 Laszlo Nagy : >> I think I got it now, if I already just mix the start before another add, >> inside the Process.run it won't see the new data that has been added after >> the start. So this way is perfectly safe only until the process is launched, >> if it's running I need to use some mu

Re: Pass data to a subprocess

2012-08-01 Thread andrea crotti
2012/8/1 Laszlo Nagy : >> I was just surprised that it worked better than I expected even >> without Pipes and Queues, but now I understand why.. >> >> Anyway now I would like to be able to detach subprocesses to avoid the >> nasty code reloading that I was talking about in another thread, but >> t

Re: Pass data to a subprocess

2012-08-01 Thread andrea crotti
2012/8/1 Laszlo Nagy : > On thing is sure: os.fork() doesn't work under Microsoft Windows. Under > Unix, I'm not sure if os.fork() can be mixed with > multiprocessing.Process.start(). I could not find official documentation on > that. This must be tested on your actual platform. And don't forget t

CRC-checksum failed in gzip

2012-08-01 Thread andrea crotti
We're having some really obscure problems with gzip. There is a program running with python2.7 on a 2.6.18-128.el5xen (red hat I think) kernel. Now this program does the following: if filename == 'out2.txt': out2 = open('out2.txt') elif filename == 'out2.txt.gz' out2 = open('out2.txt.gz'

Re: CRC-checksum failed in gzip

2012-08-01 Thread andrea crotti
2012/8/1 Laszlo Nagy : > On 2012-08-01 12:39, andrea crotti wrote: >> >> We're having some really obscure problems with gzip. >> There is a program running with python2.7 on a 2.6.18-128.el5xen (red >> hat I think) kernel. >> >> Now this program doe

Re: CRC-checksum failed in gzip

2012-08-01 Thread andrea crotti
Full traceback: Exception in thread Thread-8: Traceback (most recent call last): File "/user/sim/python/lib/python2.7/threading.py", line 530, in __bootstrap_inner self.run() File "/user/sim/tests/llif/AutoTester/src/AutoTester2.py", line 67, in run self.processJobData(jobData, logger)

Re: Pass data to a subprocess

2012-08-01 Thread andrea crotti
2012/8/1 Roy Smith : > In article , > Laszlo Nagy wrote: > >> Yes, I think that is correct. Instead of detaching a child process, you >> can create independent processes and use other frameworks for IPC. For >> example, Pyro. It is not as effective as multiprocessing.Queue, but in >> return, you

Re: CRC-checksum failed in gzip

2012-08-01 Thread andrea crotti
2012/8/1 Laszlo Nagy : >>there seems to be no clear pattern and just randmoly fails. The file >> is also just open for read from this program, >>so in theory no way that it can be corrupted. > > Yes, there is. Gzip stores CRC for compressed *blocks*. So if the file is > not flushed to the d

Re: Pass data to a subprocess

2012-08-01 Thread andrea crotti
2012/8/1 Laszlo Nagy : > > So detaching the child process will not make IPC stop working. But exiting > from the original parent process will. (And why else would you detach the > child?) > > -- > http://mail.python.org/mailman/listinfo/python-list Well it makes perfect sense if it stops working

Re: CRC-checksum failed in gzip

2012-08-01 Thread andrea crotti
2012/8/1 Steven D'Aprano : > On Wed, 01 Aug 2012 14:01:45 +0100, andrea crotti wrote: > >> Full traceback: >> >> Exception in thread Thread-8: > > "DANGER DANGER DANGER WILL ROBINSON!!!" > > Why didn't you say that there were threads involve

Re: CRC-checksum failed in gzip

2012-08-01 Thread andrea crotti
2012/8/1 Laszlo Nagy : > >> Thanks a lot, that makes a lot of sense.. I haven't given this detail >> before because I didn't write this code, and I forgot that there were >> threads involved completely, I'm just trying to help to fix this bug. >> >> Your explanation makes a lot of sense, but it's

Re: CRC-checksum failed in gzip

2012-08-02 Thread andrea crotti
2012/8/1 Steven D'Aprano : > > When you start using threads, you have to expect these sorts of > intermittent bugs unless you are very careful. > > My guess is that you have a bug where two threads read from the same file > at the same time. Since each read shares state (the position of the file >

Re: CRC-checksum failed in gzip

2012-08-02 Thread andrea crotti
2012/8/2 Laszlo Nagy : > > Your example did not share the file object between threads. Here an example > that does that: > > class OpenAndRead(threading.Thread): > def run(self): > global fz > fz.read(100) > > if __name__ == '__main__': > >fz = gzip.open('out2.txt.gz') >

Re: CRC-checksum failed in gzip

2012-08-02 Thread andrea crotti
2012/8/2 andrea crotti : > > Ok sure that makes sense, but then this explanation is maybe not right > anymore, because I'm quite sure that the file object is *not* shared > between threads, everything happens inside a thread.. > > I managed to get some errors doing this

Sharing code between different projects?

2012-08-13 Thread andrea crotti
I am in the situation where I am working on different projects that might potentially share a lot of code. I started to work on project A, then switched completely to project B and in the transiction I copied over a lot of code with the corresponding tests, and I started to modify it. Now it's ti

Re: Sharing code between different projects?

2012-08-14 Thread andrea crotti
2012/8/13 Rob Day : > I'd just create a module - called shared_utils.py or similar - and import > that in both projects. It might be a bit messy if there's no 'unifying > theme' to the module - but surely it'd be a lot less messy than your > TempDirectory class, and anyone else who knows Python wil

Re: Sharing code between different projects?

2012-08-14 Thread andrea crotti
2012/8/14 Jean-Michel Pichavant : > > I can think of logilab-common (http://www.logilab.org/848/) > > Having a company-wide python module properly distributed is one to achieve > your goal. Without distributing your module to the public, there's a way to > have a pypi-like server runnning on your p

Re: Sharing code between different projects?

2012-08-15 Thread andrea crotti
2012/8/14 Cameron Simpson : > > Having just skimmed this thread, one thing I haven't quite seen suggested is > this: > > Really do make a third "utilities" project, and treat "the project" and > "deploy" as separate notions. So to actually run/deploy project A's code > you'd have a short script tha

Re: Sharing code between different projects?

2012-08-15 Thread andrea crotti
Also looking at logilab-common I thought that it would be great if we could actually make this "common" library even open source, and use it as one of the other many external libraries. Since Python code is definitively not the the core business of this company I might even convince them, but the

Re: Sharing code between different projects?

2012-08-16 Thread andrea crotti
2012/8/16 Jean-Michel Pichavant : > > SVN allows to define external dependencies, where one repository will > actually checkout another one at a specific version. If SVN does it, I guess > any decent SCM also provide such feature. > > Assuming our project is named 'common', and you have 2 projects

Re: how to call perl script from html using python

2012-08-16 Thread andrea crotti
2012/8/16 Pervez Mulla : > > Hey Steven , > > Thank you for your response, > > I will in detail now about my project, > > Actually the project entire backend in PERL language , Am using Django > framework for my front end . > I have written code for signup page in python , which is working perfec

Re: Sharing code between different projects?

2012-08-16 Thread andrea crotti
2012/8/16 andrea crotti : > > > Unfortunately I think you guess wrong > http://forums.perforce.com/index.php?/topic/553-perforce-svnexternals-equivalent/ > Anyway with views and similar things is not that hard to implement the > same thing.. I'm very happy to say that I fi

Re: Why doesn't Python remember the initial directory?

2012-08-20 Thread andrea crotti
2012/8/20 kj : > In Roy Smith > writes> This means that no library code can ever count on, for example, > being able to reliably find the path to the file that contains the > definition of __main__. That's a weakness, IMO. One manifestation > of this weakness is that os.chdir breaks inspect.ge

Re: Why doesn't Python remember the initial directory?

2012-08-20 Thread andrea crotti
2012/8/20 Roy Smith : > In article , > Walter Hurry wrote: > >> It is difficult to think of a sensible use for os.chdir, IMHO. > > It is true that you can mostly avoid chdir() by building absolute > pathnames, but it's often more convenient to just cd somewhere and use > names relative to that.

Re: pyQT performance?

2012-09-10 Thread Andrea Crotti
On 09/10/2012 07:29 PM, jayden.s...@gmail.com wrote Have you ever used py2exe? After converting the python codes to executable, does it save the time of interpreting the script language? Thank a lot! Py2exe normally never speeds up anything, simply because it doesn't convert to executable, bu

main and dependent objects

2012-09-13 Thread andrea crotti
tr3" self.dependent_object = Dependent(self) But I'm not so sure it's a good idea, it's a bit smelly.. Any other suggestion about how to get a similar result? I could of course passing all the arguments needed to the constructor of Dependent, but it's a bit tedious..

Re: main and dependent objects

2012-09-13 Thread andrea crotti
2012/9/13 Jean-Michel Pichavant : > > Nothing shocking right here imo. It looks like a classic parent-child > implementation. > However it seems the relation between Obj and Dependent are 1-to-1. Since > Dependent need to access all Obj attributes, are you sure that Dependent and > Obj are not a

Re: Python presentations

2012-09-13 Thread andrea crotti
2012/9/13 William R. Wing (Bill Wing) : > > [byte] > > Speaking from experience as both a presenter and an audience member, please > be sure that anything you demo interactively you include in your slide deck > (even if only as an addendum). I assume your audience will have access to > the deck

Re: Python presentations

2012-09-13 Thread Andrea Crotti
On 09/13/2012 11:58 PM, Miki Tebeka wrote: What do you think work best in general? I find typing during class (other than small REPL examples) time consuming and error prone. What works well for me is to create a slidy HTML presentation with asciidoc, then I can include code snippets that can

Re: Decorators not worth the effort

2012-09-14 Thread andrea crotti
I think one very nice and simple example of how decorators can be used is this: def memoize(f, cache={}, *args, **kwargs): def _memoize(*args, **kwargs): key = (args, str(kwargs)) if not key in cache: cache[key] = f(*args, **kwargs) return cache[key] r

Re: Decorators not worth the effort

2012-09-14 Thread andrea crotti
2012/9/14 Chris Angelico : > > Trouble is, you're starting with a pretty poor algorithm. It's easy to > improve on what's poor. Memoization can still help, but I would start > with a better algorithm, such as: > > def fib(n): > if n<=1: return 1 > a,b=1,1 > for i in range(1,

Re: subprocess call is not waiting.

2012-09-18 Thread andrea crotti
I have a similar problem, something which I've never quite understood about subprocess... Suppose I do this: proc = subprocess.Popen(['ls', '-lR'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) now I created a process, which has a PID, but it's not running apparently... It only seems to run whe

Re: subprocess call is not waiting.

2012-09-19 Thread andrea crotti
2012/9/18 Dennis Lee Bieber : > > Unless you have a really massive result set from that "ls", that > command probably ran so fast that it is blocked waiting for someone to > read the PIPE. I tried also with "ls -lR /" and that definitively takes a while to run, when I do this: proc = subp

Re: subprocess call is not waiting.

2012-09-19 Thread andrea crotti
2012/9/19 Hans Mulder : > Yes: using "top" is an observation problem. > > "Top", as the name suggests, shows only the most active processes. Sure but "ls -lR /" is a very active process if you try to run it.. Anyway as written below I don't need this anymore. > > It's quite possible that your 'ls

Re: Python presentations

2012-09-19 Thread andrea crotti
2012/9/19 Trent Nelson : > > FWIW, I gave a presentation on decorators to the New York Python > User Group back in 2008. Relevant blog post: > > http://blogs.onresolve.com/?p=48 > > There's a link to the PowerPoint presentation I used in the first > paragraph. It's in .ppt

Re: 'str' object does not support item assignment

2012-09-23 Thread Andrea Crotti
On 09/23/2012 07:31 PM, jimbo1qaz wrote: spots[y][x]=mark fails with a "'str' object does not support item assignment" error,even though: a=[["a"]] a[0][0]="b" and: a=[["a"]] a[0][0]=100 both work. Spots is a nested list created as a copy of another list. But a = "a" a[0] = 'c' fails f

Re: Python presentations

2012-09-24 Thread andrea crotti
For anyone interested, I already moved the slides on github (https://github.com/AndreaCrotti/pyconuk2012_slides) and for example the decorator slides will be generated from this: https://raw.github.com/AndreaCrotti/pyconuk2012_slides/master/deco_context/deco.rst Notice the literalinclude with :py

Re: PHP vs. Python

2012-09-25 Thread andrea crotti
2012/9/25 : > On Thursday, 23 December 2004 03:33:36 UTC+5:30, (unknown) wrote: >> Anyone know which is faster? I'm a PHP programmer but considering >> getting into Python ... did searches on Google but didn't turn much up >> on this. >> >> Thanks! >> Stephen > > > Here some helpful gudance. > >

  1   2   3   4   5   6   >