Re: Da dove prende python il default timezone?

2014-06-06 Thread Andrea D'Amore
heezy, server in USA, EU timezone) and my strftime works as expected: ~> cat /etc/timezone Europe/Rome ~> date "+%H" 20 ~> python -c 'import time; print time.strftime("%H")' 20 Try reconfiguring tzdata package again. -- Andrea -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3 on Mac OS X 10.8.4

2014-06-19 Thread Andrea D'Amore
is to install and learn to use a package manager, I use MacPorts that requires full Xcode. Brew should require the smaller command line package. Fink should require no additional packages since it's basically APT. There are other managers as well, these are the most common on OS X. -- Andrea

Re: Network/multi-user program

2014-07-22 Thread Andrea D'Amore
oa it's pretty straightforward to use. [1] http://dabodev.com/ [2] http://www.cappuccino-project.org/ -- Andrea -- https://mail.python.org/mailman/listinfo/python-list

Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-08-31 Thread Andrea D'Amore
On 2014-08-31 14:19:24 +, andydtay...@gmail.com said: - Installing to a virtualenv python environment. Are you using the virtualenv interpreter as the Pycharm project interpreter? -- Andrea -- https://mail.python.org/mailman/listinfo/python-list

Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-09-01 Thread Andrea D'Amore
You make hard to follow your messages both by sending lot of messages and not using an adequate quoting. Please pick a posting style [1] (possibly interleaved) and stick to it. On 2014-08-31 23:35:09 +, andydtay...@gmail.com said: Andrea - yes I am using the virtualenv interpreter as the

Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-09-01 Thread Andrea D'Amore
rself with a tool that provides us with some context" add nothing and are not exactly community inclusive. Still you took the time to write the message I'm replying to, that won't help you much, rather than running """ import sys print(sys.executable) "&quo

Re: find the error

2014-09-12 Thread Andrea D'Amore
On 2014-09-13 05:53:37 +, Chris Angelico said: If you're using sys.argv, you need to provide arguments to your script. Or check sys.argv's length ensuring that an element is there before accessing it. -- Andrea -- https://mail.python.org/mailman/listinfo/python-list

Re: brackets at the end of a method name

2014-09-24 Thread Andrea D'Amore
On 2014-09-24 13:30:55 +, ast said: we have some methods associated with file f […] f.close() f.name print(type(f.close)) print(type(f.name)) Spot the difference. -- Andrea -- https://mail.python.org/mailman/listinfo/python-list

Re: create a directory structure

2011-09-16 Thread Andrea Crotti
After some research, I think that paste-script is the best choice in this case. I can define templates and I'll get my directory structure nicely populated for me. -- http://mail.python.org/mailman/listinfo/python-list

create a directory structure

2011-09-16 Thread Andrea Crotti
I would like to write a program which creates a directory structure and fills in a few templated fields some values passed in as arguments. So for example create_struct.py might create base_dir: |_ sub_dir1: |_ sub_file1 ... It's quite simple in theory, but I would also like to make it very

Re: create a directory structure

2011-09-18 Thread Andrea Crotti
On 09/17/2011 12:56 PM, Rafael Durán Castañeda wrote: I think you might want to look at Fabric or vagrant Thanks, but I don't understand how these two project would help me... I don't need to deploy on many machines via s

extending class

2011-09-23 Thread Andrea Crotti
I wanted to add a couple of parameters to a class from a given library (paste-script), but without changing the original code. So I thought, I create a wrapper class which adds what I need, and then dispatch all the calls to the super class. My following attempt gives, however, a recursion erro

Re: extending class

2011-09-23 Thread Andrea Crotti
On 09/23/2011 10:31 AM, Peter Otten wrote: Inside __getattribute__() you ask for self.first_var which triggers another __getattribute__() call that once again trys to determine the first_var attribute before it returns... Try using __getattr__() instead which is only triggered for non-existent

Develop inter-dependent eggs

