utf-8 read/write file

2008-10-08 Thread Bruno
Hi! I have big .txt file which i want to read, process and write to another .txt file. I have done script for that, but im having problem with croatian characters (Š,Đ,Ž,Č,Ć). How can I read/write from/to file in utf-8 encoding? I read file with fileinput.input. thanks -- http://mail.python.o

Numpy compatibility issue (python 2.6)

2009-04-29 Thread bruno
It seems that some TypeError messages have changed between versions 2.5 and 2.6, e.g.: from math import radians radians () in 2.5, this leads to "radians () takes exactly 1 argument (0 given)" whereas in 2.6, the message is now: "radians () takes exactly one argument (0 given)" I agree that the

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Alysson Bruno
format(one_number)) number=1,234,567 >>> paz e amor (love and peace), Alysson Bruno === Palmas(TO) Brasil Blog: http://abruno.com Twitter: http://twitter.com/alyssonbruno Facebook: http://www.facebook.com/ProfessorAlyssonBruno ===

why does dead code costs time?

2012-12-05 Thread Bruno Dupuis
mmhh... it comes to me now that the gap must be in function loading time... I'll check ceval.c However, isn't there a room for a slight optim here? (in this case, the dead code is obvious, but it may be hidden by complex loops and conditions) Cheers -- Bruno Dupuis -- http://mail.python.org/mailman/listinfo/python-list

Re: why does dead code costs time?

2012-12-05 Thread Bruno Dupuis
On Wed, Dec 05, 2012 at 04:15:59PM +, Neil Cerutti wrote: > On 2012-12-05, Bruno Dupuis wrote: > > Hi, > > > > I'm interested in compilers optimizations, so I study python > > compilation process > > > > I ran that script: > > > >

Re: why does dead code costs time?

2012-12-05 Thread Bruno Dupuis
On Wed, Dec 05, 2012 at 05:40:51PM +0100, Bruno Dupuis wrote: > On Wed, Dec 05, 2012 at 04:15:59PM +, Neil Cerutti wrote: > > Maybe it's the difference between LOAD_CONST and LOAD_GLOBAL. We > > can wonder why g uses the latter. > > Good point! I didn't even no

Re: How does one make argparse print usage when no options are provided on the command line?

2012-12-05 Thread Bruno Dupuis
a separate usage statement. So they used argparse for everything but the > case where no command line args are given. > this is quite raw, but i'd add import sys if len(sys.argv) == 1: sys.argv.append('-h') before I call parser.parse_args() Should work -- Bruno Dup

Re: why does dead code costs time?

2012-12-05 Thread Bruno Dupuis
gt;>> def f(x): > ... return None > ... print(x) > ... > >>> f('test') > 42 This one is pretty scary The difference between `return None` and `return` leads to inconsistency and is in contradiction with the specs, AFAIK. I'm glad we pointed this out. -- Bruno Dupuis -- http://mail.python.org/mailman/listinfo/python-list

Re: why does dead code costs time?

2012-12-05 Thread Bruno Dupuis
On Wed, Dec 05, 2012 at 03:41:19PM -0500, Terry Reedy wrote: > On 12/5/2012 1:24 PM, Bruno Dupuis wrote: > >On Wed, Dec 05, 2012 at 10:59:26AM -0700, Ian Kelly wrote: > >>On Wed, Dec 5, 2012 at 10:34 AM, Steven D'Aprano > >> wrote: > >>>The difference

Re: why does dead code costs time?

2012-12-05 Thread Bruno Dupuis
I added a patch on the issue tracker. It solves the bug for short (<32700 bytes) functions ref : http://bugs.python.org/file28217/16619-1.patch -- Bruno Dupuis -- http://mail.python.org/mailman/listinfo/python-list

Re: Confused compare function :)

2012-12-05 Thread Bruno Dupuis
On Wed, Dec 05, 2012 at 11:50:49PM +0100, Anatoli Hristov wrote: > I'm confused again with a compare update function. The problem is that > my function does not work at all and I don't get it where it comes > from. > > in my DB I have total of 754 products. when I run the function is says: > Total

