C Structure rebuild with ctypes

2009-12-20 Thread Georg
= (c_char_p(c_char * 65) * NumberOfVariables)()" Can anyboby help? How do I have to state the structure "array of pointers to char string"? How is a pointer to the first element of such an array defined using ctypes? How do I allocate enough space for the char the array points to? Best rega

Re: C Structure rebuild with ctypes

2009-12-21 Thread Georg
amesArray = c.cast(varNames,c.POINTER(PCHAR * numVars.value)) > varTypesArray = c.cast(varTypes,c.POINTER(INT * numVars.value)) What does this cast? How do I know how I have to cast the objects returned from the library function? What kind of objects do I get? I learned that the values of objects created by the ctypes module are accessed using object.value? Best regards Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: C Structure rebuild with ctypes

2009-12-21 Thread Georg
tion: You created an object varNamesArray as an ctypes array. This object has a method "contents". How do I find out what other methods this objects has? For instance a method to retrieve the size of the array? Is this documented somewhere? Best regards Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: C Structure rebuild with ctypes

2010-01-08 Thread Georg
ere in parameters. What would I have to do different? Best regards Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: C Structure rebuild with ctypes

2010-01-27 Thread Georg
el") print "vn: ", vn.value print "vl: ", vl.value returnCode = libc.SetVarLabel(h,byref(vn), byref(vl)) print "Return Code: ", returnCode The return code is always "variable not found". Thus my call to the C library is not working. What do I do wrong? Best regards Georg -- http://mail.python.org/mailman/listinfo/python-list

[RELEASED] Python 3.2.5 and Python 3.3.2

2013-05-15 Thread Georg Brandl
report bugs to http://bugs.python.org/ (Thank you to those who reported these regressions.) Enjoy! - -- Georg Brandl, Release Manager georg at python.org (on behalf of the entire python-dev team and all contributors) -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.19 (GNU/Linux

[RELEASED] Python 3.3.0 beta 1

2012-06-26 Thread Georg Brandl
ng any bugs you may notice to: http://bugs.python.org/ Enjoy! (*) Please note that this document is usually finalized late in the release cycle and therefore may have stubs and missing entries at this point. -- Georg Brandl, Release Manager georg at python.org (on behalf of the entire python-dev team and 3.3's contributors) -- http://mail.python.org/mailman/listinfo/python-list

[RELEASED] Python 3.3.0 beta 2

2012-08-12 Thread Georg Brandl
.0 visit: http://www.python.org/download/releases/3.3.0/ Please consider trying Python 3.3.0 with your code and reporting any bugs you may notice to: http://bugs.python.org/ Enjoy! (*) Please note that this document is usually finalized late in the release cycle and therefore may h

[RELEASED] Python 3.3.0 release candidate 1

2012-08-25 Thread Georg Brandl
otal, almost 500 API items are new or improved in Python 3.3. For a more extensive list of changes in 3.3.0, see http://docs.python.org/3.3/whatsnew/3.3.html To download Python 3.3.0 visit: http://www.python.org/download/releases/3.3.0/ Please consider trying Python 3.3.0 with you

[RELEASED] Python 3.3.0 release candidate 2

2012-09-09 Thread Georg Brandl
eases/3.3.0/ Please consider trying Python 3.3.0 with your code and reporting any bugs you may notice to: http://bugs.python.org/ Enjoy! - -- Georg Brandl, Release Manager georg at python.org (on behalf of the entire python-dev team and 3.3's contributors) -BEGIN PGP SIGNATURE- Ve

[RELEASED] Python 3.3.0 release candidate 3

2012-09-23 Thread Georg Brandl
eases/3.3.0/ Please consider trying Python 3.3.0 with your code and reporting any bugs you may notice to: http://bugs.python.org/ Enjoy! - -- Georg Brandl, Release Manager georg at python.org (on behalf of the entire python-dev team and 3.3's contributors) -BEGIN PGP SIGNATURE- Ve

[RELEASED] Python 3.3.0