2011-09-23 Thread Andrea Crotti
Develop inter-dependent eggs: On a Linux machine I have many eggs to develop, for example - egg1 - egg2 ... Now the eggs depend from each other, so running "python setup.py develop" in order, doesn't work, because if the dependency required is not already installed then easy_install tries to

Re: extending class

2011-09-23 Thread Andrea Crotti
Jean-Michel Pichavant writes: > Did you consider subclassing your Var class ? This is how you extend a > class behavior in OOP. > > class PSIVar(var): >def __init__(self, name, desc, other=None, fun=None): >var.__init__(self, name, desc) >if other is not None: >sel

Re: Replacing spreadsheets by Python and the browser

2011-10-02 Thread Andrea Crotti
On 10/02/2011 06:36 PM, markolopa wrote: Hello, Could you please recommend me a Python tool that could help me to get rid of the messy information and scripts I have in spreadsheets? Spreadsheets are great for having simple things done quickly. But as the needs grow their limitations can be qui

Change import order with *.pth files

2011-10-02 Thread Andrea Gavana
touching the pth file in site-packages, of course)? I have tried fiddling with sys.path and to create a local (in my development folder) pth file, to no avail. I hope I have been able to explain my problem clearly... This is on Windows, Python 2.5 to 2.7. Thank you in advance for your suggesti

Re: Change import order with *.pth files

2011-10-02 Thread Andrea Crotti
On 10/02/2011 10:29 PM, Andrea Gavana wrote: Hi All, my apologies if this is a dumb question, but I couldn't find a solution - possibly because I am not sure how to state my problem in a short sentence. Let's say I am using a package called "blah", and this

Re: eggbasket

2011-10-04 Thread Andrea Crotti
On 10/04/2011 08:34 PM, Miki Tebeka wrote: Do you have a local file/directory that is called sqlalchemy? Funny thing, I have the same problem with another machine, with sqlalchemy installed system-wide instead of locally. Strange issue, maybe a problem with python 2.7/Linux? -- http://mail.p

Re: eggbasket

2011-10-05 Thread Andrea Crotti
Well it was easy, apparently sqlalchemy.exceptions doesn't exist but sqlalchemy.exc does, and that's the correct one, maybe a version problem... I get another problem right after File "/home/andrea/PSI_refactor/test_local_pypi/lib/python2.7/site-packages/EggBasket-0.6.1b-py2.

profiling big project

2011-10-11 Thread Andrea Crotti
Hi everyone, I am in the situation that I'll have to profile huge python programs, huge because they use many external libraries like numpy / pyqt / ETS etc etc... The applications are very slow and we wanted to understand what is actually going on. I like to use normally pycallgraph, but in this

Re: shipping python

2011-10-12 Thread Andrea Crotti
On 10/12/2011 10:10 PM, Kristen J. Webb wrote: I tried experimenting with .pyc files only to end up at: RuntimeError: Bad magic number in .pyc file can't run 2.5 pyc files on 2.6 :( My main motivation to use .pyc is to keep end users from changing scripts, breaking things, and then calling u

services/daemons

2011-10-26 Thread Andrea Crotti
Running pypiserver as a service? I'm writing some scripts which in theory should be able to: - start up a local pypi server as a daemon (or well a service on Windows) - run "python setup.py develop" on a potentially very big set of eggs, possibly discovering automatically for changes. In the

locate executables for different platforms

2011-10-31 Thread Andrea Crotti
lable to manage external multi-platform executables? Thanks, Andrea -- http://mail.python.org/mailman/listinfo/python-list

Re: locate executables for different platforms

2011-10-31 Thread Andrea Crotti
On 10/31/2011 02:00 PM, Andrea Crotti wrote: Suppose that I have a project which (should be)/is multiplatform in python, which, however, uses some executables as black-boxes. These executables are platform-dependent and at the moment they're just thrown inside the same egg, and

leftover pyc files

2011-11-02 Thread Andrea Crotti
In our current setup, the script in charge to run our applications also scan all the directories and if it finds any "pyc" file without the corresponding module, it removes it. This was done because when you rename something, the old "pyc" remains there and can cause problems. Is it the only w

Re: leftover pyc files