Re: Confused compare function :)

2012-12-06 Thread Bruno Dupuis
On Thu, Dec 06, 2012 at 04:32:34AM +, Steven D'Aprano wrote: > On Thu, 06 Dec 2012 03:22:53 +, Rotwang wrote: > > > On 06/12/2012 00:19, Bruno Dupuis wrote: > >> [...] > >> > >> Another advice: never ever > >> > >> except XXXE

Re: Where to contribute Unicode General Category encoding/decoding

2012-12-13 Thread Bruno Dupuis
Therefore, it's often better to make a package on PyPI, or, if the code is too short, to submit your handy chunks on ActiveState. If it deserves a general approbation, it may be included in Python stdlib. Cheers -- Bruno -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get the selected text of the webpage in chrome through python ?

2013-01-08 Thread Bruno Dupuis
nd dirty call to xclip -o, although there must be a pure python implementation which in turn depends on the python framework you play with (gtk/qt/wx/tk/...). Short answer is : it depends on your system, and it may be easier and more portable if you use a graphical toolkit. cheers. -- Brun

Instituições que utilizam Python.

2011-08-29 Thread Bruno Andrade
instituições que criam aplicações para terceiros usando a linguagem Python. Acredito que talvez, vocês contenham uma lista com essas instituições que utilizam Python. Desde já agradeço a sua atenção; Muito Obrigado; Att; Bruno Andrade. -- http

Re: Compute working days

2021-08-18 Thread Bruno Lirio
Em sábado, 14 de março de 2009 às 13:59:41 UTC-3, Casey escreveu: > How about: > from datetime import date, timedelta > # Define the weekday mnemonics to match the date.weekday function > (MON, TUE, WED, THU, FRI, SAT, SUN) = range(7) > def workdays(start_date, end_date, whichdays=(MON,TUE,WED,THU,

Python and Flask Book

2021-10-28 Thread Bruno Oliveira
&usg=AOvVaw2RFbMdp7h-toAR8c8BELtO> Best regards, Bruno -- https://mail.python.org/mailman/listinfo/python-list

Re: Newbie regular expression and whitespace question

2005-09-22 Thread Bruno Desthuilliers
googleboy a écrit : > Hi. > > I am trying to collapse an html table into a single line. Basically, > anytime I see ">" & "<" with nothing but whitespace between them, I'd > like to remove all the whitespace, including newlines. I've read the > how-to and I have tried a bunch of things, but noth

Re: Wrapping classes

2005-09-23 Thread bruno modulix
self, name): self.name = name def greet(self, who): return "hello %s, my name is %s" % (who, self.name) lazy1 = LazyProxy(Greeter, 'toto') print lazy1.greet('titi') lazy2 = LazyProxy(Greeter, 'lolo') lazy2.name =

Re: Wrapping classes

2005-09-23 Thread bruno modulix
; TypeError: eval() argument 3 must be dict, not Foo > > If you subclass dict it doesn't call the __getitem__ method. Could it work with a UserDict subclass ? -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.python.org/mailman/listinfo/python-list

Re: Need to pass Object by value into a list

2005-09-26 Thread Bruno Desthuilliers
Aaron a écrit : > I have a data sructure setup and I populate it in a loop like so: > > y=0 > while X: >DS.name = "ASDF" >DS.ID = 1234 >list[y] = DS; >y = y + 1 > > print list Traceback (most recent call last): File "", line 1, in ? File "/usr/tmp/python-9150sSF", line 2,

Re: Carrying variables over from function to function

2005-09-26 Thread Bruno Desthuilliers
Ivan Shevanski a écrit : > Alright heres my problem. . .Say I want to carry over a variable from > one function to another or even another run of the same function. Is > that possible? Heres a quick example of what I'm talking about. > > def abc(): >x = 1 >y = x + 1 >print y > > def

Re: Carrying variables over from function to function

2005-09-27 Thread bruno modulix
Peter Otten wrote: > Bruno Desthuilliers wrote: > > >>2/ functional solution: >>--- >>def make_funcs(): >>x = 0 >>def _abc(): >>x = 1 >>return x + 1 >>def _abcd(): >>re

