Re: Cannot find text in *.py files with Windows Explorer?

2009-04-03 Thread John Doe
Tim Golden wrote: > Now I think about it, try searching for "xplorer2" since I think I > mentioned that I have used that instead of explorer for some > while. Yeah... at least by the time I move from Windows XP to Windows 7, very likely I will be using a different file manager. If I cannot

Re: Cannot find text in *.py files with Windows Explorer?

2009-04-03 Thread Tim Golden
John Doe wrote: Anybody have a solution for Windows (XP) Explorer search not finding ordinary text in *.py files? It came up a couple of months ago either on this list or on python-win32. Don't have web access at the moment, but try searching the archives for references to search, registry set

Re: is there a way to collect twitts with python?

2009-04-03 Thread Michael Torrie
Tim Wintle wrote: > On Fri, 2009-04-03 at 14:58 -0600, Michael Torrie wrote: >> Oh wow. If this is what Twitter does to one's ability to articulate >> clearly, I hope Twitter dies a horrible death and any APIs and Python >> bindings with it! > > Thank you, thank you, thank you > > everyone

Books about refactoring in Python (Was: A design problem I met again and again.)

2009-04-03 Thread Michele Simionato
On Apr 4, 6:10 am, Carl Banks wrote: > A piece of user code that looked like this (where sc is an instance of > your enormous class): > > sc.startX() > sc.send_data_via_X() > sc.receive_data_via_X() > sc.stopX() > > might look like this after you factor it out: > > session = sc.startX()  # creates

Re: User or UserManager ? Problems of Observer Pattern

2009-04-03 Thread Michele Simionato
On Apr 3, 7:34 pm, 一首诗 wrote: > # > # Choice 2 > # > > class UserManager: > > users = [] > > @classmethod > def delUser(cls, user): > cls.users.remove(user) > > RoleManager.onUserDel(user) > > class RoleManager: > > roles = [] > >

RE: is there a way to collect twitts with python?

2009-04-03 Thread Nick Stinemates
> Thank you, thank you, thank you > everyone around me seems to love that thing (twitter), and I still can't > work out why (apart from hacks such as using it as a hosted queue for > cross-server comms, or receiving cheap sms to your app) > Tim Wintle You mean you don't want to read every d

Re: is there a way to collect twitts with python?

2009-04-03 Thread Tim Wintle
On Fri, 2009-04-03 at 14:58 -0600, Michael Torrie wrote: > Oh wow. If this is what Twitter does to one's ability to articulate > clearly, I hope Twitter dies a horrible death and any APIs and Python > bindings with it! Thank you, thank you, thank you everyone around me seems to love that th

Re: python needs leaning stuff from other language

2009-04-03 Thread Tim Wintle
On Fri, 2009-04-03 at 18:27 -0500, Robert Kern wrote: > > agreed. If .clear was to be added then really assignments to slices > > should be entirely removed. > > Please tell me you are joking. Well I'm not joking as such. I've noticed that python-ideas seems to be positive on the idea, and has a

Cannot find text in *.py files with Windows Explorer?

2009-04-03 Thread John Doe
Anybody have a solution for Windows (XP) Explorer search not finding ordinary text in *.py files? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: is there a way to collect twitts with python?

2009-04-03 Thread alex23
On Apr 4, 6:58 am, Michael Torrie wrote: > Oh wow.  If this is what Twitter does to one's ability to articulate > clearly, I hope Twitter dies a horrible death and any APIs and Python > bindings with it! At least he was able to use more than 140 chars :) -- http://mail.python.org/mailman/listinfo

Re: A design problem I met again and again.

2009-04-03 Thread Carl Banks
On Apr 2, 11:25 pm, 一首诗 wrote: > Consolidate existing functions? > > I've thought about it. > > For example, I have two functions: > > #= > > def startXXX(id): > pass > > def startYYY(id): > pass > #= > > I could turn it into one: > > #==

Re: Best way to pickle functions

2009-04-03 Thread Aaron Brady
On Apr 3, 3:48 pm, Aaron Scott wrote: > > Why not use import ?  Simply recreate the source file, if necessary, and > > import it again. > > Ah, you'd think it would be that easy :P > > The problem with just importing a module is that the module is then > cached in memory. Multiple copies of the pr

Re: "Pythoner",Wish me luck!