2011-11-02 Thread Andrea Crotti
On 11/02/2011 03:03 PM, Peter Otten wrote: Switch to Python3.2 ;) Yes I saw that and it would be great, unfortunately we're stuck with Python 2.5 :O for some more time. Anyway now the code that does it is a recursive thing ilke def _clean_orphaned_pycs(self, directory, simulate=False): "

Re: leftover pyc files

2011-11-02 Thread Andrea Crotti
On 11/02/2011 04:06 PM, Chris Kaynor wrote: If you can at least upgrade to Python 2.6, another option, if you don't mind losing the byte code caching all together (it may worsen load times, however probably not significantly), you can set PYTHONDONTWRITEBYTECODE to prevent the writing of .pyc fil

Re: leftover pyc files

2011-11-03 Thread Andrea Crotti
All these ideas (shell and git hooks) are nice, but unfortunately - it's svn not git - it's windows not *nix - we have to remove only the ones without the corresponding *py... -- http://mail.python.org/mailman/listinfo/python-list

Re: leftover pyc files

2011-11-04 Thread Andrea Crotti
On 11/04/2011 09:27 AM, Jonathan Hartley wrote: I like to install a Bash shell of some kind on windows boxes I work on, specifically so I can use shell commands like this, just like on any other operating system. Cywin works just fine for this. svn also has hooks, but sadly not a checkout hook

Re: leftover pyc files

2011-11-04 Thread Andrea Crotti
On 11/04/2011 10:39 AM, Chris Angelico wrote: If you're removing them all, you don't need to use a powerful shell. Much much easier! Just recursively del *.pyc and you're done. ChrisA Discussing with the guy that did it I think it's actually a good idea instead, because removing them *all* me

Re: Design Pattern and Python: Any book recommendation? Your view?

2011-11-04 Thread Andrea Crotti
On 11/04/2011 12:33 AM, Anthony Kong wrote: Sorry to resurrect this topic. By google search the last discussion was in 2003. I would like to find out what is the current prevailing view or consensus (if any) on the use of Design Pattern in python? I am doing some 'fact-finding' in this area on

simple import hook

2011-11-10 Thread Andrea Crotti
So I would really like to accomplish the following: run a program normally and keep track of all the imports that were actually done. I studied the PEP 302, but I'm still a bit confused about how to do it. I thought that instead of implementing everything I could just record the request and

Re: simple import hook

2011-11-10 Thread Andrea Crotti
On 11/10/2011 05:02 PM, Eric Snow wrote: Yeah, I'm working on a reference for imports in Python. They're just a little too mysterious relative to the rest of the language. But it's not too helpful yet. In the meantime... Yes it's quite mysterious, and it's actually not as hard as it looks..

pymacs?