Re: PEP 350: Codetags

2005-09-28 Thread Bruno Widmann
On 2005-09-26, Micah Elliott <[EMAIL PROTECTED]> wrote: > > :Objection: I aesthetically dislike for the comment to be terminated > with <> in the empty field case. > > :Defense: It is necessary to have a terminator since codetags may be > followed by non-codetag comments. Or codetags could

Re: Module organization

2005-09-28 Thread bruno modulix
TION00840 > Is there a trick to this? Do I have to store my own modules beneath > C:\Python24\Lib? or can I use the organization I've tried just with some > minor fixes to make python locate my modules? briefly put, add an (even empty) __init__.py file in your lvk di

Re: Zope3 Examples?

2005-09-29 Thread bruno modulix
fers 'the best from Plone', (s/plone/cmf/ IMHO), it's about framework/system architecture, not OOTB application. -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.python.org/mailman/listinfo/python-list

Re: "no variable or argument declarations are necessary."

2005-10-03 Thread bruno modulix
hat this combination (dynamic typing + [pylint|pychecker] + unit tests) usually leads to fewer bugs than just relying on declarative static typing. What you fear can become reality with some (poorly designed IMHO) scripting languages like PHP, but should not be a concern with Python. Try working with

Re: "no variable or argument declarations are necessary."

2005-10-03 Thread bruno modulix
rror message will be pretty clear actually :) > > > Now why, I wonder, does this loop never end :-) > egold = 0 > while egold < 10: > ego1d = egold+1 > A more pythonic style would be: egold = 0 while egold < 10: ego1d += 1 And that o

Re: "no variable or argument declarations are necessary."

2005-10-03 Thread bruno modulix
I don't use emacs automatic completion, and I still rarely (read: 'never') run into this kind of problem in Python. -- bruno desthuilliers ruby -e "print '[EMAIL PROTECTED]'.split('@').collect{|p| p.split('.').collect{|w| w.reverse}.join('.')}.join('@')" -- http://mail.python.org/mailman/listinfo/python-list

Re: Will python never intend to support private, protected and public?

2005-10-03 Thread bruno modulix
hether the other class's author was > notified or not. > > It's better to let the compiler automatically flag > these things, than to depend on conventions. Nope. *you* think it's better. Most of us here obviously think that relying on convention is a good (and even better) so

Re: Which SQL module to use?

2005-10-04 Thread Bruno Desthuilliers
mrstephengross a écrit : > I'd like to do some basic SQL stuff in Python. It seems like there are > a heck of a lot of SQL modules for Python. What's the simplest and > easiest one to use? Probably the one that go with your RDBMS. -- http://mail.python.org/mailman/listinfo/python-list

Re: "no variable or argument declarations are necessary."

2005-10-05 Thread bruno modulix
ion was the OP's reaction, not Antoon's. -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.python.org/mailman/listinfo/python-list

Re: So far

2005-10-06 Thread bruno modulix
CppNewB wrote: > I am absolutely loving my experience with Python. Even vs. Ruby, the syntax > feels very clean with an emphasis on simplification. > > My only complaint is that there doesn't appear to be a great commercial IDE Why "commercial" ? -- bruno des

Re: Python interpreter bug

2005-10-07 Thread bruno modulix
def __init__(self,identifier): self.id=identifier self.allocated=identifier and rerun the test. I don't think this is a bug... -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's Performance

2005-10-09 Thread Bruno Desthuilliers
Laszlo Zsolt Nagy a écrit : > Dave wrote: > >> Hello All, >> >> I would like to gather some information on Python's runtime >> performance. As far as I understand, it deals with a lot of string >> objects. Does it require a lot string processing during program >> execution? How does it handle

Re: Python's Performance

2005-10-12 Thread bruno modulix
Alex Stapleton wrote: > > On 9 Oct 2005, at 19:04, Bruno Desthuilliers wrote: > > >> Laszlo Zsolt Nagy a écrit : (snip) >>> Do you want to know how many internal string operations are done inside >>> the Python interpreter? I believe it is not a useful in