2009-04-03 Thread George Sakkis
On Apr 3, 3:47 pm, barisa wrote: > On Apr 3, 8:58 pm, nrball...@gmail.com wrote: > > > > > On Apr 3, 12:33 pm, barisa wrote: > > > > On Apr 3, 11:39 am, "Hendrik van Rooyen" wrote: > > > > > "Matteo" wrote: > > > > > On Apr 3, 9:05 am, Linuxwell wrote: > > > > > >> Starting today I would like

Problem understanding some unit tests in Python distribution

2009-04-03 Thread André
Hi everyone, In the hope of perhaps contributing some additional unit tests for Python (thus contributing back to the community), I dove in the code and found something that should be simple but that I can not wrap my head around. In list_tests.py, one finds === from test import test_support, seq

Re: Let-expressions

2009-04-03 Thread sloisel
Thanks for the quick replies. I didn't want statements in my expressions, just let-expressions. That's okay, it was just a question. Sébastien Loisel On Apr 3, 7:20 pm, Chris Rebert wrote: > On Fri, Apr 3, 2009 at 4:18 PM, Terry Reedy wrote: > > sloisel wrote: > > >> Dear All, > > >> I searche

Re: Best way to extract from regex in if statement

2009-04-03 Thread Tim Chase
Or in case you want to handle each regexp differently, you can construct a dict {regexp : callback_function} that picks the right action depending on which regexp matched. One word of caution: dicts are unsorted, so if more than one regexp can match a given line, they either need to map to th

Re: Best way to extract from regex in if statement

2009-04-03 Thread Paul Rubin
bwgoudey writes: > elif re.match("^DATASET:\s*(.+) ", line): > m=re.match("^DATASET:\s*(.+) ", line) > print m.group(1)) Sometimes I like to make a special class that saves the result: class Reg(object): # illustrative code, not tested def match(self, pattern, line):

Re: Best way to extract from regex in if statement

2009-04-03 Thread George Sakkis
On Apr 3, 9:56 pm, Jon Clements wrote: > On 4 Apr, 02:14, bwgoudey wrote: > > > > > I have a lot of if/elif cases based on regular expressions that I'm using to > > filter stdin and using print to stdout. Often I want to print something > > matched within the regular expression and the moment I'v

SendKeys not working in command line interface

2009-04-03 Thread Dhruv
hi everyone. I am fairly new to python. When I go to IDLE GUI for python 2.6 and type: >>> import SendKeys >>> SendKeys.SendKeys('{LWIN} r notepad', pause=0.5) it works fine. however when I write the same code using jEdit and run it in command line, it does not give error but it doesn't run eithe

Re: python needs leaning stuff from other language

2009-04-03 Thread Steven D'Aprano
On Fri, 03 Apr 2009 18:52:52 -0700, Giampaolo Rodola' wrote: > If "there should be one-- and preferably only one --obvious way to do > it" then my_list.clear() is more obvious than del my_list[:]. Honestly > I'm a little surprised that such a topic hasn't been raised before. I'm a little surprise

Re: Best way to extract from regex in if statement

2009-04-03 Thread Tim Chase
bwgoudey wrote: I have a lot of if/elif cases based on regular expressions that I'm using to filter stdin and using print to stdout. Often I want to print something matched within the regular expression and the moment I've got a lot of cases like: ... elif re.match("^DATASET:\s*(.+) ", line):

Re: Best way to extract from regex in if statement

