PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-21 Thread Martin v. Löwis
I'm proposing the following PEP for inclusion into Python 3.1. Please comment. Regards, Martin PEP: 383 Title: Non-decodable Bytes in System Character Interfaces Version: $Revision: 71793 $ Last-Modified: $Date: 2009-04-22 08:42:06 +0200 (Mi, 22. Apr 2009) $ Author: Martin v. Löwis Status: Draft

Re: Hello everyone!

2009-04-21 Thread Dotan Cohen
> I'm a newby here, I love python very much. > Is there any Chinese here? http://wiki.python.org/moin/LocalUserGroups#China You also might want to start a Chinese mailing list and add it here: http://mail.python.org/mailman/listinfo -- Dotan Cohen http://what-is-what.com http://gibberish.co.il

Re: Any adv. in importing a module and some objects in the same module, into the same file?

2009-04-21 Thread Gabriel Genellina
En Mon, 20 Apr 2009 02:22:08 -0300, alex23 escribió: On Apr 17, 7:19 pm, Visco Shaun wrote: What is the use of second import as the first import will be enough(AFAIK) to access anything intended by the second import? Is there any kind of advantage? While Piet's explanation is correct for th

Re: PEP 401

2009-04-21 Thread Gabriel Genellina
En Mon, 20 Apr 2009 05:02:35 -0300, escribió: On 19 Apr, 21:28, Stefan Behnel wrote: alessiogiovanni.bar...@gmail.com wrote: > Are 19 days that I read this PEP; it's all true? mm .. I noticed some inconsistencies in PEP, and I suspected of a joke, but ... only now I realize the S

Re: Hello everyone!

2009-04-21 Thread Gabriel Genellina
En Sun, 19 Apr 2009 09:54:36 -0300, Yilong Deng <05301...@bjtu.edu.cn> escribió: I'm a newby here, I love python very much. Welcome! Is there any Chinese here? Maybe - it seems there are people from all around the world... -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo

Re: Essential tools for Python development

2009-04-21 Thread Alex VanderWoude
Ben Finney wrote: Esmail writes: What techniques/tools do you recommend for debugging? I use the Python interactive shell, and code each module so that the behaviour is easily introspected and tested from outside the module. If I'm not able to easily introspect the code at an interactive pro

Re: relation class

2009-04-21 Thread Chris Rebert
On Tue, Apr 21, 2009 at 5:51 PM, Aaron Brady wrote: > Hi all, > > I think Python should have a relation class in the standard library. > Fat chance. Perhaps I'm not understanding "relation" correctly, but are you not aware of http://docs.python.org/library/sqlite3.html ? Cheers, Chris -- I have

Re: problem with PyMapping_SetItemString()