Re: Python's Performance

2005-10-12 Thread bruno modulix
ava and Python here is that Python is smart enough to call the compiler by itself. -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.python.org/mailman/listinfo/python-list

Re: Very dumb question

2005-10-12 Thread bruno modulix
now what am I doing wrong. Do > you have an idea? I assume the code snippets are exact copy/paste so this is not a typo (like print data[51:] ...) - and I can't reproduce it here... even with a string of 20381 characters. mmm... type(data) ??? -- bruno desthuilliers python -c "prin

Re: [newbie]Is there a module for print object in a readable format?

2005-10-17 Thread bruno modulix
James Gan wrote: > I want the object printed in a readable format. For example, > x =[a, b, c, [d e]] will be printed as: > x--a > |_b > |_c > |___d >|_e > > I tried pickled, marshel. They do different work. > > Is there another > module which do thi

Re: Question on class member in python

2005-10-17 Thread bruno modulix
r is a bound method. You could have found this by yourself... Note that the getter/setter plague is useless and unpythonic. Use properties instead if you need to control attributes access. There are decorator idioms to make clean and easy properties, look here: http://wiki.python.org/moin/Pyth

Re: Problems with properties

2005-10-17 Thread bruno modulix
[EMAIL PROTECTED] wrote: > If you change it to this it works. You should provide a get and a set > function for a property. The OP did: -> command=property(getCommand, setNothing) -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w

Re: override a property

2005-10-17 Thread Bruno Desthuilliers
Robin Becker a écrit : > Is there a way to override a data property in the instance? Do I need to > create another class with the property changed? Do you mean attributes or properties ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Vim capable IDE?

2005-10-18 Thread bruno modulix
oogling and IDE project-page > browsing. :-( What about a Python IDE that embed Vim as it's editor ? http://pida.berlios.de/index.php/Main_Page HTH -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in &#

Re: override a property

2005-10-18 Thread bruno modulix
Robin Becker wrote: > Bruno Desthuilliers wrote: > >> Robin Becker a écrit : >> >>> Is there a way to override a data property in the instance? Do I need >>> to create another class with the property changed? >> >> >> >> Do you mean

Re: Python vs Ruby

2005-10-20 Thread bruno modulix
mming ruby" from www.ruby-lang.org/en. the download > python and spend a day or two reading the python tuturial from > www.python.org. Or better: DiveIntoPython -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.

Re: Python vs Ruby

2005-10-20 Thread bruno modulix
somewhat more mature (which is not surprising since Python is a little bit older than Ruby). Else, both are hi-level highly dynamic object oriented languages, both are fun to program with, and both are easy to get started with. So the best thing to do is to give both a try and go with the one that

Re: Popularity of blogging tools used by python programmers

2005-10-20 Thread Bruno Desthuilliers
Stewart Midwinter a écrit : > I've made a comparison of the relative popularity of blogging tools > used by python programmers. I was surprised by the number of python > developers not using python for their blogs; isn't that like GM > employees driving Toyota cars? > > See my post at: > > http:

Re: A macro editor

2005-10-21 Thread bruno modulix
u'd better find some non-programmers having learn Ruby in a similar context and ask them about this (with the buzzword around Rails, you find such people easily...) -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.python.org/mailman/listinfo/python-list

Re: Python vs Ruby

2005-10-21 Thread bruno modulix
to the mainstream but is worth giving a try is Smalltalk - the father of OOPLs (Simula being the GrandFather). BTW, most of Ruby's feature have been happily stolen from Smalltalk !-) > I've never given Perl a shot. It was another language I considered learning, > but my father's fr

Re: Python vs Ruby

2005-10-24 Thread bruno modulix
Michael Ekstrand wrote: > On Friday 21 October 2005 07:07, bruno modulix wrote: > >>>>Python is more like Java. >> >> >>Err... Python is more like what Java would have been if Java was a >>smart dynamic hi-level object oriented language !-) >> &g