2009-04-03 Thread Jon Clements
On 4 Apr, 02:14, bwgoudey wrote: > I have a lot of if/elif cases based on regular expressions that I'm using to > filter stdin and using print to stdout. Often I want to print something > matched within the regular expression and the moment I've got a lot of cases > like: > > ... > elif re.match("

Re: python needs leaning stuff from other language

2009-04-03 Thread Giampaolo Rodola'
If "there should be one-- and preferably only one --obvious way to do it" then my_list.clear() is more obvious than del my_list[:]. Honestly I'm a little surprised that such a topic hasn't been raised before. --- Giampaolo http://code.google.com/p/pyftpdlib -- http://mail.python.org/mailman/listi

Re: How to add lines to the beginning of a text file?

2009-04-03 Thread Jon Clements
On 4 Apr, 02:21, dean wrote: > Hello, > > As the subject says how would I go about adding the lines to the beginning > of a text file? Thanks in advance. I'd create a new file, then write your new lines, then iterate the existing file and write those lines... If no errors occcur, issue a delete f

Re: How to add lines to the beginning of a text file?

2009-04-03 Thread Steven D'Aprano
On Sat, 04 Apr 2009 03:21:34 +0200, dean wrote: > Hello, > > As the subject says how would I go about adding the lines to the > beginning of a text file? Thanks in advance. I'm not aware of any operating system that allows you to insert data into the middle or beginning of a file, although I've

Re: python needs leaning stuff from other language

2009-04-03 Thread Steven D'Aprano
On Fri, 03 Apr 2009 22:42:33 +0100, Tim Wintle wrote: > On Fri, 2009-04-03 at 13:12 -0400, Mel wrote: >> >>> I think it would also be better to have One (and prefereably Only >> >>> One) Obvious Way To Do It. That obvious way, for those who work >> >>> with Python's ‘set’ and ‘dict’, is a ‘clear’

How to add lines to the beginning of a text file?

2009-04-03 Thread dean
Hello, As the subject says how would I go about adding the lines to the beginning of a text file? Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list

How to add lines to the beginning of a text file?

2009-04-03 Thread dean
Hello, As the subject says how would I go about adding the lines to the beginning of a text file? Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list

Best way to extract from regex in if statement

2009-04-03 Thread bwgoudey
I have a lot of if/elif cases based on regular expressions that I'm using to filter stdin and using print to stdout. Often I want to print something matched within the regular expression and the moment I've got a lot of cases like: ... elif re.match("^DATASET:\s*(.+) ", line): m=re.match(

Undefined symbol PyUnicodeUCS2_DecodeUTF8

2009-04-03 Thread Manish Jain
Hi all, I am using Gnome on FreeBSD 7.1. A few days back, my gnome crashed and I have had to spend over 4 days recovering my gnome environment. Pretty much everything is okay now except for a few python-dependent applications (alacarte, for instance), which exit immediately with the followin

Re: Hash of None varies per-machine

2009-04-03 Thread Steven D'Aprano
On Fri, 03 Apr 2009 10:50:08 -0700, ben.taylor wrote: > 1. Is it correct that if you hash two things that are not equal they > might give you the same hash value? Absolutely. From help(hash): hash(...) hash(object) -> integer Return a hash value for the object. Two objects with the sa

Re: Unix programmers and Idle

2009-04-03 Thread Dale Amon
Just in case anyone else finds it useful, to be precise I use: if opts.man: p1 = Popen(["echo", __doc__], stdout=PIPE) p2 = Popen(["pod2man"], stdin=p1.stdout, stdout=PIPE) p3 = Popen(["nroff","-man"], stdin=p2.stdout, stdout=PIPE) output = p3.co

Re: Unix programmers and Idle

2009-04-03 Thread Dale Amon
On Mon, Mar 30, 2009 at 10:54:56PM -0700, Niklas Norrthon wrote: > I make sure my scripts are on the form: > > # imports > # global initialization (not depending on sys.argv) > def main(): > # initialization (might depend on sys.argv) > # script logic > # other functions > if __name__ == '

Re: Let-expressions

2009-04-03 Thread Chris Rebert
On Fri, Apr 3, 2009 at 4:18 PM, Terry Reedy wrote: > sloisel wrote: >> >> Dear All, >> >> I searched this group and found that there have been discussions about >> introducing a let expression to the language so that you can define >> local variables in a lambda. I.e., something like f=lambda x: l

Re: Module caching

2009-04-03 Thread Jon Clements
On 3 Apr, 23:58, Aaron Scott wrote: > > are you an experienced python programmer? > > Yeah, I'd link to think I'm fairly experienced and not making any > stupid mistakes. That said, I'm fairly new to working with mod_python. > > All I really want is to have mod_python stop caching variables. This

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-03 Thread Brett Cannon
On Fri, Apr 3, 2009 at 13:15, "Martin v. Löwis" wrote: > > Note that there is no such thing as a "defining namespace package" -- > > namespace package contents are symmetrical peers. > > With the PEP, a "defining package" becomes possible - at most one > portion can define an __init__.py. > > I k

Re: Module caching

2009-04-03 Thread Christian Heimes
Aaron Scott wrote: > Yeah, I'd link to think I'm fairly experienced and not making any > stupid mistakes. That said, I'm fairly new to working with mod_python. > > All I really want is to have mod_python stop caching variables. This > seems like it should be easy enough to do, but I can't for the

Re: python needs leaning stuff from other language

2009-04-03 Thread Robert Kern
On 2009-04-03 16:42, Tim Wintle wrote: On Fri, 2009-04-03 at 13:12 -0400, Mel wrote: I think it would also be better to have One (and prefereably Only One) Obvious Way To Do It. That obvious way, for those who work with Python's ‘set’ and ‘dict’, is a ‘clear’ method. It seems best to have ‘list’

Re: Let-expressions

2009-04-03 Thread Terry Reedy
sloisel wrote: Dear All, I searched this group and found that there have been discussions about introducing a let expression to the language so that you can define local variables in a lambda. I.e., something like f=lambda x: let y=x^2 in sin(y). (My syntax is unpythonic, but I hope you get it).

Re: Python Goes Mercurial

2009-04-03 Thread Ben Finney
Lawrence D'Oliveiro writes: > In message <49d65b62$0$30904$9b622...@news.freenet.de>, "Martin v. Löwis" > wrote: > > > I don't like git because it is too difficult for me. In many > > cases, git would refuse to do operations like updating or local > > committing, producing error messages I was

Re: python needs leaning stuff from other language

2009-04-03 Thread Ben Finney
Mel writes: > Well, if list.clear were truly and strictly to be the only way to > clear the contents of a list Who ever suggested that? Note that the “OOW” in OOWTDI does *not* mean “Only One Way”. It means “One Obvious Way”. Having other Ways To Do It is only mildly deprecated, not forbidden.

Re: Unix programmers and Idle

2009-04-03 Thread MRAB
Dale Amon wrote: On Mon, Mar 30, 2009 at 08:11:10PM -0500, Dave Angel wrote: I don't know what Idle has to do with it. sys.args contains the command line arguments used to start a script. Dale Amon wrote: I wonder if someone could point me at documentation on how to debug some of the standa

Re: Module caching

2009-04-03 Thread Aaron Scott
> are you an experienced python programmer? > Yeah, I'd link to think I'm fairly experienced and not making any stupid mistakes. That said, I'm fairly new to working with mod_python. All I really want is to have mod_python stop caching variables. This seems like it should be easy enough to do, bu

Re: with open('com1', 'r') as f:

2009-04-03 Thread Lawrence D'Oliveiro
In message <8bc55c05-19da-41c4- b916-48e0a4be4...@p11g2000yqe.googlegroups.com>, gert wrote: > with open('com1', 'r') as f: > for line in f: > print('line') Why bother, why not just for line in open('com1', 'r') : print line -- http://mail.python.org/mailma

Re: Python Goes Mercurial

2009-04-03 Thread Lawrence D'Oliveiro
In message <49d65b62$0$30904$9b622...@news.freenet.de>, "Martin v. Löwis" wrote: > I don't like git because it is too difficult for me. In many cases, > git would refuse to do operations like updating or local committing, > producing error messages I was not able to understand ... Post an exampl

Re: python needs leaning stuff from other language

2009-04-03 Thread MRAB
Tim Wintle wrote: On Fri, 2009-04-03 at 13:12 -0400, Mel wrote: I think it would also be better to have One (and prefereably Only One) Obvious Way To Do It. That obvious way, for those who work with Python's ‘set’ and ‘dict’, is a ‘clear’ method. It seems best to have ‘list’ conform with this al

Re: Class methods read-only by default?

2009-04-03 Thread Piet van Oostrum
> "Emanuele D'Arrigo" (ED) wrote: >ED> Hi Everybody! >ED> I just tried this: > class C(object): >ED> ...def method(self): >ED> ...pass >ED> ... > c = C() > delattr(c, "method") >ED> Traceback (most recent call last): >ED> File "", line 1, in >ED> AttributeError: '

Re: Module caching

2009-04-03 Thread andrew cooke
are you an experienced python programmer? a lot of newbies post here with problems related to unexpected results because they make "the usual" mistakes about list mutability and default function arguments. i suspect that's not the case here, but it seemed worth mentioning, just in case. andrew

Re: Module caching

2009-04-03 Thread Aaron Scott
Huzzah, another post. I just discovered that even physically deleting the variable doesn't work. The module storylab.game has the class InitGame, which contains "daemons = {}". A user runs the code, resulting in some values in "daemons": "{'berry2': , 'berry3': , 'berry1': }". These are pickled.

Re: Module caching

2009-04-03 Thread Aaron Scott
Okay, I'm at my wit's end. I have a Python app, running via mod_python. There are variables in this app that, when changed, save their changes to a pickled file tied to a session ID. Then, when the page is accessed again, the variables are loaded from the respective file. But, when one user uses t

Let-expressions

2009-04-03 Thread sloisel
Dear All, I searched this group and found that there have been discussions about introducing a let expression to the language so that you can define local variables in a lambda. I.e., something like f=lambda x: let y=x^2 in sin(y). (My syntax is unpythonic, but I hope you get it). Can someone tel

Re: python needs leaning stuff from other language

2009-04-03 Thread Tim Wintle
On Fri, 2009-04-03 at 13:12 -0400, Mel wrote: > >>> I think it would also be better to have One (and prefereably Only One) > >>> Obvious Way To Do It. That obvious way, for those who work with > >>> Python's ‘set’ and ‘dict’, is a ‘clear’ method. It seems best to have > >>> ‘list’ conform with this

Re: IIS python web application mapping issue - resolved

2009-04-03 Thread davidj411
I thought i was being clever but not only did i typo , but it does not work with the "-u" for unbuffered option. remove the "-u" to avoid the ugly message: CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. I am going to use the CGI script to uplo

Module caching

2009-04-03 Thread Aaron Scott
Is there a way to make a Python app running in mod_python with zero persistence? I have an app that should be resetting its variables every time you access it, but sometimes -- and only sometimes -- the variables persist through a couple refreshes. They'll even persist through multiple browsers, so

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-03 Thread P.J. Eby
At 10:15 PM 4/3/2009 +0200, Martin v. Löwis wrote: I should make it clear that this is not the case. I envision it to work this way: import zope - searches sys.path, until finding either a directory zope, or a file zope.{py,pyc,pyd,...} - if it is a directory, it checks for .pkg files. If it fi

SFTP libraries in pure Python?

2009-04-03 Thread hirudo #1
Hi, I am looking for SFTP libraries that are written in pure Python. I already checked out paramiko, but as far as I can see, it requires pycrypto, which is not pure Python. Another candidate, Twisted, isn't pure Python either. I don't really care about speed as much as about portability.

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-03 Thread glyph
On 08:15 pm, mar...@v.loewis.de wrote: Note that there is no such thing as a "defining namespace package" -- namespace package contents are symmetrical peers. With the PEP, a "defining package" becomes possible - at most one portion can define an __init__.py. For what it's worth, this is a _s

Re: is there a way to collect twitts with python?

2009-04-03 Thread Michael Torrie
'2+ wrote: > i found a guy twittin supercollider code > this means his followers can listen to a noiz by activating that 1 line > (well if he has sc installed) > if lots of sc users start twittin ... it would be no good to follow each > > collecting a sc related twitt can be done with python? > if

Re: Best way to pickle functions

2009-04-03 Thread Aaron Scott
> Why not use import ?  Simply recreate the source file, if necessary, and > import it again. > Ah, you'd think it would be that easy :P The problem with just importing a module is that the module is then cached in memory. Multiple copies of the program are running on a server, and each of them h

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-03 Thread Martin v. Löwis
> Note that there is no such thing as a "defining namespace package" -- > namespace package contents are symmetrical peers. With the PEP, a "defining package" becomes possible - at most one portion can define an __init__.py. I know that the current mechanisms don't support it, and it might not be

Re: with open('com1', 'r') as f:

2009-04-03 Thread Christian Heimes
gert wrote: > I do understand, and I went looking into pySerial, but it is a long > way from getting compatible with python3.x and involves other libs > that are big and non pyhton3.x compatible. So don't use Python 3.0. Most people are still using Python 2.5 or 2.6. Christian -- http://mail.pyt

Re: Hash of None varies per-machine

2009-04-03 Thread Christian Heimes
Paul Rubin wrote: > Yes, hashes are 32 bit numbers and there are far more than 2**32 > possible Python values (think of long ints), so obviously there must > be multiple values that hash to the same slot. No, hashs are C longs. On most 64bit platforms a C long has 64bits. As far as I know only 64b

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-03 Thread Martin v. Löwis
> I'd like to extend the proposal to Python 2.7 and later. I don't object, but I also don't want to propose this, so I added it to the discussion. My (and perhaps other people's) concern is that 2.7 might well be the last release of the 2.x series. If so, adding this feature to it would make 2.7

Re: django model problem

2009-04-03 Thread Mark
> I think the first thing you need to do is decide if there is going to be > more than one Musician object. and more than one Album object. > Presently you are giving all musicians the same first_name and > last_name. I suggest you look up the documentation for the special > method __init__()

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-03 Thread Martin v. Löwis
Chris Withers wrote: > Martin v. Löwis wrote: >> I propose the following PEP for inclusion to Python 3.1. >> Please comment. > > Would this support the following case: > > I have a package called mortar, which defines useful stuff: > > from mortar import content, ... > > I now want to distribut

confused with creating doctest in xmlrpc server

2009-04-03 Thread Krishnakant
hello all, I am thinking of using the doctest module for my unit testing code in python. I have no problems doing this in usual classes but I am a bit confused with my twisted based rpc classes. given that I directly take the output of running functions on a python prompt for the dockstrings, how

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-03 Thread Martin v. Löwis
> Perhaps we could add something like a sys.namespace_packages that would > be updated by this mechanism? Then, pkg_resources could check both that > and its internal registry to be both backward and forward compatible. I could see no problem with that, so I have added this to the PEP. Thanks fo

Re: "Pythoner",Wish me luck!

2009-04-03 Thread barisa
On Apr 3, 8:58 pm, nrball...@gmail.com wrote: > On Apr 3, 12:33 pm, barisa wrote: > > > > > On Apr 3, 11:39 am, "Hendrik van Rooyen" wrote: > > > > "Matteo" wrote: > > > > On Apr 3, 9:05 am, Linuxwell wrote: > > > > >> Starting today I would like to study Python,Wish me luck! > > > > >Good luck

Python-URL! - weekly Python news and links (Apr 3)

2009-04-03 Thread Gabriel Genellina
QOTW: "A programmer has to know the name of many data structures." - bearophile Code organization: how to split a project into modules http://groups.google.com/group/comp.lang.python/browse_thread/thread/56c320cea02796cc/ A speech generator, expert in leading-edge W

Re: Hash of None varies per-machine

2009-04-03 Thread Dave Angel
ben.tay...@email.com wrote: Found this while trying to do something unrelated and was curious... If you hash an integer (eg. hash(3)) you get the same integer out. If you hash a string you also get an integer. If you hash None you get an integer again, but the integer you get varies depending on

IIS python web application mapping issue - resolved

2009-04-03 Thread davidj411
i searched the internet for an hour , never found this info, and figured it out myself. posting this so that others won't have to look so hard. ran across this issue and it seems that nobody really documented this correctly on http://support.microsoft.com/kb/276494 in IIS i could not add the "pyt

Re: "Pythoner",Wish me luck!

2009-04-03 Thread Ravi Kumar
> > Hi, > I'm also begginer in python; > i did few basic programs about graph etc.. > > my question is : what benefit is using interactive intrepreter ? > > the IDLE interractive python IDE is best comparing to any other most advanced IDE available in world. Really, if you are learning the python

Re: "Pythoner",Wish me luck!

2009-04-03 Thread nrballard
On Apr 3, 12:33 pm, barisa wrote: > On Apr 3, 11:39 am, "Hendrik van Rooyen" wrote: > > > > > "Matteo" wrote: > > > On Apr 3, 9:05 am, Linuxwell wrote: > > > >> Starting today I would like to study Python,Wish me luck! > > > >Good luck! > > > >Don't forget to... > > > print 'Hello World!'

Re: Python Goes Mercurial

2009-04-03 Thread Martin v. Löwis
So what were these "strong antipathies" towards Git, exactly? >>> i haven't read the article you link to, but compared to what i've read >>> on >>> dev "strong antipathies" sounds a bit over-hyped. >> That was the phrase used by GvR. > > well if you find any, please do report back. I don't l

Re: Re: Best way to pickle functions

2009-04-03 Thread Dave Angel
Aaron Scott wrote: Pickling the source code is much sturdier. It's very unlikely that the same code runs differently in different interpreters. It's much more likely that the same code runs the same, or not at all. Okay, I've run into another problem. I've saved the code to a string, so

Re: minor revision encoded in SONAME in libpython.so

2009-04-03 Thread Martin v. Löwis
>> So no, no minor revision gets encoded into the SONAME. > > Then what's the significance of the .1.0 at the end of the SONAME? Is > it just nipples for men? (I hope no one objects to my extending the > Monty Python theme to Time Bandits). Some systems require that shared libraries have a vers

Re: HTML Generation

2009-04-03 Thread J Kenneth King
Stefan Behnel writes: > J Kenneth King wrote: >> from tags import html, head, meta, title, body, div, p, a >> >> mypage = html( >> head( >> meta(attrs={'http-equiv': "Content-Type", >> 'content': "text/html;"}), >> title

Re: "Pythoner",Wish me luck!

2009-04-03 Thread barisa
On Apr 3, 11:39 am, "Hendrik van Rooyen" wrote: > "Matteo" wrote: > > On Apr 3, 9:05 am, Linuxwell wrote: > > >> Starting today I would like to study Python,Wish me luck! > > >Good luck! > > >Don't forget to... > > print 'Hello World!' > > This is better advice than what you may think, > be

Re: Hash of None varies per-machine

2009-04-03 Thread Joshua Judson Rosen
Paul Rubin writes: > > ben.tay...@email.com writes: > > 1. Is it correct that if you hash two things that are not equal they > > might give you the same hash value? > > Yes, hashes are 32 bit numbers and there are far more than 2**32 > possible Python values (think o

Re: django model problem

2009-04-03 Thread Dave Angel
Mark wrote: Hi, Say I have these simple models: class Musician(models.Model): first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) class Album(models.Model): artist = models.ForeignKey(Musician) name = models.CharField(max_length=100) I t

Re: Best way to pickle functions

2009-04-03 Thread Aaron Scott
Never mind. Solved the problem by putting the functions in a class and dumping that into a string. Then, when I need it, I executed the string to get myself the class, then created an instance of that class which gave me access to those functions along with the correct scope. Probably not the smart

Re: A design problem I met again and again.

2009-04-03 Thread paul
一首诗 schrieb: > Consolidate existing functions? > > I've thought about it. > > For example, I have two functions: > > #= > > def startXXX(id): > pass > > def startYYY(id): > pass > #= > > I could turn it into one: > > #==

Re: Hash of None varies per-machine

2009-04-03 Thread Paul Rubin
ben.tay...@email.com writes: > 1. Is it correct that if you hash two things that are not equal they > might give you the same hash value? Yes, hashes are 32 bit numbers and there are far more than 2**32 possible Python values (think of long ints), so obviously there must be multiple values that ha

platform.architecture, __path__, PYTHONPATH, and dist.utils

2009-04-03 Thread szager
Howdy, I need to support both 32-bit and 64-bit versions of compiled python modules that cannot be installed into the default search path of the python interpreter(s). I use PYTHONPATH to point to the module installations, but I have a problem: I don't know, a priori, whether the user will be run

Re: Best way to pickle functions

2009-04-03 Thread Aaron Scott
> Pickling the source code is much sturdier.  It's very unlikely that > the same code runs differently in different interpreters.  It's much > more likely that the same code runs the same, or not at all. Okay, I've run into another problem. I've saved the code to a string, so I can call it up when

Hash of None varies per-machine

2009-04-03 Thread ben . taylor
Found this while trying to do something unrelated and was curious... If you hash an integer (eg. hash(3)) you get the same integer out. If you hash a string you also get an integer. If you hash None you get an integer again, but the integer you get varies depending on which machine you're running

User or UserManager ? Problems of Observer Pattern

2009-04-03 Thread 一首诗
#This is a real world problem I met. # #We have a database containing serveral tables, like : user, role, organization. Each 2 of them has m:n relationships. These relations are stored in association tables. # #Not we have to load all these data in memory to gain higher performances. We create 3

Re: with open('com1', 'r') as f:

2009-04-03 Thread gert
On Apr 3, 3:44 pm, "Gabriel Genellina" wrote: > En Thu, 02 Apr 2009 20:04:14 -0300, gert escribió: > > > On Apr 2, 8:53 pm, Kushal Kumaran wrote: > >> On Thu, 2 Apr 2009 10:01:02 -0700 (PDT) > >> gert wrote: > >> > from subprocess import * > >> > check_call(['mode', 'COM1:9600,N,8,1,P'],shell=T

Re: python needs leaning stuff from other language

2009-04-03 Thread Mel
Steven D'Aprano wrote: > On Fri, 03 Apr 2009 11:41:10 -0400, Mel wrote: > >> Ben Finney wrote: >> >>> I think it would also be better to have One (and prefereably Only One) >>> Obvious Way To Do It. That obvious way, for those who work with >>> Python's ‘set’ and ‘dict’, is a ‘clear’ method. It

Re: python for loop

2009-04-03 Thread Aaron Brady
On Apr 3, 10:43 am, alex23 wrote: > On Apr 3, 10:36 pm, Lou Pecora wrote: > > >  Aaron Brady wrote: > > > Did I tell you guys that 'natural' has 38 definitions at > > > dictionary.com? > > > Amazing.  I suggest you pick the one that fits best. > > You mean the one that feels most natural? No, n

Re: Best way to pickle functions

2009-04-03 Thread Aaron Brady
On Apr 3, 11:04 am, Aaron Scott wrote: > I have a number of functions that I need to pickle without necessarily > knowing their names in advance. My first thought was to put all the > functions in a class, then pickle the class, but it doesn't really > work like I expected it to. > >         impor

Re: A design problem I met again and again.

2009-04-03 Thread Emile van Sebille
andrew cooke wrote: Emile van Sebille wrote: Whether you (generic you) choose to do so or not is a separate issue. Also agreed - and that is really my point. Doing so feels to me like continuing to look for a lost object once you've found it. i can see your point here, but there's two things

Best way to pickle functions

2009-04-03 Thread Aaron Scott
I have a number of functions that I need to pickle without necessarily knowing their names in advance. My first thought was to put all the functions in a class, then pickle the class, but it doesn't really work like I expected it to. import cPickle class PickleClass:

django model problem

2009-04-03 Thread Mark
Hi, Say I have these simple models: class Musician(models.Model): first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) class Album(models.Model): artist = models.ForeignKey(Musician) name = models.CharField(max_length=100) Now in `Musician` I

Re: python needs leaning stuff from other language

2009-04-03 Thread Steven D'Aprano
On Fri, 03 Apr 2009 11:41:10 -0400, Mel wrote: > Ben Finney wrote: > >> I think it would also be better to have One (and prefereably Only One) >> Obvious Way To Do It. That obvious way, for those who work with >> Python's ‘set’ and ‘dict’, is a ‘clear’ method. It seems best to have >> ‘list’ conf

Re: python needs leaning stuff from other language

2009-04-03 Thread Steven D'Aprano
On Fri, 03 Apr 2009 08:23:22 -0700, Zamnedix wrote: > On Apr 2, 3:25 pm, online.serv...@ymail.com wrote: >> python's list needs a thing list.clear() like c# arraylist and >> python needs a writeline() method > > Please don't post things like list before you do any research. You don't > know wha

Re: python for loop

2009-04-03 Thread alex23
On Apr 3, 10:36 pm, Lou Pecora wrote: >  Aaron Brady wrote: > > Did I tell you guys that 'natural' has 38 definitions at > > dictionary.com? > > Amazing.  I suggest you pick the one that fits best. You mean the one that feels most natural? -- http://mail.python.org/mailman/listinfo/python-list

Re: python needs leaning stuff from other language

2009-04-03 Thread Mel
Ben Finney wrote: > I think it would also be better to have One (and prefereably Only One) > Obvious Way To Do It. That obvious way, for those who work with > Python's ‘set’ and ‘dict’, is a ‘clear’ method. It seems best to have > ‘list’ conform with this also. Does that mean a one-off special ca

Re: Sending SMS using python script

2009-04-03 Thread Craig
There's a Python wrapper to the Skype API here: http://sourceforge.net/projects/skype4py/ On Linux I've used the PyGTK GUI that uses this. It's called SkySentials here: http://www.kolmann.at/philipp/linux/skysentials/ Craig On Apr 3, 6:50 am, "ISF (Computer Scientists without Frontiers, Italy)"

Re: python needs leaning stuff from other language

2009-04-03 Thread Zamnedix
On Apr 2, 3:25 pm, online.serv...@ymail.com wrote: > python's list needs a thing list.clear() like c# arraylist > and > python needs a writeline() method Please don't post things like list before you do any research. You don't know what you are talking about. -- http://mail.python.org/mailman/li

  1   2   >