struct: type registration?

2006-05-31 Thread Giovanni Bajo
guess an issue with this could be the endianess problem: it would make sense if, when called recursively, struct.pack/unpack used by the default the endianess specified by the external format string. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: struct: type registration?

2006-06-01 Thread Giovanni Bajo
ike a big fat no-op to me; you've done all the heavy lifting > yourself. Looks like you totally misread my message. Your string "x" is what I find in binary data, and I need to *unpack* into a regular Python string, which would be "abcde". > >> idx = s.find(&q

Re: struct: type registration?

2006-06-01 Thread Giovanni Bajo
Giovanni Bajo wrote: > You need struct.unpack() to parse these datas, and you need custom > packer/unpacker to avoid post-processing the output of unpack() just > because it just knows of basic Python types. In binary structs, there > happen to be *types* which do not map 1:1 to Pytho

Re: struct: type registration?

2006-06-01 Thread Giovanni Bajo
adjust data, call struct.pack(), return custom unpacker: call struct.unpack(), adjust data, return I should have chosen a most complex example probably, but I did not want to confuse readers. It seems I have confused them by choosing too simple an example. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

time.clock() going backwards??

2006-08-25 Thread Giovanni Bajo
ther board drivers (buf if so, wouldn't other application start going mad)? -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this a bug? Python intermittently stops dead for seconds

2006-10-01 Thread Giovanni Bajo
he Python's GC. I have no idea whether this would be considered a bug by Python's developer, but you can try opening a bugreport... -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this a bug? Python intermittently stops dead for seconds

2006-10-01 Thread Giovanni Bajo
gc.collect()) when you are done with the allocations. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Python to use a non open source bug tracker?

2006-10-03 Thread Giovanni Bajo
elf. Does this smell "Bitkeeper fiasco" to anyone else than me? -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Python to use a non open source bug tracker?

2006-10-04 Thread Giovanni Bajo
selection. There are many open source applications around. They might not be the best, but at least they are yours, and not of some third party software vendors with its own interests. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Python to use a non open source bug tracker?

2006-10-04 Thread Giovanni Bajo
y, I don't give a damn about the language the application is coded in, as long as it is OUR application and not an application of a private company which we do not own. Even though you are totally right. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Python to use a non open source bug tracker?

2006-10-04 Thread Giovanni Bajo
[EMAIL PROTECTED] wrote: > Giovanni Bajo wrote: > >> Does this smell "Bitkeeper fiasco" to anyone else than me? > > I can't understand why people waste time arguing this stuff. > > Use whatever tool is best at it's job... if it's not written in Pyt

Re: Python to use a non open source bug tracker?

2006-10-04 Thread Giovanni Bajo
s smell "Bitkeeper fiasco" to anyone else than me? > > The committee did expect this recommendation to be controversial. :) I guess :) In fact, I have a deepest hope that this recommendation was just a fake just to get people setup a roundup installation... -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Python to use a non open source bug tracker?

2006-10-04 Thread Giovanni Bajo
ou could have recommended Roundup *and* explained there is a need for funding and/or volunteers before the migration can happen. You might also be understimating how negative could be the reaction from the open-source community to such a move. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Python to use a non open source bug tracker?

2006-10-04 Thread Giovanni Bajo
CC's Bugzilla installation is pretty much on its own; Daniel Berlin does some maintainance every once in a while (upgrading when new versions are out, applying or writing some patches for most requested features in the community, or sutff like that), but it's surely not his

Re: dictionary of list from a file

2006-10-04 Thread Giovanni Bajo
ways more strongly typed, so you have to specify a factory function. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing data from pyserial

2006-12-03 Thread Giovanni Bajo
Lone Wolf wrote: > reading = ser.read(40) Simply try ser.readline() here, or maybe ser.readline(eol="\r"). -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing data from pyserial, an (inefficient) solution