Re: [OT] Python vs Ruby

2005-10-24 Thread bruno modulix
Scott David Daniels wrote: > bruno modulix wrote: > >> ... Another language that failed to make it to the mainstream but is >> worth giving a try is Smalltalk - the father of OOPLs (Simula being the >> GrandFather). > > I would say Simula is the forefather of

Re: Python vs Ruby

2005-10-24 Thread bruno modulix
at colons s/at/add/ > at the end of the def > and while statements, and this is also valid Python. -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.python.org/mailman/listinfo/python-list

Re: Zope and Persistence

2005-10-24 Thread bruno modulix
is only > supposed to store an integer in Data.fs. Thanks. This is another problem, and I think you'd better start with the zope book. But for you current use case, first have a look at Zope's access log. -- bruno desthuilliers python -c "print '@'.join(['.

Re: Tricky Areas in Python

2005-10-24 Thread bruno modulix
PyPK wrote: > hmm Thats one thing. Also I was thinking of something like benefites of > python over other languages. That's fairly context-dependant *and* subjective. -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('

Re: Hi All - Newby

2005-10-25 Thread bruno modulix
. So "windows formatting" isn't a Python problem - it's specific to to toolkit you're using. Since we don't know which you're using, there's no way to answer your question. -- bruno desthuilliers python -c "print '@'.join(['.'.jo

Re: [OT] Python vs Ruby

2005-10-25 Thread bruno modulix
Scott David Daniels wrote: > bruno modulix wrote: > >> Scott David Daniels wrote: >> >>> bruno modulix wrote: >>> >>>> ... Another language that failed to make it to the mainstream but is >>>> worth giving a try is Smalltalk - the fat

Re: Tricky Areas in Python

2005-10-25 Thread bruno modulix
3 is the standard in many > OSes, so it is possibly not the most portable solution filter(isbad, somelist) -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.python.org/mailman/listinfo/python-list

Re: Setting Class Attributes

2005-10-25 Thread Bruno Desthuilliers
the.theorist a écrit : > I have a small, simple class which contains a dictionary (and some > other stuff, not shown). I then have a container class (Big) that holds > some instances of the simple class. When I try to edit the elements of > the dictionary, all instances obtain those changes; I want

Re: security

2005-10-25 Thread Bruno Desthuilliers
Mattia Adami a écrit : > Hi to all. > I'm intristing in write a plugin for browsers that can execute python > code. > I know the main problem is security. Many thread were opened about this > in the ng. > I would know if fork python rewriting some library could avoid > problems. I.e. one problem is

Re: assignment to reference

2005-10-26 Thread Bruno Desthuilliers
Loris Caren a écrit : > If > > a = 'apple' > b = 'banana' > c = 'cabbage' > > How can I get something like:- > > for i in 'abc': > r = eval(i) > if r == 'cabbage': r = 'coconut' > > actually change the object referenced by r rather > than creating a new object temporarily referenced

Re: How to replace all None values with the string "Null" in a dictionary

2005-10-29 Thread Bruno Desthuilliers
dcrespo a écrit : >>I think it would be time for you to read the Fine Manual... > > > hi, thanks for your answer... I really did it the same way you > suggested, but I forgot to tell you that I wanted to get a better way > for doing it. Let us know if you find one... > > By the way, knowing yo

Re: expanding dictionary to function arguments

2005-11-02 Thread Bruno Desthuilliers
Noah a écrit : > I have a dictionary that I would like to expand to satisfy a > function's agument list. I can used the ** syntax to pass a dictionary, > but > this only works if each key in the dictionary matches an argument. > I cannot pass a dictionary that has more keys than the function has >

Re: when and how do you use Self?

2005-11-03 Thread Bruno Desthuilliers
Jeffrey Schwab a écrit : > bruno at modulix wrote: > >> Steven D'Aprano wrote: >> >>> On Thu, 03 Nov 2005 10:14:23 +0100, bruno at modulix wrote: >>> >>>> Tieche Bruce A MSgt USMTM/AFD wrote: >>>> >>>>> I am new to