2012-09-29 Thread Georg Brandl
of changes in 3.3.0, see http://docs.python.org/3.3/whatsnew/3.3.html To download Python 3.3.0 visit: http://www.python.org/download/releases/3.3.0/ This is a production release, please report any bugs to http://bugs.python.org/ Enjoy! -- Georg Brandl, Release Manager georg at python.org (on behalf of the entire python-dev team and 3.3's contributors) -- http://mail.python.org/mailman/listinfo/python-list

Re: [RELEASED] Python 3.3.0

2012-09-30 Thread Georg Brandl
On 09/29/2012 06:53 PM, Antoine Pitrou wrote: Hello, I've created a 3.3 category on the buildbots: http://buildbot.python.org/3.3/ http://buildbot.python.org/3.3.stable/ Someone will have to update the following HTML page: http://python.org/dev/buildbot/ Should be done now. Georg --

[RELEASED] Python 3.3.0 alpha 1

2012-03-04 Thread Georg Brandl
s such as "sendfile()" For a more extensive list of changes in 3.3.0, see http://docs.python.org/3.3/whatsnew/3.3.html To download Python 3.3.0 visit: http://www.python.org/download/releases/3.3.0/ Please consider trying Python 3.3.0a1 with your code and reporting any bugs you

[RELEASED] Python 3.3.0 alpha 1

2012-04-01 Thread Georg Brandl
ython.org/ Enjoy! (*) Please note that this document is usually finalized late in the release cycle and therefore may have stubs and missing entries at this point. - -- Georg Brandl, Release Manager georg at python.org (on behalf of the entire python-dev team and 3.3's cont

[RELEASED] Python 3.3.0 alpha 2

2012-04-01 Thread Georg Brandl
any bugs you may notice to: http://bugs.python.org/ Enjoy! (*) Please note that this document is usually finalized late in the release cycle and therefore may have stubs and missing entries at this point. - - -- Georg Brandl, Release Manager georg at python

[RELEASED] Python 3.3.0 alpha 3

2012-05-01 Thread Georg Brandl
3.0 visit: http://www.python.org/download/releases/3.3.0/ Please consider trying Python 3.3.0 with your code and reporting any bugs you may notice to: http://bugs.python.org/ Enjoy! (*) Please note that this document is usually finalized late in the release cycle and therefore

[RELEASED] Python 3.3.0 alpha 4

2012-05-31 Thread Georg Brandl
load Python 3.3.0 visit: http://www.python.org/download/releases/3.3.0/ Please consider trying Python 3.3.0 with your code and reporting any bugs you may notice to: http://bugs.python.org/ Enjoy! (*) Please note that this document is usually finalized late in the release cycle and

[RELEASED] Python 3.2.1 rc 2

2011-07-04 Thread Georg Brandl
http://docs.python.org/3.2/whatsnew/3.2.html To download Python 3.2.1 visit: http://www.python.org/download/releases/3.2.1/ This is a testing release: Please consider trying Python 3.2.1 with your code and reporting any bugs you may notice to: http://bugs.python.org/ Enjoy! -- Georg

[RELEASED] Python 3.2.1

2011-07-10 Thread Georg Brandl
features in the 3.2 line, see http://docs.python.org/3.2/whatsnew/3.2.html To download Python 3.2.1 visit: http://www.python.org/download/releases/3.2.1/ This is a final release: Please report any bugs you may notice to: http://bugs.python.org/ Enjoy! - -- Georg Brandl, Release

[RELEASED] Python 3.2.2

2011-09-04 Thread Georg Brandl
list of changes in 3.2, see http://docs.python.org/3.2/whatsnew/3.2.html To download Python 3.2 visit: http://www.python.org/download/releases/3.2/ Please consider trying Python 3.2 with your code and reporting any bugs you may notice to: http://bugs.python.org/ Enjoy! - -- Georg

[RELEASED] Python 3.2.1 rc 1

2011-05-17 Thread Georg Brandl
http://docs.python.org/3.2/whatsnew/3.2.html To download Python 3.2.1 visit: http://www.python.org/download/releases/3.2.1/ This is a testing release: Please consider trying Python 3.2.1 with your code and reporting any bugs you may notice to: http://bugs.python.org/ Enjoy! -- Georg

x-plat gui development question Mac OS X

2005-10-28 Thread Georg Christmann
work seems to work just fine. I am not sure though if there are any system processes, say during boot-up, that depend on "python" pointing to the original location, or if there could be problems with more complex code than "Hello world". Any insights welcome Georg -- http://mail.python.org/mailman/listinfo/python-list

Help on project, anyone?

2005-01-23 Thread Georg Brandl
erman with strong interests in programming and, of course, especially in Python (I love it...). Does anyone run, or participate in, a project looking for fellow programmers? I don't have a special area of interest, well, perhaps web programming... Thanks, Georg -- http://mail.python.org/m

Re: finding name of instances created

2005-01-23 Thread Georg Brandl
new_robot def __getattr__(self, name): if name in self: return self[name] raise AttributeError robots = Robots() robots.new('Bert') robots.new('Ernie') robots.Bert.sayhi() robots["Bert"].sayhi() for robot in robots: robot.sayhi() ... etc ... This doesn't include ugly globals() and exec "tricks". Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: What is print? A function?

2005-01-23 Thread Georg Brandl
devil-may-care attitude about punctuation > makes it difficult to tell for sure :-) And it should have been and perhaps will be a function in Python, see "Python Regrets" by GvR. Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: MySQLdb - Tuples