2006-12-04 Thread Giovanni Bajo
Dennis Lee Bieber wrote: > >> The really sad thing is that I get a perfectly constructed >> packet from the reading variable, and that gets butchered when I >> try to slice it up to pick out individual elements. Since >> pyserial doesn’t do anything to rearrange the data, then the >> CMUcam must d

Re: len() and PEP 3000

2006-12-07 Thread Giovanni Bajo
python-use-methods-for-some-functionality-e-g-list-index-but-functions-for-other-e-g-len-list.htm -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Subprocess with a Python Session?

2006-12-07 Thread Giovanni Bajo
;> >> p = subprocess.Popen("python", stdout=subprocess.PIPE, >> stdin=subprocess.PIPE) >> p.stdin.write('print 10\n') > > + p.stdin.close() > >> assert p.stdout.readline() == '10\n' Yeah, but WHY was the API designed like this? Why

Re: Conditional iteration

2006-12-13 Thread Giovanni Bajo
additional indentation. for x in ...: if not x > 0: continue ... more code ... -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Missing __length_hint__ in __getitem__ iterator

2006-12-15 Thread Giovanni Bajo
x27;__reduce_ex__', '__repr__', '__setattr__', '__str__', 'next'] does not have a __length_hint__ method. Is this just a missing optimization, or there is a deep semantic reason for which a __length_hint__ could not be constructed out of the __len__ result? -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Missing __length_hint__ in __getitem__ iterator

2006-12-15 Thread Giovanni Bajo
er(A()).__length_hint__() > 42 > > Peter Ah well, actually it's there also in dir(), you just need to use Python 2.5 of course ;) -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Designing a cancellable function

2006-12-16 Thread Giovanni Bajo
or() pass def longFunction(callback): for i in xrange(10): # do something callback(i / 10.0) -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

[ANN] PyInstaller 1.3 released

2006-12-20 Thread Giovanni Bajo
, it's now at http://groups.google.com/group/PyInstaller. Join us for discussion! -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] PyInstaller 1.3 released

2006-12-20 Thread Giovanni Bajo
the traceback is. I'd be very glad to fix the problem for you. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] PyInstaller 1.3 released

2006-12-21 Thread Giovanni Bajo
o add it as an additional data file, read the manual about that. It will be extracted to the runtime directory and you should be able to access it through _MEIPASS2 (manual should be clear about that). You can't just read it from the "current directory" because the current directory

Re: Backreferences in python ?

2006-01-23 Thread Giovanni Bajo
gt; search for :for ( i = 0; i < 10; i++) > Replace with: for( printf( "10" ), i =0; i < 10; i++) > Where 10 is the line no. import re import fileinput for L in fileinput.input(inplace=True): pattern = 'printf("%d"),' % input.filelineno() L

Re: Using non-ascii symbols

2006-01-24 Thread Giovanni Bajo
a prerequisite for using Python. So, while I don't give a damn if those symbols are going to be supported by Python, I don't think the plain ASCII version should be deprecated. There are too many situations where it's still useful (coding across old terminals and whatnot). -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Possible memory leak?

2006-01-25 Thread Giovanni Bajo
of CPython 2.4 though. I'm not sure which version the OP was using because he didn't say. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Possible memory leak?

2006-01-25 Thread Giovanni Bajo
[D:\Work]python -m timeit -n100 -s "import foo" "foo.iters2(1)" 100 loops, best of 3: 10.9 msec per loop [D:\Work]python -m timeit -n100 -s "import foo" "foo.iters2(2)" 100 loops, best of 3: 22.2 msec per loop [D:\Work]python -m timeit -n100

Re: Possible memory leak?

2006-01-25 Thread Giovanni Bajo
h other solutions like the ones you propose, but even the "simple" implementation (and most readable and Pythonic, IMHO) behaves "well" under CPython 2.4. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Codec Search Function

2006-01-25 Thread Giovanni Bajo
d to be fixed for the testcases I had. BTW: putting "PyInstaller" in the subject of the mail for PyInstaller-related mails (and/or mailing to the PyInstaller mailing list) would be preferred to get a quicker answer. Thanks! -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: How to handle two-level option processing with optparse