2011-11-16 Thread Andrea Crotti
After a long time, and since it was included iin python-mode, I wanted to try if I can get ropemacs working finally. I have tried many possible things, also in Emacs -Q, and I actually got it working only once, apparently by pure luck with Emacs -Q: (setq py-load-python-mode-pymacs-p nil) (se

decorators and closures

2011-11-21 Thread Andrea Crotti
With one colleague I discovered that the decorator code is always executed, every time I call a nested function: def dec(fn): print("In decorator") def _dec(): fn() return _dec def nested(): @dec def fun(): print("here") nested() nested() Will give: In dec

Re: decorators and closures

2011-11-21 Thread Andrea Crotti
On 11/21/2011 03:06 PM, Dave Angel wrote: Your function 'nested' isn't nested, 'fun' is. What you discovered is that a decorator is always executed, every time a nested decorated function is defined. You've also ust proved that it would be an incompatible change. Doesn't that answer the que

Re: What I do and do not know about installing Python on Win 7 with regard to IDLE.

2011-11-21 Thread Andrea Crotti
On 11/21/2011 04:39 PM, W. eWatson wrote: ... I'm using Win 7 Premium. So unless some brilliant idea appears, that leaves me with the choice of not using Python or this suggestion... (Let's not get off into other variations of other "Pythons" like Active..."): Someone suggested using the mai

Re: decorators and closures

2011-11-21 Thread Andrea Crotti
On 11/21/2011 05:11 PM, Dave Angel wrote: You didn't mention what version of Python you're running. With Python 2, I got very different results. So I switched to Python 3.2, and I still don't get exactly what you have. A closure is needed if there's some non-global data outside the functi

Re: What I do and do not know about installing Python on Win 7 with regard to IDLE.

2011-11-22 Thread Andrea Crotti
On 11/22/2011 04:14 PM, W. eWatson wrote: > Your joking, right, or do you just prefer 500 line threads wandering > all over the place? I would personally prefer to just not see useless discussions about Windows set up in a python mailing list, but I guess it's a price to pay for the popularity of

getting svn tag in version

2011-11-25 Thread Andrea Crotti
Given a project with many eggs, I would like to make it easy to have all the version numbers synchronized to the upper level SVN version. So for example I might have svn tags 0.1, 0.2 and a development version. The development version should get version -dev, and the others 0.1 and 0.2 I found

python 2.5 and ast

2011-11-28 Thread Andrea Crotti
I'm happily using the ast module to analyze some code, but my scripts need also to run unfortunately on python 2.5 The _ast was there already, but the ast helpers not yet. Is it ok if I just copy over the source from the ast helpers in my code base or is there a smarter way? (I don't even need al

Re: python 2.5 and ast

2011-11-29 Thread Andrea Crotti
On 11/29/2011 03:55 AM, Dave Angel wrote: But don't forget to tag it as version specific, so it gets removed when the later version of the library is available. There are various ways of doing that, but the easiest is probably to put a test in the acceptance suite that fails if this code is

Re: python 2.5 and ast

2011-11-29 Thread Andrea Crotti
On 11/29/2011 11:32 AM, Steven D'Aprano wrote: I prefer to check against sys.version. import sys if sys.version<= '2.5': from psi.devsonly.ast import parse, NodeVisitor else: from ast import parse, NodeVisitor Or even: try: from ast import parse, NodeVisitor except ImportErr

Re: python 2.5 and ast

2011-11-30 Thread Andrea Crotti
Another thing about the AST, I am having fun trying to for example list out all the unused imports. I have already a visitor which works quite nicely I think, but now I would like to get a way to find all the unused imports, so I need more visitors that find out all the used names. I didn't f

Re: python 2.5 and ast

2011-12-02 Thread Andrea Crotti
On 12/02/2011 03:18 PM, DevPlayer wrote: There was another topic in these forums recently about "un-importing" modules (and how you can not do that reliably without restarting python). There was various ways mentioned of keeping track of what was imported. And there was mentioned reasonable ways

Re: python 2.5 and ast

2011-12-02 Thread Andrea Crotti
And on a related topic, how can I actually detect other types of imports, for example __import__ Doing a dump I get this: In [113]: ast.dump(ast.parse('__import__("module")')) Out[113]: "Module(body=[Expr(value=Call(func=Name(id='__import__', ctx=Load()), args=[Str(s='module')], keywords=[], s

whitespace cleanup

2011-12-06 Thread Andrea Crotti
eful, any advice? Thanks, Andrea -- http://mail.python.org/mailman/listinfo/python-list

Re: whitespace cleanup

2011-12-06 Thread Andrea Crotti
On 12/06/2011 11:49 AM, Pedro Henrique G. Souto wrote: On 06/12/2011 09:28, Andrea Crotti wrote: > Now on Emacs I have a hook before every save that cleans up all the > "wrong" white spaces, > with the 'whitespace-cleanup' function. > > I would like that also

Re: whitespace cleanup

2011-12-06 Thread Andrea Crotti
On 12/06/2011 12:17 PM, Pedro Henrique G. Souto wrote: Something like PythonTidy does what you want? http://pypi.python.org/pypi/PythonTidy If you like to write your own script, or if what you want is similar, but not the same, the source code is a good place to start: http://lacusveris.com

Re: whitespace cleanup

2011-12-06 Thread Andrea Crotti
So apparently PythonTidy uses the AST (the compiler module) to find out the problems, and generates new nodes with a put method to write out the code with the fix. An awful lot of code is needed to make it work apparently, not very neat. Pep8 instead uses tokenize and regular expressions only,

Re: Questions about LISP and Python.

2011-12-07 Thread Andrea Crotti
On 12/06/2011 04:36 AM, Xah Lee wrote: i don't like python, and i prefer emacs lisp. The primary reason is that python is not functional, especially with python 3. The python community is full of fanatics with their drivels. In that respect, it's not unlike Common Lisp community and Scheme lisp c

Re: Questions about LISP and Python.

2011-12-08 Thread Andrea Crotti
On 12/08/2011 04:10 AM, Rick Johnson wrote: ... Why has GvR not admonished the atrocious behavior of some people in this community? Why has GvR not admitted publicly the hideous state of IDLE and Tkinter? Where is the rally call? Where is the community spirit? The future of Pythin is in your han

Re: Misleading error message of the day

2011-12-08 Thread Andrea Crotti
On 12/08/2011 02:23 PM, Roy Smith wrote: I just spent a while beating my head against this one. # Python 2.6 a, b = 'foo' Traceback (most recent call last): File "", line 1, in ValueError: too many values to unpack The real problem is that there's too *few* values to unpack! It should hav

Re: Documentation using Sphinx

2011-12-08 Thread Andrea Crotti
On 12/08/2011 02:09 PM, sajuptpm wrote: Hi, I am trying source code documentation using Sphinx. Here i have to copy paste all modules in to *.rst file, that is painful. Have any way to create documentation (doc for all modules, classes and methods in the project directory) from project folder qui

Re: Misleading error message of the day

2011-12-08 Thread Andrea Crotti
On 12/08/2011 03:42 PM, Roy Smith wrote: Why not? Take this example: def i(): i = 0 while True: print "returning:", i yield i i += 1 a, b = i() ./iter.py returning: 0 returning: 1 returning: 2 Traceback (most recent call last): File "./iter.py", line 1

adding elements to set

2011-12-08 Thread Andrea Crotti
I've wasted way too much time for this, which is surely not a Python bug, not something that surprised me a lot. I stupidly gave for granted that adding an object to a set would first check if there are equal elements inside, and then add it. As shown below this is not clearly the case.. Is it p

Re: tracking variable value changes

2011-12-09 Thread Andrea Crotti
On 12/08/2011 08:17 PM, Catherine Moroney wrote: Hello, Is there a way to create a C-style pointer in (pure) Python so the following code will reflect the changes to the variable "a" in the dictionary "x"? For example: >>> a = 1.0 >>> b = 2.0 >>> x = {"a":a, "b":b} >>> x {'a': 1.0, 'b': 2.0}

Re: [OT] Book authoring

2011-12-09 Thread Andrea Crotti
On 12/09/2011 03:25 AM, Miki Tebeka wrote: Greetings, Any recommendations for a book authoring system that supports the following: 1. Code examples (with syntax highlighting and line numbers) 2. Output HTML, PDF, ePub ... 3. Automatic TOC and index 4. Search (in HTML) - this is a "nice to have"

Re: Confusion about decorators

2011-12-12 Thread Andrea Crotti
On 12/12/2011 01:27 PM, Henrik Faber wrote: Hi group, I'm a bit confused regarding decorators. Recently started playing with them with Python3 and wanted (as an excercise) to implement a simple type checker first: I know there are lots of them out there, this is actually one of the reasons I cho

change a file with a context manager

2011-12-13 Thread Andrea Crotti
So I have the following problem, I need something to copy a file to a certain position and restore it after. So I wrote this simple context manager: class WithCorrectEasyInstall(object): def __enter__(self): import pkg_resources from shutil import copyfile easy_insta

Re: change a file with a context manager

2011-12-13 Thread Andrea Crotti
On 12/13/2011 10:59 AM, Andrea Crotti wrote: So I have the following problem, I need something to copy a file to a certain position and restore it after. So I wrote this simple context manager: class WithCorrectEasyInstall(object): def __enter__(self): import pkg_resources

logging issues

2011-12-13 Thread Andrea Crotti
I think is simple but I can't get it to work as I wish. Suppose I have a big application, my idea is that the running script sets a global logging level and then all the imported modules would act consequently. In my codebase, however, unless I set the level for each of the loggers I don't get th

Re: logging issues

2011-12-13 Thread Andrea Crotti
On 12/13/2011 04:11 PM, Jean-Michel Pichavant wrote: Not really, if you use the classic way, your subloggers should be created an never configured. Their default behavior is to raise any log event to its parent. That way, all event logs end up being handled by the root logger. Ok thanks now

boolean from a function

2011-12-13 Thread Andrea Crotti
I'm not sure for how long I had this bug, and I could not understand the problem. I had a function which would return a boolean def func_bool(): if x: return True else: return False Now somewhere else I had if func_bool: # do something I could not quite understand why it

Re: logging issues

2011-12-13 Thread Andrea Crotti
And by the way suppose I have a script which takes as input the log level and a list of possible filters. In another file I have a couple of functions as below which are called in that order. Is that supposed to work? In theory I'm getting both times the same logger. The set_verbosity seems to do

Re: boolean from a function

2011-12-14 Thread Andrea Crotti
On 12/13/2011 11:37 PM, Steven D'Aprano wrote: x is a global? Poor design. But in any case, instead of an explicit if...else block, the canonical way to convert an arbitrary object to True/ False is with bool: def func_bool(): return bool(x) But you don't need it. See below. No no it

merging argparse parsers

2011-12-16 Thread Andrea Crotti
I would like to have something like merged_parser = LoggingParser() + OtherParser() Which should create an argument parser with all the options composed. Now for that I think I would need to subclass the argument, and something fancy with the overloading. The problem is that apparently there is

profiling code

2011-12-20 Thread Andrea Crotti
I would like to automate some kind of performance profiling, to see if the application (and possibly pieces of it) becomes slower/faster and why. So I did something like this, where the statement passed also called parse_arguments, which is nice because I can run the other script with the norma

Re: Python education survey

2011-12-20 Thread Andrea Crotti
On 12/20/2011 03:51 AM, Raymond Hettinger wrote: Do you use IDLE when teaching Python? If not, what is the tool of choice? Students may not be experienced with the command-line and may be running Windows, Linux, or Macs. Ideally, the tool or IDE will be easy to install and configure (startup di

argparse and default values

2012-01-05 Thread Andrea Crotti
There's one thing I don't understand about argparse, why doesn't --help show what is the default value?? I mean if I add an option that can be customized it would be good for the user to know what is the current value in my opinion. Is there a way to make it show it? -- http://mail.python.org/m

Re: argparse and default values

2012-01-05 Thread Andrea Crotti
On 01/05/2012 01:24 PM, Andrea Crotti wrote: There's one thing I don't understand about argparse, why doesn't --help show what is the default value?? I mean if I add an option that can be customized it would be good for the user to know what is the current value in my opinion.

multiversion flag and auto requiring import hook

2012-01-19 Thread Andrea Crotti
I'm using the multiversion flag in setuptools (-m) to be able to run many different projects, without modifying the global environment. Then thanks to pkg_resources magic and setuptools I can get automatically everything loaded. Now the problem is that we want to be able to run tests. The best

Re: multiversion flag and auto requiring import hook

2012-01-19 Thread Andrea Crotti
... Actually the main problem which I've been banging my head quite a few days alreays is this: --8<---cut here---start->8--- ERROR: Failure: AttributeError ('module' object has no attribute 'walk')

importing and nose

2012-01-19 Thread Andrea Crotti
I'm writing some code to analyse pstats statistics, and I'm trying to have some working unit tests. Suppose I have in the test directory another directory 'profiling', which contains 'x.py', and 'b.py'. Now running the following code in a script works perfectly, class TestStatParser(unittest.T

Re: Please don't use "setuptools", the "rotten .egg" install system.

2012-01-19 Thread Andrea Crotti
On 01/19/2012 05:05 PM, John Nagle wrote: I can do it, I just have better things to do than system administration. The fact that Python doesn't "just work" is part of why it's losing market share. Maybe in your home is losing market (if you're so sure post some sources). If it can be

Re: importing and nose

2012-01-19 Thread Andrea Crotti
On 01/19/2012 05:36 PM, Peter Otten wrote: I don't believe you. Quite sure it does: [andrea@precision test]$ cat simple.py import profile from os import path import sys prof_path = path.join(path.dirname(__file__), 'profiling') sys.path.append(prof_path) import x pr

Is a with on open always necessary?

2012-01-20 Thread Andrea Crotti
I normally didn't bother too much when reading from files, and for example I always did a content = open(filename).readlines() But now I have the doubt that it's not a good idea, does the file handler stays open until the interpreter quits? So maybe doing a with open(filename) as f: con

while True or while 1

2012-01-21 Thread Andrea Crotti
I see sometimes in other people code "while 1" instead of "while True". I think using True is more pythonic, but I wanted to check if there is any difference in practice. So I tried to do the following, and the result is surprising. For what I can see it looks like the interpreter can optimize a

Re: while True or while 1

2012-01-21 Thread Andrea Crotti
Actually there was the same question here (sorry should have looked before) http://stackoverflow.com/questions/3815359/while-1-vs-for-whiletrue-why-is-there-a-difference And I think the main reason is that 1 is a constant while True is not such and can be reassigned. -- http://mail.python.org/mai

Re: groupby behaviour

2013-02-26 Thread andrea crotti
2013/2/26 Ian Kelly : > On Tue, Feb 26, 2013 at 9:27 AM, andrea crotti > wrote: >> So I was trying to use groupby (which I used in the past), but I >> noticed a very strange thing if using list on >> the result: > > As stated in the docs: > > ""&qu

Mixin way?

2013-04-03 Thread andrea crotti
I have some classes that have shared behaviours, for example in our scenario an object can be "visited", where something that is visitable would have some behaviour like --8<---cut here---start->8--- class Visitable(Mixin): FIELDS = { 'visits': [],

Re: Mixin way?

2013-04-03 Thread andrea crotti
2013/4/3 Steven D'Aprano > [snip] > > So, if you think of "Visitable" as a gadget that can be strapped onto > your MyObj as a component, then composition is probably a better design. > But if you think of "Visitable" as a mere collection of behaviour and > state, then a mixin is probably a better

dynamic forms generation

2013-04-16 Thread andrea crotti
We are re-designing a part of our codebase, which should in short be able to generate forms with custom fields. We use django for the frontend and bottle for the backend (using CouchDB as database), and at the moment we simply plug extra fields on normal django forms. This is not really scalable,

Re: dynamic forms generation

2013-04-19 Thread andrea crotti
Well I think since we are using django anyway (and bottle on the API side) I'm not sure why we would use flask forms for this.. Anyway the main question is probably, is it worth to try to define a DSL or not? The problem I see is that we have a lot and very complex requirements, trying to define a

Re: Visualisation Engine for Python

2006-01-03 Thread Andrea Gavana
> I am looking for a 2D data visualisation or graphics library for > Python. Can anyone point me in the right direction? You could try out matplotlib: http://matplotlib.sourceforge.net/ HTH. Andrea. "Imagination Is The Only Weapon In The War Against Reality." http://xo

Compiling extensions

2006-08-10 Thread Andrea Gavana
o ask: is there *any* possible combination of C/Fortran compilers that actually *works* with Python2.4 on WIndows XP? Does anyone have some suggestion? Thank you very much. Andrea. -- "Imagination Is The Only Weapon In The War Against Reality." http://xoomer.virgilio.it/infinity77/ -- http://mail.python.org/mailman/listinfo/python-list

Reading unformatted big-endian files

2006-08-11 Thread Andrea Gavana
dif 8 continue enddo 10continue ! Close the file close(1) Well, does anyone have some suggestion about which kind of material/tutorial on similar things I should read? How can I deal in Python with variables that must be 8-chars or 4-chars in order to read correctly the

Reading unformatted big-endian files

2006-08-11 Thread Andrea Gavana
or your explanation, now it is very clear what I should do. I hope performances will not change so much: fortran is very fast in reading files (but I use it only in this case, I love to use Python)... well, let's see :-D Andrea. -- "Imagination Is The Only Weapon In The War Against

Reading unformatted big-endian files

2006-08-11 Thread Andrea Gavana
nd see how it performs. Thank you very much! Andrea. -- "Imagination Is The Only Weapon In The War Against Reality." http://xoomer.virgilio.it/infinity77/ -- http://mail.python.org/mailman/listinfo/python-list

Numpy-f2py troubles

2006-10-17 Thread Andrea Gavana
chars, each of them with size (8, dimens). Does anyone know what I may be doing wrong? Thank you very much for every pointer. -- Andrea. "Imagination Is The Only Weapon In The War Against Reality." http://xoomer.virgilio.it/infinity77/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Arrays? (Or lists if you prefer)

2006-10-22 Thread Andrea Griffini
Neil Cerutti wrote: > >>> b =[range(2), range(2)] I often happened to use b = [[0] * N for i in xrange(N)] an approach that can also scale up in dimensions; for example for a cubic NxNxN matrix: b = [[[0] * N for i in xrange(N)] for j in xrange

Re: Where do nested functions live?

2006-10-28 Thread Andrea Griffini
nd. I'd add that while in some respect "def x" is like an assigment to x ... >>> def f(): global g def g(): return "Yoo!" >>> f() >>> g() 'Yoo!' in some other respect (unfortunately) it's not a

Re: Name bindings for inner functions.

2006-10-28 Thread Andrea Griffini
turn l this way every function will have its own "i" variable, that is initialized with the value of the loop variable when executing the "def" statement. Andrea -- http://mail.python.org/mailman/listinfo/python-list

Re: Unicode/ascii encoding nightmare

2006-11-06 Thread Andrea Griffini
John Machin wrote: > The fact that C3 and C2 are both present, plus the fact that one > non-ASCII byte has morphoploded into 4 bytes indicate a double whammy. Indeed... >>> x = u"fødselsdag" >>> x.encode('utf-8').decode('iso-8859-1'

Re: Unicode/ascii encoding nightmare

2006-11-07 Thread Andrea Griffini
my message, and suppose someone else made it seven minutes later than your other post. I suppose that in this case the message would be a zero content noise (and not the precious pearl of wisdom it is because it comes from you). > Cheers, > John Andrea -- http://mail.python.org/mailman/listinfo/python-list

PyWin32-winxptheme and py2exe

2006-11-14 Thread Andrea Gavana
g bundle=1, bundle=2, bundle=3, compressed=1, compressed=2, every possible combination. But it doesn't work :-( I attach my setup file, if it can be of any help. Thank you very much for every pointer. -- Andrea. "Imagination Is The Only Weapon In The War Against Reality." http://xoom

Re: PyWin32-winxptheme and py2exe

2006-11-15 Thread Andrea Gavana
e a file called MyExecutable.exe.manifest in the working directory. I have followed the directions given in py2exe/samples/advanced, but it still doesn't work. I think it might be a bug in winxptheme/py2exe. Thank you for every pointer. Andrea. "Imagination Is The Only Weapon In The W

[PIL]: Image size in runtime

2006-06-20 Thread Andrea Gavana
a way to obtain such result without actually saving the image? Thanks for any hint. Andrea. "Imagination Is The Only Weapon In The War Against Reality." http://xoomer.virgilio.it/infinity77/ -- http://mail.python.org/mailman/listinfo/python-list

scheduling accuracy for audio

2006-07-09 Thread andrea valle
music. Any hints? Thanks a lot Best -a- Andrea Valle DAMS - Facoltà di Scienze della Formazione Università degli Studi di Torino http://www.semiotiche.it/andrea [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4   5   6   >