Re: when and how do you use Self?

2005-11-03 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : > On Thu, 03 Nov 2005 20:19:03 +0100, bruno at modulix wrote: > > >>Steven D'Aprano wrote: >> >>>On Thu, 03 Nov 2005 10:14:23 +0100, bruno at modulix wrote: >>> >>> >>> >>

Re: when and how do you use Self?

2005-11-07 Thread Bruno Desthuilliers
Tieche Bruce A MSgt USMTM/AFD a écrit : > Well, thanx for all the ... useful information. > > I thought that I would try, but this has turned out to be a waist of my time. > > Have fun playing with your egos s/your egos/words/ If you can't stand a joke (possibly very bad, but that's another po

Re: Diff. between Class types and classic classes

2005-11-08 Thread Bruno Desthuilliers
Colin J. Williams a écrit : > bruno at modulix wrote: > >> venk wrote: >> >>> Hi, >>> can some one properly explain the differences between class types and >>> classic classes? ... Still face problems in identifying what is what. >> >&g

Re: derived / base class name conflicts

2005-11-12 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Your suggestion ('_name' -> implementation, 'name' -> API) This is not "my" convention, it's *the* (mostly agreed upon) Python convention. Like 'self', or CONSTANT, or a whole lot of things in Python. > makes sense > as a convention between programmers that know a

Re: Multikey Dict?

2005-11-12 Thread Bruno Desthuilliers
David Rasmussen a écrit : > If I have a collection of dicts like: > > john = {'id': 1, 'name': "John Cleese", 'year': 1939} > graham = {'id': 2, 'name': "Graham Chapman", 'year': 1941} > > I could store all of them in a list. But for easy lookup, I might store > all these in a dict instead, like

Re: Multikey Dict?

2005-11-12 Thread Bruno Desthuilliers
Sam Pointon a écrit : >>If I could just say to Python: john and graham (and ...) are all a part >>of a "superdict" and either their id or their name can be used as keys. > > >>Can I do that somehow? > > > Sure you can. There are two obvious ways to do this - enlist the aid of > a Superdict (or

Re: Python Book

2005-11-13 Thread Bruno Desthuilliers
David Rasmussen a écrit : > What is the best book for Python newbies (seasoned programmer in other > languages)? I don't know if it's the "best", but a DiveIntoPython/PythonCookbook combo may be a good choice. -- http://mail.python.org/mailman/listinfo/python-list

Re: Copyright [was Re: Python Obfuscation]

2005-11-13 Thread Bruno Desthuilliers
Erik Max Francis a écrit : > David T wrote: > >> Individuals, and perhaps groups of individuals are the creators of >> works. > > > When someone pays you to create a work, then they own the copyright, Depends on the country's laws and the exact agreement. -- http://mail.python.org/mailman/l

Re: Python obfuscation

2005-11-15 Thread Bruno Desthuilliers
The Eternal Squire a écrit : > Without copyright, how could one possibly earn a living writing a > novel? Without copyright, how could one possibly earn a living writing programs?-) -- http://mail.python.org/mailman/listinfo/python-list

Re: creating package question