2006-01-25 Thread Giovanni Bajo
g at the first positional argument, leaving other options unparsed. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Codec Search Function

2006-01-27 Thread Giovanni Bajo
;ArchiveViewer.py out1.pyz" (ArchiveViewer.py is shipped with Python). It will display a list of all the packaged modules: in my list, 'encodings.hex_codec' appears. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Deterministic destruction and RAII idioms in Python

2006-01-30 Thread Giovanni Bajo
l objects as long as they support new __enter__ and __exit__ special method), so go to the link above for more details and more juicy examples that I'm sure you'll like. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular expression query

2006-02-04 Thread Giovanni Bajo
gt; import shlex >>> def extract(s): ... s = s.split("=")[1] ... s = shlex.split(s)[0] ... return s ... >>> extract("parameter=12ab") '12ab' >>> extract("parameter=12ab foo bar") '12ab' >>> extract

Re: fairly large webapp: from Java to Python. experiences?

2006-02-04 Thread Giovanni Bajo
30 layers of complex abstractions for doubtful benefits and obvious slowness. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: numeric expression from string?

2006-02-04 Thread Giovanni Bajo
parsing (line 1) >>> calc("type(3).__class__") Traceback (most recent call last): File "", line 1, in ? File "", line 5, in calc ValueError: error during expression evaluation: name 'type' is not defined Of course, one can still bring your system to its knees when "1000**1000"... -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Single-file executables

2006-02-12 Thread Giovanni Bajo
Ravi Teja wrote: > Actually, py2exe (from version 0.6.1) onwards does create single file > exes without ANY additional dependencies. They still require an external MSVCR71.DLL if made with Python 2.4. PyInstaller 1.1 (to be released today) does not have this problem. -- Giovanni Bajo --

[ANN] PyInstaller 1.1 released

2006-02-13 Thread Giovanni Bajo
ncies (fix provided by Vikram Aggarwal). + (Windows) With Python 2.4, setup UPX properly so to be able to compress binaries generated with Visual Studio .NET 2003 (such as most of the extensions). UPX 1.92+ is needed for this. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: how to break a for loop?

2006-02-21 Thread Giovanni Bajo
s 0, a) Usa lambda x: x==0 or simply lambda x: x Using 'is' relies on the interpreter reusing existing instances of the immutable object '0', which is an implementation detail. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Mutable numbers

2006-02-21 Thread Giovanni Bajo
orld case. You didn't even look at the Python source code to check if your assumptions were true. Try to check your assumptions before designing solutions to problems which do not exist. I suggest you start writing real-world Python before doing so many assumptions. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Little tool - but very big size... :-(

2006-02-21 Thread Giovanni Bajo
made. For instance, wxWidgets is *HUGE*. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Little tool - but very big size... :-(

2006-02-22 Thread Giovanni Bajo
.3.5 Core + OpenGL + Table in a single .pyd of 1.2Mb (compressed). You can add to that the usual Python overhead (around 1Mb compressed), thanks to having those useless CJK codecs compiled within python24.dll (sigh!). -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Can optparse do dependencies?

2006-02-25 Thread Giovanni Bajo
in this direction, I think it should add standardized support for the "subcommand pattern", that is the same command line arrangement that CVS, SVN and other programs uses. rpm doesn't use it and I consider this an error in UI design (it should really have been "rpm query --changelog" and similar). -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 354: Enumerations in Python

2006-02-26 Thread Giovanni Bajo
usage is > quite simple and flexible. The classics is already referenced by the > Python docs: > > http://www.python.org/doc/essays/metaclasses/Enum.py Agreed. Allowing subclassing of an existing enum is a strong plus to me. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 354: Enumerations in Python

2006-02-26 Thread Giovanni Bajo
specified for that value when constructing the > enumeration:: > > >>> gym_night = Weekdays.wed > >>> str(gym_night) > 'wed' What's the repr of an enumeration value? OTOH, it should be something like "Weekdays.wed", so that eva

Re: question about the id()

2005-05-16 Thread Giovanni Bajo
e extra performance from their programs. > > Good to know. Is there any advanced optimizer for Python code, which > would do such things for me (or suggest them, like pychecker does > for readability)? Prove that a.f() would not change the meaning of "a.f" after its invokation

Re: Does Boost.Python participate in cyclic gc?

2007-06-07 Thread Giovanni Bajo
t which referenced the Boostified C++ instance, e.g.: Those situations get more and more common as you keep wrapping your code. To the best of my knowledge, SIP is the only one which does the right thing here. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

[ANN] GCC 4.1.2 installer for Python distutils compilation

2007-03-17 Thread Giovanni Bajo
is is pretty complicate, and there's much confusion (Google turns up red herrings). This package handles everything for you, and it just works. -- Giovanni Bajo Develer S.r.l. http://www.develer.com -- http://mail.python.org/mailman/listinfo/python-list

Re: GCC 4.1.2 installer for Python distutils compilation

2007-03-18 Thread Giovanni Bajo
ree alternative, it might be worth to give it a go :) -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: [Swig-user] How to receive a FILE* from Python under MinGW?