2009-04-21 Thread rahul
On Apr 22, 12:17 am, Stefan Behnel wrote: > rahul wrote: > > tatic PyObject *upadteCheck(PyObject *self,PyObject *args){ > >    PyObject *var_pyvalue=NULL,*newVar_pyvalue=NULL,*dict=NULL; > >    char *varName; > > >    if (!PyArg_ParseTuple(args, "s", &varName)){ > >                 return NULL; >

Re: Essential tools for Python development

2009-04-21 Thread Ben Finney
Esmail writes: > What techniques/tools do you recommend for debugging? I use the Python interactive shell, and code each module so that the behaviour is easily introspected and tested from outside the module. If I'm not able to easily introspect the code at an interactive prompt, that's a clear

Re: simple question re list iteration semantics

2009-04-21 Thread Esmail
Paul Rubin wrote: Esmail writes: for i in range(0, len(li)): print li[i] Will this always be equivalent to for i in li: print i Not the same--after the exit of the first loop, 'i' is the length of the list. After the exit of the second loop, 'i' is the last element. Yes, agree

Re: simple question re list iteration semantics

2009-04-21 Thread Paul Rubin
Esmail writes: > for i in range(0, len(li)): > print li[i] > > Will this always be equivalent to > > > for i in li: > print i Not the same--after the exit of the first loop, 'i' is the length of the list. After the exit of the second loop, 'i' is the last element. > Would the 2nd o

Re: Essential tools for Python development

2009-04-21 Thread Esmail
Great list Ben, I use emacs and will check out the tools you listed. What techniques/tools do you recommend for debugging? Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: simple question re list iteration semantics

2009-04-21 Thread Esmail
Thanks everyone, as usual, very informative posts! Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: simple question re list iteration semantics

2009-04-21 Thread Dave Angel
Esmail wrote: Hello all, I have a simple question regarding semantics. Given a list 'li', I can always do this to iterate through all items in order: for i in range(0, len(li)): print li[i] Will this always be equivalent to for i in li: print i I assume it is, and the order will al

Re: simple question re list iteration semantics

2009-04-21 Thread Steven D'Aprano
On Tue, 21 Apr 2009 21:06:46 -0400, Esmail wrote: > Given a list 'li', I can always do this to iterate through all items in > order: > > for i in range(0, len(li)): > print li[i] > > Will this always be equivalent to > > for i in li: > print i For lists, yes, that will always be equ

Essential tools for Python development (was: pyflakes, pylint, pychecker - and other tools)

2009-04-21 Thread Ben Finney
Esmail writes: > In particular, are the stylistic recommendations that pylint makes > considered sensible/valid? You can configure pylint extensively, to follow *your* chosen style recommendations. (Though I haven't found good documentation on how that's done.) > Are there any other tools you c

Would you support adding UNC support to os.path on Windows?

2009-04-21 Thread Larry Hastings
I've written a patch for Python 3.1 that changes os.path so it handles UNC paths on Windows. You can read about it at the Python bug tracker: http://bugs.python.org/issue5799 I'd like to gauge community interest in the patch. After all, it's has been declined before; I submitted a simi

Re: pyflakes, pylint, pychecker - and other tools

2009-04-21 Thread Philip Semanchuk
On Apr 21, 2009, at 9:11 PM, Esmail wrote: What is the consensus of the Python community regarding these code checkers? You're assuming there is a consensus. =) -- http://mail.python.org/mailman/listinfo/python-list

Re: simple question re list iteration semantics

2009-04-21 Thread MRAB
Esmail wrote: Hello all, I have a simple question regarding semantics. Given a list 'li', I can always do this to iterate through all items in order: for i in range(0, len(li)): print li[i] Will this always be equivalent to for i in li: print i I assume it is, and the order will al

Need help with setup.py and data files

2009-04-21 Thread Matthew Wilson
I'm working on a package that includes some files that are meant to be copied and edited by people using the package. My project is named "pitz" and it is a bugtracker. Instead of using a config file to set the options for a project, I want to use python files. When somebody installs pitz, I wan

pyflakes, pylint, pychecker - and other tools

2009-04-21 Thread Esmail
What is the consensus of the Python community regarding these code checkers? In particular, are the stylistic recommendations that pylint makes considered sensible/valid? Are there any other tools you consider essential to Python development? Thanks. Esmail -- http://mail.python.org/mailman/li

simple question re list iteration semantics

2009-04-21 Thread Esmail
Hello all, I have a simple question regarding semantics. Given a list 'li', I can always do this to iterate through all items in order: for i in range(0, len(li)): print li[i] Will this always be equivalent to for i in li: print i I assume it is, and the order will always be the sam

Re: problem with PyMapping_SetItemString()

2009-04-21 Thread Aaron Brady
On Apr 21, 2:25 am, rahul wrote: > i have a c extension snip >           dict=PyEval_GetLocals(); snip >           PyMapping_SetItemString(dict,varname,newVar_pyvalue); snip > than first two test cases runs correctly and gives result for var1 > "value changed"  but 3rd test case not gives correct

relation class

2009-04-21 Thread Aaron Brady
Hi all, I think Python should have a relation class in the standard library. Fat chance. I want to write a recipe for it, but I don't know how. I want your advice on some of the trade-offs, what it should look like, what the pitfalls are, different strengths and weaknesses, etc. Fundamentally,

Re: Inputting data into a website question

2009-04-21 Thread nathanielpeterson08
By putting "shirt" into the web form and clicking the submit button, I find the URL is this: http://oldnavy.gap.com/browse/search.do?searchText=shirt&searchDivName=Women&submit.x=0&submit.y=0 You can use the usual urllib methods to download this url. -- http://mail.python.org/mailman/listinfo/p

Re: problem with PyMapping_SetItemString()

2009-04-21 Thread John Machin
On Apr 21, 5:25 pm, rahul wrote: > i have a c extension > > tatic PyObject *upadteCheck(PyObject *self,PyObject *args){ >         PyObject *var_pyvalue=NULL,*newVar_pyvalue=NULL,*dict=NULL; >         char *varName; > >         if (!PyArg_ParseTuple(args, "s", &varName)){ >                 return N

Re: generating random tuples in python

2009-04-21 Thread Raymond Hettinger
[per] > i realize my example in the original post was misleading. i dont want > to maximize the difference between individual members of a single > tuple -- i want to maximize the difference between distinct tuples. in > other words, it's ok to have (.332, .334, .38), as long as the other > tuple i

Re: Inputting data into a website question

2009-04-21 Thread grocery_stocker
On Apr 21, 3:39 pm, Benjamin Edwards wrote: > On Apr 21, 11:10 pm, grocery_stocker wrote: > > > Let's say that I have a file with the following words > > shirt > > jeans > > belt > > jacket > > > Now I want to be able to enter these words into the search function at > > the following website.. >

Re: Inputting data into a website question

2009-04-21 Thread Emile van Sebille
grocery_stocker wrote: Let's say that I have a file with the following words shirt jeans belt jacket Now I want to be able to enter these words into the search function at the following website.. http://oldnavy.gap.com/?redirect=true I'd do what they're doing -- when you search those terms th

Re: Inputting data into a website question

2009-04-21 Thread Benjamin Edwards
On Apr 21, 11:10 pm, grocery_stocker wrote: > Let's say that I have a file with the following words > shirt > jeans > belt > jacket > > Now I want to be able to enter these words into the search function at > the following website.. > > http://oldnavy.gap.com/?redirect=true > > Is there some metho

Inputting data into a website question

2009-04-21 Thread grocery_stocker
Let's say that I have a file with the following words shirt jeans belt jacket Now I want to be able to enter these words into the search function at the following website.. http://oldnavy.gap.com/?redirect=true Is there some method in the urllib method that would allow me to do this? I tried goo

Re: A Special Thanks

2009-04-21 Thread Fuzzyman
On Apr 21, 3:52 pm, a...@pythoncraft.com (Aahz) wrote: > In article , > Nick Craig-Wood   wrote: > > > > >Python also converted me to using unit tests.  If you add unit tests > >into your methodology above then when you re-organize (or refactor to > >use the modern jargon) the code you can be 100%

Re: question about wxpython CtrlList event binder: wx.EVT_LIST_ITEM_RIGHT_CLICK

2009-04-21 Thread Kent
Hi Mike, thx for the wxpython maillist link, I will give it a shot. But I would like to paste the code snippet here as well, hope it can tell sufficient information. (I added some comments in the class. ) Thank you. class TagListCtrl(wx.ListCtrl): ''' Tag list ListCtrl widget '''

Re: using python logo at startup

2009-04-21 Thread Carl Banks
On Apr 21, 10:50 am, Mike Driscoll wrote: > On Apr 21, 11:46 am, Dhruv wrote: > > > Is there a way to display/flash "python powered" logo for like 2 > > seconds at startup of a helloworld application? > > > Well actually I have an application that takes data from an excel file > > and generates a

Re: question about wxpython CtrlList event binder: wx.EVT_LIST_ITEM_RIGHT_CLICK

2009-04-21 Thread Mike Driscoll
On Apr 21, 3:35 pm, Kent wrote: > Hi there, > > I wrote a desktop application with wxPython2.8. And got a problem. > Hope here someone can give some hint. Thanks in advance. I recommend joining the wxPython mailing list and posting there. The guys there are great and can probably help you out. Se

Re: Accessing items in nested tuples

2009-04-21 Thread alex
Tim and Mensanator Thank you very much, this will get me further. I can not recall having seen this in my books... I am still getting my grips with Python and OOP. Regards Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Python, MS SQL, and batch inserts

2009-04-21 Thread Scott David Daniels
ericwoodwo...@gmail.com wrote: On Apr 21, 4:01 pm, ericwoodwo...@gmail.com wrote: On Apr 21, 3:36 pm, Scott David Daniels wrote: I forget the name of the SQL Server bulk loader, bcp (bulk copy) was the name of the bulk loader. I just remembered. Sorry, no more exciting advice. i

Re: the correct way to install python packages as non root user in non default path

2009-04-21 Thread News123
Danke Diez, easy_install without 'install' works better :-) . As as you indicated: Virtualenv installs cleanly in a separate directory named virtualenv-1.3.3-py2.5.egg, So I removed the --prefix option and installed it in the default path. By the way: Adding the word 'install' wasn't inspired b

cx_oracle

2009-04-21 Thread gita ziabari
Hello everyone, 1. I installed Oracle client on my linux x86_64 machine. 2. Set oracle home and LD_LIBRARY_PATH 3. Installed cx_oracle using rpm for python 2.5 -> It's installed and the following file exists: /usr/local/lib/python2.5/site-packages/cx_Oracle.so -> When I run python -c 'import cx_O

Re: Best Python Web Framework ?

2009-04-21 Thread laplacia...@gmail.com
On Apr 21, 2:46 pm, SKYLAB wrote: > Greetings.. > > First , my english is not good . > > I heard that was written in python ( Youtube Programming Language : > PYTHON :S ) Correct ? > > That's not correct ? Then youtube is PHP application ? > > That's correct ; Which python web framework in friendf

question about wxpython CtrlList event binder: wx.EVT_LIST_ITEM_RIGHT_CLICK

2009-04-21 Thread Kent
Hi there, I wrote a desktop application with wxPython2.8. And got a problem. Hope here someone can give some hint. Thanks in advance. There was a ListCtrl (lc) in my GUI, and it was a bit long, so that there would be some blank space below ("empty area") in case there were only a few items. I bi

Re: Accessing items in nested tuples

2009-04-21 Thread Mensanator
On Apr 21, 3:03 pm, alex wrote: > Hello everybody > I am able to access the data in a tuple via a for loop (see example > below). > > #!/usr/bin/env python > > class Test(): >     def Data(self): >         return ("aa", "bb", "cc", "dd", "ee", "ff", "gg", "hh") > #        return (("aa", ("bb", "cc

Re: not homework... something i find an interesting problem

2009-04-21 Thread MRAB
bearophileh...@lycos.com wrote: MRAB: I think I might have cracked it: ... print n, sums Nice. If you don't want to use dynamic programming, then add a @memoize decoration before the function, using for example my one: http://code.activestate.com/recipes/466320/ And you will see an inter

Re: SqlAlchemy and mssqlserver

2009-04-21 Thread Mike Driscoll
On Apr 21, 11:22 am, "Stefano" wrote: > Using sqlalchemy with pyodbc and mssqlserver > Why sa always generate identity ? > > many thanks here the sample > > tb = Table('prova',meta,Column('chiave', Integer, primary_key=True)) > tb.create() > > CREATE TABLE prova ( >  chiave INTEGER NOT NULL IDENTI

Re: Accessing items in nested tuples

2009-04-21 Thread Tim Chase
IDLE 1.2.1 data=(("aa", ("bb", "cc", "dd")), ("ee", ("ff", "gg", "hh")), ("ii", ("jj", "kk", "ll"))) print data[0] ('aa', ('bb', 'cc', 'dd')) print data[1] ('ee', ('ff', 'gg', 'hh')) etc... I would like to be able to access the dataitem "aa" or "bb", "cc", "dd" individualy. You're s

Re: Python, MS SQL, and batch inserts

2009-04-21 Thread ericwoodworth
On Apr 21, 4:01 pm, ericwoodwo...@gmail.com wrote: > On Apr 21, 3:36 pm, Scott David Daniels wrote: > > > Philip Semanchuk wrote: > > > ... If you're doing a mass insert to populate a blank table it also often > > > helps to postpone index creation until after the table is populated > > > I fo

Accessing items in nested tuples

2009-04-21 Thread alex
Hello everybody I am able to access the data in a tuple via a for loop (see example below). #!/usr/bin/env python class Test(): def Data(self): return ("aa", "bb", "cc", "dd", "ee", "ff", "gg", "hh") #return (("aa", ("bb", "cc", "dd")), ("ee", ("ff", "gg", "hh")), ("ii", ("jj

Re: Python, MS SQL, and batch inserts

2009-04-21 Thread ericwoodworth
On Apr 21, 3:36 pm, Scott David Daniels wrote: > Philip Semanchuk wrote: > > ... If you're doing a mass insert to populate a blank table it also often > > helps to postpone index creation until after the table is populated > > I forget the name of the SQL Server bulk loader, but for large load

Re: Best Python Web Framework ?

2009-04-21 Thread SKYLAB
Thanks all post. my english is not good . But techincal english very good. Anyway , i understand english documents. That's not problem. -- http://mail.python.org/mailman/listinfo/python-list

Re: Passing all extra commandline arguments to python program, Optparse raises exception

2009-04-21 Thread Robert Kern
On 2009-04-16 19:32, Saptarshi wrote: Saptarshi Preprocess the sys.args before calling optparse. Simply search sys.args for the string "start" and the string "stop", and note whichever comes first. Then use slice operators to peel the extra arguments off of sys.args. Thanks, i implemented you

Re: Best Python Web Framework ?

2009-04-21 Thread Wes James
On Tue, Apr 21, 2009 at 12:46 PM, SKYLAB wrote: > Greetings.. > > First , my english is not good . > > I heard that was written in python ( Youtube Programming Language : > PYTHON :S ) Correct ? > > That's not correct ? Then youtube is PHP application ? > > That's correct ; Which python web framew

Re: Python, MS SQL, and batch inserts

2009-04-21 Thread Scott David Daniels
Philip Semanchuk wrote: ... If you're doing a mass insert to populate a blank table it also often helps to postpone index creation until after the table is populated I forget the name of the SQL Server bulk loader, but for large loads, I used to populate a fresh table with the bulk data, th

Re: generating random tuples in python

2009-04-21 Thread Robert Kern
On 2009-04-20 23:04, per wrote: to be more formal by very different, i would be happy if they were maximally distant in ordinary euclidean space... so if you just plot the 3-tuples on x, y, z i want them to all be very different from each other. i realize this is obviously biased and that the t

Please help me grok: webserver > python

2009-04-21 Thread Phillip B Oldham
I'm having trouble grok'ing how to get python talking through a webserver. I've got a lot of experience working with nginx+php-fcgi (via a unix socket) and I'd like to know what would be the bare minimum to get python talking in the same way. Now, I've looked at modules like CherryPy but they're a

Re: Best Python Web Framework ?

2009-04-21 Thread Stefan Behnel
Hi, SKYLAB wrote: > First , my english is not good . Note that there are many python news groups and mailing lists. There may also be one in your native language. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with PyMapping_SetItemString()

2009-04-21 Thread Stefan Behnel
rahul wrote: > tatic PyObject *upadteCheck(PyObject *self,PyObject *args){ > PyObject *var_pyvalue=NULL,*newVar_pyvalue=NULL,*dict=NULL; > char *varName; > > if (!PyArg_ParseTuple(args, "s", &varName)){ > return NULL; > } > dict=PyEval_GetLocals(); >

Re: Python, MS SQL, and batch inserts

2009-04-21 Thread Philip Semanchuk
On Apr 21, 2009, at 2:30 PM, ericwoodwo...@gmail.com wrote: I'm not 100% sure it's python and not SQL but I do suspect there's a better way to do this than just serial inserts. I could be wrong about that which is what i'm trying to explore. I don't think the SQL standard provides a way to

Best Python Web Framework ?

2009-04-21 Thread SKYLAB
Greetings.. First , my english is not good . I heard that was written in python ( Youtube Programming Language : PYTHON :S ) Correct ? That's not correct ? Then youtube is PHP application ? That's correct ; Which python web framework in friendfeed ? Web.py ? Django ? web2py ? Thanks.. -- http:

Re: execfile (exec?) create non consistent locals() state

2009-04-21 Thread Chris Rebert
On Tue, Apr 21, 2009 at 11:25 AM, Doron Tal wrote: > On Tue, Apr 21, 2009 at 9:13 PM, Chris Rebert wrote: >> >> On Tue, Apr 21, 2009 at 9:08 AM, Doron Tal >> wrote: >> > Hi, >> > >> > Recently I tried to execute a python file using execfile (exec performed >> > just the same for that reason). >>

Re: Python interpreter speed

2009-04-21 Thread Terry Reedy
Fabio Zadrozny wrote: Further, I have an accounting software which was previously in java, but now in python and the performance gain is ausom. Yes it depends on how we write the code but comparing the 2 at least at the middle layer and front-end (pygtk) python is faster than java. Infact I am m

Re: Python, MS SQL, and batch inserts

2009-04-21 Thread ericwoodworth
On Apr 21, 2:15 pm, Philip Semanchuk wrote: > On Apr 21, 2009, at 2:02 PM, ericwoodwo...@gmail.com wrote: > > > > > Hi, > >     I have a python script I'm writing that grabs some data from a > > com object, does a little formatting, and then inserts that data into > > a MS SQL 2003 DB.  Because I'

Re: execfile (exec?) create non consistent locals() state

2009-04-21 Thread Doron Tal
On Tue, Apr 21, 2009 at 9:13 PM, Chris Rebert wrote: > On Tue, Apr 21, 2009 at 9:08 AM, Doron Tal > wrote: > > Hi, > > > > Recently I tried to execute a python file using execfile (exec performed > > just the same for that reason). > > I encountered the behavior below: > > > > """ > > $ cat exec

Re: Python, MS SQL, and batch inserts

2009-04-21 Thread Philip Semanchuk
On Apr 21, 2009, at 2:02 PM, ericwoodwo...@gmail.com wrote: Hi, I have a python script I'm writing that grabs some data from a com object, does a little formatting, and then inserts that data into a MS SQL 2003 DB. Because I'm using COM objects I'm importing win32com.client. That also all

Re: execfile (exec?) create non consistent locals() state

2009-04-21 Thread Chris Rebert
On Tue, Apr 21, 2009 at 9:08 AM, Doron Tal wrote: > Hi, > > Recently I tried to execute a python file using execfile (exec performed > just the same for that reason). > I encountered the behavior below: > > """ > $ cat execme.py > a = 2 > $ python > Python 2.4.3 (#1, May 24 2008, 13:57:05) > [GCC

Python, MS SQL, and batch inserts

2009-04-21 Thread ericwoodworth
Hi, I have a python script I'm writing that grabs some data from a com object, does a little formatting, and then inserts that data into a MS SQL 2003 DB. Because I'm using COM objects I'm importing win32com.client. That also allows me to use ADODB.connection and ADODB.command objects for wo

Re: not homework... something i find an interesting problem

2009-04-21 Thread bearophileHUGS
MRAB: > I think I might have cracked it: > ... >      print n, sums Nice. If you don't want to use dynamic programming, then add a @memoize decoration before the function, using for example my one: http://code.activestate.com/recipes/466320/ And you will see an interesting speed increase, even if

Re: using python logo at startup

2009-04-21 Thread Mike Driscoll
On Apr 21, 11:46 am, Dhruv wrote: > Is there a way to display/flash "python powered" logo for like 2 > seconds at startup of a helloworld application? > > Well actually I have an application that takes data from an excel file > and generates a kml file and opens it up with google earth. All this >

Re: who is calling the base class __new__ method

2009-04-21 Thread Aahz
In article , Andreas Otto wrote: > > Question: What is the difference between these both functions >and why is one working and the other not ? If you don't get an answer here, try capi-sig. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "If you think

Re: Python interpreter speed

2009-04-21 Thread Fabio Zadrozny
> Further, I have an accounting software which was previously in java, but > now in python and the performance gain is ausom. > > Yes it depends on how we write the code but comparing the 2 at least at > the middle layer and front-end (pygtk) python is faster than java. > Infact I am most certain t

Re: Is there a programming language that is combination of Python and Basic?

2009-04-21 Thread Mensanator
On Apr 21, 5:37 am, Ivan Illarionov wrote: > On Apr 18, 3:39 pm, BJörn Lindqvist wrote: > > > I first started programming basic and i don't think it has hurt me much. > > > I can somewhat sympathise with the op, neither python nor any other > > mainstream language can still do this: > > > SCREEN

Re:

2009-04-21 Thread Andre Engels
On Tue, Apr 21, 2009 at 3:00 PM, karlos barlos wrote: > hello to everybody... > > having problem withe this code : > > dom = raw_input("The Domain name..:") >   ad_user.Put('userPrincipalName',user['login']+'@(['dom']) > > but it wont change whay ? Well, you don't tell what ad_user is, an

Re: not homework... something i find an interesting problem

2009-04-21 Thread MRAB
Trip Technician wrote: On 21 Apr, 14:46, MRAB wrote: Trip Technician wrote: Thank you Dave. This does it but slowly. takes every subset of the list a ofsquares, and then gets a 'partition' that will work, many are very inefficient (with lots of 1s). any hints about how to speed up ? def subset

using python logo at startup

2009-04-21 Thread Dhruv
Is there a way to display/flash "python powered" logo for like 2 seconds at startup of a helloworld application? Well actually I have an application that takes data from an excel file and generates a kml file and opens it up with google earth. All this is compiled in an exe file using py2exe. Now

Re: sorting two corresponding lists?

2009-04-21 Thread nathanielpeterson08
>From http://wiki.python.org/moin/HowTo/Sorting#Sortingbykeys, using the >Decorate-Sort-Undecorate (aka Schwartzian transform) idiom: #!/usr/bin/env python items = ['apple', 'car', 'town', 'phone'] values = [5, 2, 7, 1] zipped=zip(values,items) zipped.sort(reverse=True) values_sorted,items_sorte

Re: Export variables

2009-04-21 Thread Diez B. Roggisch
mso...@linuxmail.org wrote: > Hello, > > I want to make a certain subset of public attributes available through > an interface. > > The client should not need to know the names of the attributes. > > Here is some code with the important parts missing. Anyone care to > fill in the missing parts

SqlAlchemy and mssqlserver

2009-04-21 Thread Stefano
Using sqlalchemy with pyodbc and mssqlserver Why sa always generate identity ? many thanks here the sample tb = Table('prova',meta,Column('chiave', Integer, primary_key=True)) tb.create() CREATE TABLE prova ( chiave INTEGER NOT NULL IDENTITY(1,1), PRIMARY KEY (chiave) ) Stefano -- http://ma

Python winappdbg module v1.0 is out!

2009-04-21 Thread Mario Alejandro Vilas Jerez
What is winappdbg? == The winappdbg python module allows developers to quickly code instrumentation scripts in Python under a Windows environment. It uses ctypes to wrap many Win32 API calls related to debugging, and provides an object-oriented abstraction layer to manipulate thre

Re:

2009-04-21 Thread Tim Golden
karlos barlos wrote: ok sorry TIM I just took some piece of code that ADDs users to AD import win32com,win32com.client def add_acct(location,account): ad_obj=win32com.client.GetObject(location) ad_user=ad_obj.Create('user','cn='+user['login']) ad_user

Re: sorting two corresponding lists?

2009-04-21 Thread tiefeng wu
> > Esmail wrote: > > > items = [apple, car, town, phone] > > values = [5, 2, 7, 1] > > > > I would like to sort the 'items' list based on the 'values' list so > > that I end up with the following two list: > > > > items = [town, apple, car, phone] > > values = [7, 5, 2, 1] My solution, I know th

execfile (exec?) create non consistent locals() state

2009-04-21 Thread Doron Tal
Hi, Recently I tried to execute a python file using execfile (exec performed just the same for that reason). I encountered the behavior below: """ $ cat execme.py a = 2 $ python Python 2.4.3 (#1, May 24 2008, 13:57:05) [GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2 Type "help", "copyright", "c

Export variables

2009-04-21 Thread msolem
Hello, I want to make a certain subset of public attributes available through an interface. The client should not need to know the names of the attributes. Here is some code with the important parts missing. Anyone care to fill in the missing parts? class C: def __init__(self): se

Re: and [True,True] --> [True, True]?????

2009-04-21 Thread Peter Pearson
On 21 Apr 2009 03:06:40 GMT, Steven D'Aprano wrote: > On Mon, 20 Apr 2009 15:53:41 +, Peter Pearson wrote: > >> Like Gerhard, I prefer the construction that explicitly says, "This is a >> list, and this is what I'll do if it's not empty." To me, and I suspect >> to a great many programmers, "i

Re: not homework... something i find an interesting problem

2009-04-21 Thread Trip Technician
On 21 Apr, 14:46, MRAB wrote: > Trip Technician wrote: > > Thank you Dave. This does it but slowly. takes every subset of the > > list a ofsquares, and then gets a 'partition' that will work, many > > are very inefficient (with lots of 1s). > > > any hints about how to speed up ? > > > def subset(

Re: sorting two corresponding lists?

2009-04-21 Thread 邓弈龙
solution by jadec.se...@gmail.commailto:jadec.se...@gmail.com>, China values,items = zip( *sorted( zip (values,items))) - Original Message - From: "Esmail" mailto:ebo...@hotmail.com> > To: mailto:python-list@python.org> > Sent: Tuesday, April 21, 2009 12:10 AM Subject: sorting two corr

Re: A Special Thanks

2009-04-21 Thread Aahz
In article , Nick Craig-Wood wrote: > >Python also converted me to using unit tests. If you add unit tests >into your methodology above then when you re-organize (or refactor to >use the modern jargon) the code you can be 100% sure that you didn't >break anything which is a wonderful feeling. N

Re: and [True,True] --> [True, True]?????

2009-04-21 Thread Grant Edwards
On 2009-04-21, Steven D'Aprano wrote: > No matter what x is (excluding buggy classes), "if x" means > "test whether x is true in a boolean context". > > If x happens to be a list, that means "x is empty". If x is a > float, it means "x is positive or negative zero". I think you've got your true/

Re: ANN: PyGUI 2.0.4

2009-04-21 Thread Kent Johnson
On Apr 21, 8:05 am, Greg Ewing wrote: > PyGUI 2.0.4 is available: > >    http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ > > Fixes a few more bugs and hopefully improves things > on Windows, although I can't be sure it will fix all > the Windows problems people are having, because I > have

Re: not homework... something i find an interesting problem

2009-04-21 Thread MRAB
Trip Technician wrote: Thank you Dave. This does it but slowly. takes every subset of the list a of squares, and then gets a 'partition' that will work, many are very inefficient (with lots of 1s). any hints about how to speed up ? def subset(x): for z in range(1,2**len(x)): q=bin(

Re:

2009-04-21 Thread karlos barlos
ok sorry TIM I just took some piece of code  that ADDs users to AD import win32com,win32com.client     def add_acct(location,account):   ad_obj=win32com.client.GetObject(location)   ad_user=ad_obj.Create('user','cn='+user['login'])   ad_user.Put('sAMAccountName',u

Problem updating AD user [was: Re:]

2009-04-21 Thread Tim Golden
[... snip vague question re AD user update ...] ... and please add a (useful) subject line TJG -- http://mail.python.org/mailman/listinfo/python-list

Re:

2009-04-21 Thread Tim Golden
karlos barlos wrote: hello to everybody... having problem withe this code : dom = raw_input("The Domain name..:") ad_user.Put('userPrincipalName',user['login']+'@(['dom']) but it wont change whay ? Some more context would help, including a code fragment and traceback if there is a

Re: Python and GMP.

2009-04-21 Thread casevh
On Apr 21, 5:47 am, Paul Rubin wrote: > casevh writes: > > > Could you test pow(a,b,c) where a,b,c are each 300 decimal digits? > > > $ py25 -m timeit -s  "a=long('23'*150);b=long('47'*150);m=long > > ('79'*150)" "c=pow(a,b,m)" > > 10 loops, best of 3: 52.7 msec per

Re: Problem with COM and variants

2009-04-21 Thread Simon Carter
Doh! Ta. Simon "John Machin" wrote in message news:023fcc82-6e98-4ddd-9977-06d95ab44...@c18g2000prh.googlegroups.com... On Apr 21, 7:37 pm, "Simon Carter" wrote: Hullo! I'm having a problem interfacing with a proprietary COM library on Windows, and I was hoping someone could help. I'm no C

[no subject]

2009-04-21 Thread karlos barlos
hello to everybody... having problem withe this code : dom = raw_input("The Domain name..:")   ad_user.Put('userPrincipalName',user['login']+'@(['dom']) but it wont change whay ? -- http://mail.python.org/mailman/listinfo/python-list

[no subject]

2009-04-21 Thread karlos barlos
hello to everybody... having problem withe this code : dom = raw_input("The Domain name..:")   ad_user.Put('userPrincipalName',user['login']+'@(['dom']) but it wont change whay ? -- http://mail.python.org/mailman/listinfo/python-list

Re: the correct way to install python packages as non root user in non default path

2009-04-21 Thread Diez B. Roggisch
News123 wrote: > Hi Alex, > > > Thanks a lot. Reading the description this sounds to be the right thing. > > > But now I'm stuck installing virtualenv as a user as this seems to be no > ubunbtu package: > > > export PYTHONPATH=/opt/newpymod/lib/python2.5/site-packages > mkdir -p $PYTHONPATH

Re: Programming in Python with a view to extending in C at a later date.

2009-04-21 Thread bobicanprogram
On Apr 20, 2:57 pm, "dug.armad...@googlemail.com" wrote: > Hi, > > Say you set out to program in Python knowing that you will be > converting parts of it into C ( or maybe C++) at a later date, but you > do not know which parts. > > Can you give any general Python structure / syntax advice that if

Re: not homework... something i find an interesting problem

2009-04-21 Thread Trip Technician
Thank you Dave. This does it but slowly. takes every subset of the list a of squares, and then gets a 'partition' that will work, many are very inefficient (with lots of 1s). any hints about how to speed up ? def subset(x): for z in range(1,2**len(x)): q=bin(z) subs=[]

Re: Python and GMP.

2009-04-21 Thread Paul Rubin
casevh writes: > > Could you test pow(a,b,c) where a,b,c are each 300 decimal digits? > > $ py25 -m timeit -s "a=long('23'*150);b=long('47'*150);m=long > ('79'*150)" "c=pow(a,b,m)" > 10 loops, best of 3: 52.7 msec per loop > $ py31 -m timeit -s > 100 loops, best of 3: 8.85 msec per loop > $

Re: Python and GMP.

2009-04-21 Thread Paul Rubin
alessiogiovanni.bar...@gmail.com writes: > > Could you test pow(a,b,c) where a,b,c are each 300 decimal digits? > > This is an important operation in cryptography, that GMP is carefully > > optimized for.  Thanks. > > Ok, thanks for your answers. I understand the problems of licensing, > but we co

  1   2   >