2005-02-02 Thread Georg Brandl
g. You don't need the parentheses for one element either: for person, in c: print person works perfectly. Note the trailing comma. Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: mounting a filesystem?

2005-02-05 Thread Georg Brandl
Dan Stromberg wrote: > Is there a python module that can mount a filesystem? > > More specifically, a loopback filesystem with a particular offset, under > linux? Why don't you just call the mount command via os.system, one of the popen methods or one of the commands.* methods

Re: Alternative to standard C "for"

2005-02-05 Thread Georg Brandl
ange(). It is completely equal to > range() except that it returns a generator instead of a list. Slight terminology glitch -- it does return an iterator, not a generator. Generators are functions that return iterators. regards, Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: Alternative to standard C "for"

2005-02-05 Thread Georg Brandl
Alex Martelli wrote: > Georg Brandl <[EMAIL PROTECTED]> wrote: > >> Slight terminology glitch -- it does return an iterator, not a >> generator. Generators are functions that return iterators. > > xrange returns an ITERABLE, not an ITERATOR. Videat: > &g

Re: Comparison of functions

2005-07-30 Thread Georg Neis
* Reinhold Birkenfeld <[EMAIL PROTECTED]> wrote: > Steven D'Aprano wrote: > 1+0j == 1 > 0 >> True > > (1+0j == 1) yields True, which is comparable to 0. "a == b > c" is equivalent to "a == b and b > c": >>> 1 == 1+0j > 0 Traceback (most recent call last): File "", line 1, in ? TypeError: ca

Features for a Python package manager?

2004-12-25 Thread Georg Brandl
with less features of course. Would this be acceptable? feel-free-to-comment-ly yours, Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: Features for a Python package manager?

2004-12-25 Thread Georg Brandl
mething which is > notoriously platform dependent. 2.4's subprocess module should probably > be used here, but I don't think Portage does, yet. OTOH, it's Gentoo, so > it wouldn't surprise me, either. :-) That's right, but I would just draw the line at Pytho

Re: Features for a Python package manager?

2004-12-26 Thread Georg Brandl
Robert Kern wrote: > Georg Brandl wrote: >> Robert Kern wrote: >> >>>Mike Meyer wrote: >>> >>>>Nick Coghlan <[EMAIL PROTECTED]> writes: >>>> >>>> >>>> >>>>>I don't know enough about Porta

Re: More elegant way to cwd?

2004-12-28 Thread Georg Brandl
I believe os.path.abspath and os.path.realpath are the same. > realpath is just an alias for abspath. Yes, on Windows. On UNIX systems, realpath resolves symbolic links while abspath doesn't. mfg Georg -- http://mail.python.org/mailman/listinfo/python-list

"specialdict" module