2007-03-21 Thread Giovanni Bajo
1.DLL problem. It was announced on this very list a few days ago: http://www.develer.com/oss/GccWinBinaries Feedback is welcome! -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: [Swig-user] How to receive a FILE* from Python under MinGW?

2007-03-22 Thread Giovanni Bajo
into "libmsvcr60.a", and "libmsvcrtd.a" into "libmsvcr60d.a". After that, it should just works. Let me know if it works for you, so that I can report results on the webpage. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: How to receive a FILE* from Python under MinGW?

2007-03-22 Thread Giovanni Bajo
to run it anyway. You can try by simply invoking "gcc -v" at the MSYS prompt and see if it's picking up the right version of GCC. I would appreciate if you give some feedback about this. I would like to incorporate your findings on the webpage. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: How to receive a FILE* from Python under MinGW?

2007-03-22 Thread Giovanni Bajo
MSVCRT_VERSION__ is being set correctly.. that is something gccmrt should eventually take care of, but for this specific _ctype problem you probably need to submit a patch to mingw-runtime. I can guide you through it though... I don't have much time in these days though. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: PQueue and Python 2.5

2007-01-20 Thread Giovanni Bajo
oved this work-around. And by the way, this is also a FAQ: http://effbot.org/pyfaq/why-does-my-c-extension-suddenly-crash-under-2.5.htm and even explained in the Misc/NEWS of Python 2.5. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: My python programs need a GUI, wxPython or PyQt4?

2007-01-24 Thread Giovanni Bajo
ition to develop a software, and then buy the commercial edition only the day before you want to release it as non open-source. I can't even understand how they can even try to support such a nonsense position. You're free to develop your software for years as GPL without distributing it, and then relicense your own code whenever you want. They're obviously just trying to scare people. ]] -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Missing .dlls when installing PyQt!? :(

2007-01-24 Thread Giovanni Bajo
ter searching for the file I found it in the C:\Qt\4.2.2\bin > directory. I copied the dll to the windows dir just to run in to the > next missing dll error (QtCore4.dll) which is also located in the same > directory. What have I missed? I've been trying to install QT for 6 &g

Re: Fast constant functions for Py2.5's defaultdict()

2007-02-13 Thread Giovanni Bajo
# fast on initial miss, but slow on > non-misses; works for any constant > > The itertools.repeat(const).next approach wins on speed and > flexibility. But it's the most unreadable too. I'm surprised that defaultdict(int) is slower than the lambda one though. What's the

Re: python 2.5a2, gcc 4.1 and memory problems

2006-05-07 Thread Giovanni Bajo
a py > 2.5 problem. > I'm right? or I have to compile it with something other switches? Make sure -fno-strict-aliasing is specified. Python does not conform to ISO C type aliasing rules. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

strftime return value encoding (mbcs, locale, etc.)