2005-11-16 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > I think I have an answer to my own question. In the > WindowsComponents/__init__.py file, I have the following, that feels > like a better answer for the problem. Is there a better answer than > this? > > import os, sys > sys.path.append(os.path.join(os.getcwd(), 'C

Re: Zope vs Php

2005-11-17 Thread Bruno Desthuilliers
Steve a écrit : > We are building a web app and the our backend is currently using python > with php front end. We would like to do everything in python but php > for our front end is so easy to use. We would like to use zope on our > front end(no experience with it) can anyone provide any experi

Re: about try and exception

2005-11-19 Thread Bruno Desthuilliers
Shi Mu a écrit : > On 11/17/05, Carl J. Van Arsdall <[EMAIL PROTECTED]> wrote: > (Carl's top-post corrrected. Carl, please do not top-post) >> >> >>Ben Bush wrote: >> >>>I wrote the following code to test the use of "try...exception", >>>and I want n to be printed out. However, the following code'

Re: examining python objects

2005-11-19 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Is there a function/class/module/whatever I can use to > look at objects? I want something that will print the object's > value (if any) in pretty-printed form, and list all it's attributes > and their values. And do all that recursively. > I want to be able to find

Re: Confused about namespaces

2005-11-19 Thread Bruno Desthuilliers
KvS a écrit : > Ok, makes sense but didn't seem "natural" to me, It will seem more natural if you understand that modules should be modulars (ie: low coupling, high cohesion). A module should *never* bother about no rely upon other modules being imported by the module it imports itself. Err, n

Re: Is Python weak on the web side?

2005-11-20 Thread Bruno Desthuilliers
Tony a écrit : > If I'd like to learn Python for web-development, what are the options > available? There are too many *good* options for web developpement in Python. > Thanks. tony -- http://mail.python.org/mailman/listinfo/python-list

Re: ownership problem?

2005-11-20 Thread Bruno Desthuilliers
Gabriel Zachmann a écrit : > Is it correct to say that the typical ownership problem, which > frequently arises in C++, does not occur normally in Python? What is this "typical ownership problem" ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Underscores in Python numbers

2005-11-20 Thread Bruno Desthuilliers
Raymond Hettinger a écrit : > Gustav Hållberg wrote: > >>I tried finding a discussion around adding the possibility to have >>optional underscores inside numbers in Python. This is a popular option >>available in several "competing" scripting langauges, that I would love >>to see in Python. >> >>E

Re: Request opinion on web application framework

2005-12-04 Thread Bruno Desthuilliers
Thomas a écrit : > Hello, > > I am new to web programming but have some experience in technical > programming in Python and other languages. I need to build a networked > program which I would like to first deploy on an intranet and later on the > web which provides access to a few technical a

Re: Another newbie question

2005-12-08 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > > I'm off to study the code. (Hmm.. how does python parse ("green", > "red")[(i * 8 + j) % 2] command ... ("green", "red")[0] == "green" ("green", "red")[1] == "red" (i * 8 + j) is somewhat trivial (just take care of precedence order), and will return an integer

Re: Working with flat files [LDIF].

2005-01-05 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : Scott A. McIntyre wrote: I looked around but didn't see any LDIF tools for perl or python... Any assistance or advice is appreciated!! Scott Hello Scott, Did you ever get this issue resolved? I have a similar need to merge two LDIF files. I did find a program called m

Re: Getting rid of "self."

2005-01-07 Thread Bruno Desthuilliers
her black magic? The better way is definitively to forget about black magic and understand why mandatory 'self' is Good Thing (tm). (Tip : even when [this|self|@|whatsoever] is not mandatory, using it makes for much more readable code.) Bruno -- http://mail.python.org/mailman/listinfo/python-list

Re: tuples vs lists

2005-01-08 Thread Bruno Desthuilliers
worzel a écrit : I get what the difference is between a tuple and a list, but why would I ever care about the tuple's immuutability? Because, from a purely pratical POV, only an immutable object can be used as kay in a dict. So you can use tuples for 'composed key'.

Re: tuples vs lists

2005-01-10 Thread Bruno Desthuilliers
Antoon Pardon a écrit : Op 2005-01-08, Bruno Desthuilliers schreef <[EMAIL PROTECTED]>: worzel a écrit : I get what the difference is between a tuple and a list, but why would I ever care about the tuple's immuutability? Because, from a purely pratical POV, only an immutable object c

Re: Pointer or unique id

2005-01-15 Thread Bruno Desthuilliers
er Return a hash value for the object. Two objects with the same value have the same hash value. The reverse is not necessarily true, but likely. HTH Bruno -- http://mail.python.org/mailman/listinfo/python-list

Re: CONTEST - What is the (best) solution?

2005-02-02 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : In a file there can be several dictionaries like this (snip) I need to read only the the first and the last dictionaries.What is a best solution? Depends on your definition of 'best solution'. -- http://mail.python.org/mailman/listinfo/python-list

Re: IDLE history, Python IDE, and Interactive Python with Vim

2005-02-03 Thread Bruno Desthuilliers
Daniel Bickett a écrit : This is certainly a worthy topic. There are several IDEs for Python (one I like very much being Komodo) that have plenty of fancy debugging features and advanced operations, however I have yet to encounter (elsewhere) the convenience that comes with being able to press F5 a

Re: IDLE history, Python IDE, and Interactive Python with Vim

2005-02-03 Thread Bruno Desthuilliers
Pierre Barbier de Reuille a écrit : Fuzzyman a écrit : If you use IPython for your interactive mode stuff, you'll have a nice history... Regards, Fuzzy http://www.voidspace.org.uk/python/index.shtml Best event : if your "EDITOR" system variable in "vim", using the "ed" command in ipython will brin

Re: sos!

2005-02-05 Thread Bruno Desthuilliers
jordan2856977 a écrit : hellow everybody! I'm from china. I'm a beginner of python. in china, python is not a fashionable language, so it's difficult to find some books about python. finally,I find a book named "python how to program" wrote by H.M.Deitel . who can tell me where can I find some inte

Re: who can tell me BASICS of Python

2005-02-05 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : I want to know which compiler I can use ... thank you To compile what ? Python code ? The compiler is in the standard lib. -- http://mail.python.org/mailman/listinfo/python-list

Re: Error!

2005-02-05 Thread Bruno Desthuilliers
Steve Holden a écrit : (snip) So, for example, your program might look like this: base_price = int(raw_input(...)) tax_rate = int(raw_input(...) tax_amount = base_price * ((100+tax_amount)/...) s/(100+tax_amount)/(100 + tax_rate)/, I guess ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Definitive documentation on newstyle classes? (WAS: Pickling and inheritance are making me hurt)

2005-02-05 Thread Bruno Desthuilliers
nded me that in the past I've never been able to very good, definitive documentation on newstyle classes. Well, the fact is that __[get|set]state__() have nothing to do with new style classes, but with the Pickle protocol: http://www.python.org/doc/2.3.4/lib/pickle-inst.html (snip) Bruno -- ht

Re: noob question

2005-06-27 Thread bruno modulix
[EMAIL PROTECTED] wrote: > Hi Matt, > I also am almost a newbie (in Python) and my approach to variable > naming > follows more or less the Hungarian Type Notation Defined. which is seen as a bad practice anywhere outside Win32... http://mindprod.com/jgloss/unmainnaming.html

Re: delphi to python converter

2005-06-27 Thread bruno modulix
Thys Meintjes wrote: > Greets, > > I have need of a Delphi/pascal to python converter. Googling didn't > suggest any obvious leads so I'm trying here... Have you tried with "python/delphi programer" ?-) -- bruno desthuilliers python -c "print '@

Re: Newbie: Help Figger Out My Problem

2005-06-28 Thread bruno modulix
for i in xrange(flips): coins[randrange(0, 2)] += 1 return coins[0], coins[1] if __name__ == "__main__": flips = 100 heads, tails = flip_coins(flips) print "Heads: %d\nTails %d\nTotal: %d flips\n" % (heads, tails, flips) #raw_input("Pre

Re: Dictionary to tuple

2005-06-28 Thread bruno modulix
'one',2:'two',3:'three'} tup = tuple(dic.items()) The bad news is that dict are *not* ordered, so you'll have to sort the result yourself if needed :( The good news is that sorting a sequence is a no-brainer too !-) > I must also add that I'm new to Pytho

Re: Modules for inclusion in standard library?

2005-06-28 Thread bruno modulix
George Sakkis wrote: > I'd love to see IPython replace the standard interpreter. I dont. -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionary to tuple

2005-06-28 Thread bruno modulix
Tim Williams (gmail) wrote: (snip) >>>>d = {1:'one',2:'two',3:'three'} >>>>t = tuple([(k,v) for k,v in d.iteritems()]) Err... don't you spot any useless code here ?-) (tip: dict.items() already returns a list of (k,v) tuples...) --

  1   2   3   4   5   6   7   8   9   10   >