2005-04-03 Thread Georg Brandl
Hello, in follow-up to the recent "dictionary accumulator" thread, I wrote a little module with several subclassed dicts. Comments (e.g. makes it sense to use super), corrections, etc.? Is this PEP material? Docstrings, Documentation and test cases are to be provided later.

Re: "specialdict" module

2005-04-03 Thread Georg Brandl
raise err Although I'm not sure whether KeyError would be the right one to raise (perhaps a custom error?). > I don't ever have an itch for sorted dictionaries, as far as I can > remember, and I don't immediately understand the use of > keytransformdict. C

Re: "specialdict" module

2005-04-03 Thread Georg Brandl
faultvalue(0) instead of the tally approach and defaultdict.setdefaultfactory(list) instead of listappend. > 4. On super, no I don't think it's necessary or particularly desirable. > These > specializations have a close association with dict. dict.method(self,...) > feels > more appropriate in this case. Any other opinions on this? Thanks for the comments, mfg Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: "specialdict" module

2005-04-04 Thread Georg Brandl
Michael Spencer wrote: > Georg Brandl wrote: > >> >> I think I like Jeff's approach more (defaultvalues are just special >> cases of default factories); there aren't many "hoops" required. >> Apart from that, the names just get longer ;) > &

Re: "specialdict" module

2005-04-04 Thread Georg Brandl
ltkeytransformdict(defaultdict, keytransformdict): pass At least I hope so. This is another argument against the initializing of defaultfactory or keytransformer in __init__. mfg Georg Here comes the current module (keytransformdict should be working now for all dict methods): # specialdict - subcl

Re: "specialdict" module

2005-04-04 Thread Georg Brandl
Georg Brandl wrote: > Michele Simionato wrote: >> About not using super: you might have problems in multiple inheritance. >> Suppose I want to use both your defaultdict and a thirdpartdict. A >> subclass >> >> class mydict(defaultdict, thirdpartdict): &g

Re: re module non-greedy matches broken