2008-01-27 Thread Giovanni Bajo
f doing it? (Yes, it sucks). Shouldn't Python automatically alias whatever is returned by locale.getpreferredencoding() to "mbcs", so that my original code works portably? Thanks in advance! -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

min/max: "stable" invariant?

2008-03-11 Thread Giovanni Bajo
;>> min(L, key=lambda a:a.x) is L[0] True >>> min(L, key=lambda a:a.x) is L[3] False Is this guaranteed by the Python language formal specification? Is this guaranteed to always by true in CPython? (I guess so) I can't find any mention in the documentation. -- Giovanni Bajo --

Re: Counter Class -- Bag/Multiset

2009-01-22 Thread Giovanni Bajo
tems() vs c.elements(). Items and elements are synonymous (again, in my understanding of English). All in all, I think I prefer your previous bag class: http://code.activestate.com/recipes/259174/ -- Giovanni Bajo Develer S.r.l. http://www.develer.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Counter Class -- Bag/Multiset

2009-01-23 Thread Giovanni Bajo
On 1/23/2009 2:49 AM, Chris Rebert wrote: On Thu, Jan 22, 2009 at 5:41 PM, Giovanni Bajo wrote: On Thu, 22 Jan 2009 10:11:37 -0800, Raymond Hettinger wrote: The collections module in Python 2.7 and Python 3.1 has gotten a new Counter class that works like bags and multisets in other

Re: PyInstaller: problem to build exe with PyQt4

2008-06-03 Thread Giovanni Bajo
On Tue, 03 Jun 2008 08:35:37 +0200, Mark Delon wrote: > Hi, > > I need to generate single EXEcutable via PyInstaller. It will be > genereated -> i get one single executable. > > AFTER CALL (exe) I get an error: "no module named _gt" > > Build command: > 1. Configure.py > 2. Makespec.py -F

Re: popen and exit code on Windows

2006-03-07 Thread Giovanni Bajo
= k.read() ret = k.close() if ret is None: return out raise LaunchError(ret, cmd, out) -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: trying to find repeated substrings with regular expression

2006-03-13 Thread Giovanni Bajo
h1b', 'FOO blah2', and 'FOO blah3a blah3b blah3b'. > [...] > Can someone suggest a regular expression which will return > groups corresponding to the FOO substrings above? FOO.*?(?=(?:FOO|$)) -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: sizeof(struct timeval)

2006-03-14 Thread Giovanni Bajo
#x27;t need to worry about > other OS's. If I were you, I would write a Pyrex 4-liners which exposes this structure to Python in the way you prefer. This would immediately fix all these compatibility issues. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: whats your favourite object relational mapper?

2006-03-20 Thread Giovanni Bajo
Jonathan Ellis wrote: > ... which, of course, goes to show how stupid a metric this is, now > that even Ian Bicking has admitted that SqlObject in its current form > is a dead end. Got a pointer? -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: New Python Logo Revealed

2006-04-01 Thread Giovanni Bajo
27;s an april's joke, please? :) -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: efficiency of range() and xrange() in for loops

2006-04-05 Thread Giovanni Bajo
sume that the only use-case of range() is within a for-loop. range() is a builtin function that can be used in any Python expression. For instance: RED, GREEN, BLUE, WHITE, BLACK = range(5) -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

Re: Using pyinstaller to create an .exe, when using win32com

2006-04-11 Thread Giovanni Bajo
If you provide me with a complete bugreport (on the pyinstaller list, or as a ticket in the pyinstaller bug system) I might have a look. Alas, I have little time to spend on PyInstaller at the moment, but I'm eventually going to tackle this. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list

[ANN] PyInstaller 1.4

2010-03-21 Thread Giovanni Bajo
doc/CHANGES.txt === Feedback === We're eager to listent to your feedback on using PyInstaller: Ticketing system: http://www.pyinstaller.org/newticket Mailing list: http://groups-beta.google.com/group/PyInstaller -- Giovanni Bajo :: Develer S.r.l. ra...@develer.com :: http://w

<    1   2