2005-04-05 Thread Georg Brandl
> > > > """ REs are Regular Expressions, not parsers. There are problems for which there is no RE solution (I'm not implying that this is the case in your example). In any case, complex text processing should be done using tools better suited to this. In this case, HTMLParser seems like a reasonable choice. mfg Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: os.path query functions behavior incorrect?

2005-04-05 Thread Georg Brandl
gt;>>> Of course it does. This is not a problem with Unix-style filesystems because there a directory either exists or not. However, under Windows, the drive letters for floppies or CDs exists even if there is no media inserted. It is, of course, questionable whether isdir() and exists() should return True in this case. mfg Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: Best editor?

2005-04-05 Thread Georg Brandl
te me, for example constantly asking if I want to > enable a "recursive mini-buffer", which I have no clue about or > interest in. Epsilon is a well-done Emacs IMO. constantly? You seem to make fundamental mistakes using Emacs. Reading one or two tutorials could have helped. mfg Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: "specialdict" module

2005-04-05 Thread Georg Brandl
Georg Brandl wrote: > Hello, > > in follow-up to the recent "dictionary accumulator" thread, I wrote a > little module with several subclassed dicts. > > Comments (e.g. makes it sense to use super), corrections, etc.? Is this > PEP material? > > Docstrings

[RELEASED] Python 3.3.3 release candidate 2

2013-11-11 Thread Georg Brandl
gs to http://bugs.python.org/ Enjoy! - -- Georg Brandl, Release Manager georg at python.org (on behalf of the entire python-dev team and 3.3's contributors) -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.22 (GNU/Linux) iEYEARECAAYFAlKB1G4ACgkQN9GcIYhpnLAu5gCfRkfpnEs+rmtZ9i

Re: Self-defence

2013-11-17 Thread Georg Brandl
long as python-list is coupled to Usenet, there will be little to no barrier to posting, and the only way to get rid of trolls is to ignore them. Let the barrage of posts continue for a few more days; if he doesn't get replies he will get fed up eventually. cheers, Georg -- https://mail.python.org/mailman/listinfo/python-list

[RELEASED] Python 3.3.3 final

2013-11-18 Thread Georg Brandl
visit: http://www.python.org/download/releases/3.3.3/ This is a production release, please report any bugs to http://bugs.python.org/ Enjoy! - -- Georg Brandl, Release Manager georg at python.org (on behalf of the entire python-dev team and 3.3's contributors) [1] http://bugs.

[RELEASED] Python 3.3.4 release candidate 1

2014-01-26 Thread Georg Brandl
http://www.python.org/download/releases/3.3.4/ This is a preview release, please report any bugs to http://bugs.python.org/ The final version is scheduled to be released in two weeks' time, on or about the 10th of February. Enjoy! - -- Georg Brandl, Release Manager georg at pyth

[RELEASED] Python 3.3.4

2014-02-10 Thread Georg Brandl
http://bugs.python.org/ Enjoy! - -- Georg Brandl, Release Manager georg at python.org (on behalf of the entire python-dev team and 3.3's contributors) -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.22 (GNU/Linux) iEYEARECAAYFAlL5PMwACgkQN9GcIYhpnLCv4wCePNVqwsOYCHdJBi

pathlib type error

2015-01-03 Thread Georg Grafendorfer
t;) >>> q = p / "init.d" Traceback (most recent call last): File "", line 1, in TypeError: unsupported operand type(s) for /: 'PosixPath' and 'str' >>> On the same computer, using rescuecd 4.4.1 (Nov 2014) which ships python 3.4.1 it works as expected. thanks for help, Georg -- https://mail.python.org/mailman/listinfo/python-list

[RELEASED] Python 3.3.5 release candidate 1

2014-02-23 Thread Georg Brandl
nload Python 3.3.5 visit: http://www.python.org/download/releases/3.3.5/ This is a preview release, please report any bugs to http://bugs.python.org/ The final release is scheduled one week from now. Enjoy! - -- Georg Brandl, Release Manager georg at python.org (on behalf of the entire p

[RELEASED] Python 3.3.5 release candidate 2

2014-03-03 Thread Georg Brandl
nload Python 3.3.5 visit: http://www.python.org/download/releases/3.3.5/ This is a preview release, please report any bugs to http://bugs.python.org/ The final release is scheduled one week from now. Enjoy! - -- Georg Brandl, Release Manager georg at python.org (on behalf of the entire p

[RELEASED] Python 3.3.5

2014-03-09 Thread Georg Brandl
3.3.5 visit: http://www.python.org/downloads/release/python-335/ This is a production release, please report any bugs to http://bugs.python.org/ The final release is scheduled one week from now. Enjoy! - -- Georg Brandl, Release Manager georg at python.org (on behalf of the entire p

[RELEASED] Python 3.3.3 release candidate 1

2013-10-27 Thread Georg Brandl
to be released in two weeks' time, on or about the 10th of November. Enjoy! - -- Georg Brandl, Release Manager georg at python.org (on behalf of the entire python-dev team and 3.3's contributors) -BEGIN PGP SIGNATURE- Version: GnuPG v2.

Re: Problem installing matplotlib 1.3.1 with Python 2.7.6 and 3.3.3 (release candidate 1)

2013-11-03 Thread Georg Brandl
se open an issue on the Python bug tracker for the Python component of > this. > > http://bugs.python.org And please mark as release blocker, I think this should go into 3.3.3rc2. Georg -- https://mail.python.org/mailman/listinfo/python-list

[RELEASED] Python 3.2.6rc1, Python 3.3.6rc1

2014-10-04 Thread Georg Brandl
https://www.python.org/downloads/release/python-336rc1/ These are pre-releases, please report any bugs to http://bugs.python.org/ The final releases are scheduled one week from now. Enjoy! - -- Georg Brandl, Release Manager georg at python.org (on behalf of the entire python-dev team and contrib

[RELEASED] Python 3.2.6, Python 3.3.6

2014-10-12 Thread Georg Brandl
These are production versions, please report any bugs to http://bugs.python.org/ Enjoy! - -- Georg Brandl, Release Manager georg at python.org (on behalf of the entire python-dev team and contributors) -BEGIN PGP SIGNATURE- Version: GnuPG v2 iEYEARECAAYF

[RELEASED] Python 3.2.4 rc 1 and Python 3.3.1 rc 1

2013-03-25 Thread Georg Brandl
notice to: http://bugs.python.org/ To download Python 3.2.4 or Python 3.3.1, visit: http://www.python.org/download/releases/3.2.4/ or http://www.python.org/download/releases/3.3.1/ respectively. Enjoy! - -- Georg Brandl, Release Manager georg at python.org (on behalf of the entire

[RELEASED] Python 3.2.4 and Python 3.3.1

2013-04-06 Thread Georg Brandl
://www.python.org/download/releases/3.3.1/ respectively. As always, please report bugs to http://bugs.python.org/ Enjoy! - -- Georg Brandl, Release Manager georg at python.org (on behalf of the entire python-dev team and all contributors) -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.19 (GNU

Re: [RELEASED] Python 3.2.4 and Python 3.3.1

2013-04-06 Thread Georg Brandl
Am 06.04.2013 22:48, schrieb cmcp: > On Saturday, 6 April 2013 21:43:11 UTC+1, Georg Brandl wrote: >> -BEGIN PGP SIGNED MESSAGE- >> >> Hash: SHA1 >> >> >> >> On behalf of the Python development team, I am pleased to announce the &g

Re: Restricted Access

2006-07-11 Thread Georg Brandl
JavaScript replacement. (look in the python-dev archives for more) Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: Abuse of the object-nature of functions?

2006-07-11 Thread Georg Brandl
cies on the system stating what types of exceptions can > be raised? > > Is there a way in python to say, "hey, catch everything but these two"? Yes: try: ...some code... except (AttributeError, TypeError): raise except Exception, e: handle all other exceptions is

Re: inheritance, types, operator overload, head ache

2006-07-11 Thread Georg Brandl
gt;> > return self > > Oh, I see. I tried that and it worked well, but the broken int(obj) is > too annoying. The problem is that int() checks if the argument is a string (which includes subclasses) and directly tries to convert the string without looking at __int__. If you want, you can report this as a bug and see if other developers agree. Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: Abuse of the object-nature of functions?

2006-07-11 Thread Georg Brandl
... raise ex > ... > > Won't catch it! > Traceback (most recent call last): > File "", line 7, in ? > AttributeError > > Or that sort of thing. To just reraise an exception, use a bare "raise". Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: Abuse of the object-nature of functions?

2006-07-11 Thread Georg Brandl
s you don't want > to handle inherit from a small number of base classes; yours has the > advantage if there are a large number of unrelated exceptions that need > ignoring. His code is wrong since "err" is not the exception class but an instance. "if type(err) ..." would be correct but unpythonic. Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: timeit module for comparing the performance of two scripts

2006-07-12 Thread Georg Brandl
mmand-line switches should do something informative when run with a -h >> switch. >> > Doh! Me thinks Windows at work "python /?" (No good!), Linux at home > "python -h" (Ah ha!). I still think it should be in the docs somewhere. python /? now works in 2.5 SVN. Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: Coding style

2006-07-19 Thread Georg Brandl
s when an object of a builtin type is considered false (i.e. when it's empty). So why not take advantage of this? Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: Coding style

2006-07-19 Thread Georg Brandl
value of an object > don't give the expected result, happen often enough to make me > carefully think about what I want to test for and then explicitly > do so. You're right, carefully thinking is always a good thing. Not using a language feature just because it would fail in another case is not. Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: How to recognise "generator functions" ?

2006-07-19 Thread Georg Brandl
de.co_flags 99 => 32 (CO_GENERATOR in compiler.consts) is the flag that indicates a generator code object. Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I optimise this? [intended in good humour]

2006-07-25 Thread Georg Brandl
ons that you are comparing are not > even equivalent, and moreover you ignored an expression that will be > faster and equivalent (unless/until somebody decides on an > "optimisation" like interning/sharing strings between/among sys.argv > elements). Let me point out that len(argv) == 1 is the only one that will work if argv is []. ;) (took me a few seconds to realize I must put a smiley there) Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: New release of Diet Python (0.2 Beta)!!!

2006-07-27 Thread Georg Brandl
uot;PSF Python" are you referring to? I can't find a distribution that's 300 MB in size... Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: New release of Diet Python (0.2 Beta)!!!

2006-07-27 Thread Georg Brandl
I don't think it would be so large) you should not call that "PSF Python". The Python Windows installer available from python.org is around 10, the source distribution around 8 MB. Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: Ann: SE 2.2b

2006-08-06 Thread Georg Brandl
However, the PyPI page provides no download or homepage links. Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: Ann: SE 2.2b

2006-08-08 Thread Georg Brandl
at the bottom rather fast. If it's gone by the > time you check, type SE into the search template in the upper right corner. Thanks, but I know how to use the Cheese Shop. Last time I looked, there was no file available for download. Now it is. Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: singleton decorator

2006-08-08 Thread Georg Brandl
; class MyClass: > ... > > > Am I missing something here? What is the preferred pythonic way of > implementing singleton elegantly? You can always use the syntax the decorator replaces: class MyClass: ... MyClass = singleton(MyClass) But there are better ways, an

Re: do people really complain about significant whitespace?

2006-08-10 Thread Georg Brandl
er to > write a Python code formatter that adds them than it is to write a C code > formatter that adds proper indentation and provides your preferred > placement of braces. It's already there: Tools/scripts/pindent.py. Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: Optimization of __len__() in cgi.py

2006-08-16 Thread Georg Brandl
suggestions like this? Post a RFE to the Python Tracker at http://sourceforge.net/tracker/?group_id=5470&atid=355470 If you want, assign it to me (gbrandl). Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: sum and strings

2006-08-18 Thread Georg Brandl
sum up strings? Besides, the ''.join idiom is quite common in Python. In this special case, ''.join is much faster than sum() which is why sum() denies to concat strings. Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: Clean way to not get object back from instantiation attempt gone bad

2006-08-18 Thread Georg Brandl
> __init__() just do del(self), or is there > a better way to think about this? There is a way, of course, that results in myfoo being None in case of an error, but it is not a one-liner and I'd not recommend it. If something goes wrong, raising an exception is the best thing to do. Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: sum and strings

2006-08-18 Thread Georg Brandl
nd > works for some types but not for strings which seems an arbitrary > limitation that impede duck typing. Only that it isn't arbitrary. > - Pad. > > P.S. I can see why, and am used to the ''.join method. A newbie > introduced to sum for integers might n

Re: how do you get the name of a dictionary?

2006-08-18 Thread Georg Brandl
ure I could do something more > functional or one lined like: > > Banana={} > names = filter(lambda x:id(eval(x))==id(Banana),dir()) > > but I am guessing that it is harder to read by many. Anywho I can > think of plenty of reasons it would fail, but it really depends on the >

Re: sum and strings

2006-08-18 Thread Georg Brandl
Paul Rubin wrote: > Georg Brandl <[EMAIL PROTECTED]> writes: >> Why would you try to sum up strings? Besides, the ''.join idiom is quite >> common in Python. > > Just because it's common doesn't mean it's obvious. In my opinion > it&#x

Re: sum and strings

2006-08-19 Thread Georg Brandl
Bill Pursell wrote: > Georg Brandl wrote: >> Paul Rubin wrote: >> > Sybren Stuvel <[EMAIL PROTECTED]> writes: >> >> Because of "there should only be one way to do it, and that way should >> >> be obvious". There are already the str.

Re: import

2006-08-20 Thread Georg Brandl
t work. You can't import modules whose names have non-identifier names with plain "import". Or would you like "123" to refer to a module? If you have to do this (and I have a strong feeling that you haven't) use the built-in function __import__(). Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: import

2006-08-20 Thread Georg Brandl
01 wrote: > Georg Brandl wrote: >> [EMAIL PROTECTED] wrote: >> > bugnthecode 写道: >> > >> >> How are you trying to import it? Is it in the same directory as your >> >> other script? If not is your python path set correctly? >> >> >

Re: Input from the same file as the script

2006-08-20 Thread Georg Brandl
print x > > "Value intended for the variable x" > Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: sum and strings

2006-08-21 Thread Georg Brandl
just one of an infinite number of possible "traps for the unwary". > > I would have thought it would be better for sum() to raise a warning, not > an exception. If we take seriously the argument that sum implies > addition, and that string concatenation isn't really addition, then sum() > should also refuse to operate on lists and tuples and any other > non-numeric class. Either would be better than sum() "protecting" the user > from himself, except when it doesn't. Well, present that on python-dev. Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem of function calls from map()

2006-08-22 Thread Georg Brandl
l > > > > data = [ > "sldjflsdfj\tlsjdlj\tlkjsdlkfj", > "lsdjflsjd\tlsjdlfdj\tlskjdflkj", > "lskdjfl\tlskdjflj\tlskdlfkjsd", > ] > > def splitUsing(chars): > def tmp(s): > return s.split(chars) > return tmp > > for d in map(splitUsing('\t'), data): > print d And why is this better than map(lambda t: t.split('\t'), data) ? Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: CONSTRUCT - Module Attributes and Execution Environment

2006-08-22 Thread Georg Brandl
t;> else >> return false >> >> exec = ExecutionEnv() >> >> How to I get access to the CALLING_MODULE ? >> >> - >> >> Are ther alternative constructs/mechanism available, which could be >> used to add this functionality possiby direc

Re: how do you get the name of a dictionary?

2006-08-22 Thread Georg Brandl
class NamedDict(dict): def __init__(self, _name_, *args, **kwargs): self.name = _name_ dict.__init__(self, *args, **kwargs) Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: how do you get the name of a dictionary?

2006-08-22 Thread Georg Brandl
on't? Python doesn't attempt to track what name > they are known at *now*, just the name they were born with. Because they're not created by simple assignment, because they are usually created once, because new names are bound to them rarely, and because it's crucial to know their name in debugging, introspection etc. Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: how do you get the name of a dictionary?

2006-08-23 Thread Georg Brandl
letely meaningless. When a name goes out of scope, but the object continues to live (e.g. because it's returned by some function), the name is void. Etc. Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Aug 23)

2006-08-23 Thread Georg Brandl
Jack Diederich wrote: > QOTW: "Because there's no chance that the original request is sane." - Georg > Brandl (responding to a question involving a Banana) Looks like I'm trying to fulfil my bot duties from time to time ;) > "this is one of your last chances

Re: What value should be passed to make a function use the default argument value?

2006-10-04 Thread Georg Brandl
most Python documentation: you're not told if the described function is implemented in C, and if it is keyword arg-enabled. The arguments must be given names though, to be able to document them. Georg -- http://mail.python.org/mailman/listinfo/python-list

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

2006-10-05 Thread Georg Brandl
No, it's saying: "if the Python community is able to provide the required amount of time to do the admin work, we'll use the tool written in Python." > Anyway. The whole selection process is intransparent. Steve has already pointed you to the wiki page. Georg -- http://mail.python.org/mailman/listinfo/python-list

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

2006-10-05 Thread Georg Brandl
Fredrik Lundh wrote: > Georg Brandl wrote: > >>> The python foundation suggests a non-python non-open-source bugtracking >>> tool for python. >> >> Actually, it suggests two bugtracking tools, one of them written in >> Python. > > the announcema

Re: Metaprogramming question

2006-10-06 Thread Georg Brandl
gt; instance() argument 1 must be classobj, not type" ... > > So my question is, how to replicate new.instance() functionality with new > classes? Use object.__new__. Georg -- http://mail.python.org/mailman/listinfo/python-list

Re: Automatic import PEP

2006-10-06 Thread Georg Brandl
tem__(self, name): try: return dict.__getitem__(self, name) except KeyError: exc = sys.exc_info() try: return __import__(name) except ImportError: raise exc[0], exc[1], exc[2] d = LazyImpDict() code.i

Re: operator overloading + - / * = etc...

2006-10-07 Thread Georg Brandl
There is a possibility to do that with globals, provided you do exec code in globals_dict where globals_dict is an instance of a subclass of dict that has a customized __setitem__. Georg -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   >