installing 2 and 3 alongside on MS Windows
Hi! I'm using Python 2.7 for mostly unit testing here. I'm using Boost.Python to wrap C++ code into a module, in another place I'm also embedding Python as interpreter into a test framework. This is the stuff that must work, it's important for production use. I'm running MS Windows XP here and developing C++ with VS2005/VC8. What I'm considering is installing Python 3 alongside, in order to prepare the code for this newer version. What I'd like to know first is whether there are any problems I'm likely to encounter and possible workarounds. Thank you! Uli PS: Dear lazyweb, is there any way to teach VC8 some syntax highlighting for Python? -- http://mail.python.org/mailman/listinfo/python-list
Re: Namespace hack
On Thu, May 24, 2012 at 9:04 AM, Daniel Fetchinson wrote: > Funny, you got to the last line of "import this" but apparently > skipped the second line: > > Explicit is better than implicit. > > And you didn't even post your message on April 1 so no, I can't laugh > even though I'd like to. Can you be less condescending? -- Devin -- http://mail.python.org/mailman/listinfo/python-list
Re: Scoping Issues
Andrew Berg wrote: On 5/24/2012 8:59 PM, Dave Angel wrote: so I fixed that, and got inconsistent use of tabs and spaces in indentation because you mistakenly used tabs for indentation. Not to start another tabs-vs.-spaces discussion, Too late, the seeds of war have been planted, we reached to point of no return. The OP mistakenly used spaces with its tabs for indentation. JM -- http://mail.python.org/mailman/listinfo/python-list
Re: getting started
> s.name = ["a","b"] > s.value = [3,5] > > I get error that s is not defined. How do I define s and proceed to > give its attributes? Either you create a class and use __init__: class S: def __init__(self, name, value): self.name = name self.value = value or create a generic object and stick attributes to it: class Object(object): pass s = Object() s.name = ["a","b"] s.value = [3,5] I highly recommend going over the tutorial - http://docs.python.org/tutorial/ -- http://mail.python.org/mailman/listinfo/python-list
Re: getting started
On 05/25/2012 09:12 AM, Harvey Greenberg wrote: > elementary ques...I set > s.name = ["a","b"] > s.value = [3,5] > > I get error that s is not defined. How do I define s and proceed to > give its attributes? You just have to initialize s as an object that's willing to take those attributes. The most trivial way I can think of to do that would be to create an empty class for the purpose. class MyClass: pass s = MyClass() s.name = ["a","b"] s.value = [3,5] Of course if you told why you want to do it, we might be able to suggest a better type for s. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Email Id Verification
On 2012-05-25, Steven D'Aprano wrote: > On Thu, 24 May 2012 05:32:16 -0700, niks wrote: > >> Hello everyone.. >> I am new to asp.net... >> I want to use Regular Expression validator in Email id verification.. > > Why do you want to write buggy code that makes your users hate your > program? Don't do it! Write good code, useful code! Validating email > addresses is the wrong thing to do. I have to agree with Steven. Nothing will make your users swear at you as certainly as when you refuse to accept the e-mail address at which the reeive e-mail all day every day. -- Grant Edwards grant.b.edwardsYow! I appoint you at ambassador to Fantasy gmail.comIsland!!! -- http://mail.python.org/mailman/listinfo/python-list
Re: Help doing it the "python way"
On Thu, May 24, 2012 at 5:12 PM, Emile van Sebille wrote: > On 5/24/2012 2:30 PM Paul Rubin said... > >> Paul Rubin writes: >>> >>> new_list = chain( ((x,y-1), (x,y+1)) for x,y in coord_list ) >> >> >> Sorry: >> >> new_list = list(chain( ((x,y-1), (x,y+1)) for x,y in coord_list)) > > > from itertools import chain coord_list = zip(range(20,30),range(30,40)) a = [((x,y-1),(x,y+1)) for x,y in coord_list] b = list(chain(((x,y-1),(x,y+1)) for x,y in coord_list)) a == b > True > > So, why use chain? Is it a premature optimization? Similar to the practice > of using "".join(targets) vs targeta+targetb+...+targetn? Paul's code is incorrect. It should use chain.from_iterable in place of chain. The difference then is that it creates a single list of coordinates, rather than a list of pairs of coordinates. Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list
Re: Scoping Issues
Andrew Berg wrote: On 5/24/2012 8:59 PM, Dave Angel wrote: so I fixed that, and got inconsistent use of tabs and spaces in indentation because you mistakenly used tabs for indentation. Not to start another tabs-vs.-spaces discussion, but tabs are perfectly legal indentation in Python. That exception is raised when the interpreter can't determine how much a line is indented because tabs and spaces are both used. To be clear: each entire suite must be consistent with its use of either tabs /or/ spaces -- attempting to use both, even on seperate lines, raises `TabError: inconsistent use of tabs and spaces in indentation`. (Python 3, of course. ;) ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list
Re: Email Id Verification
On Fri, 25 May 2012 13:36:18 + (UTC), Grant Edwards wrote: [snip] > . . . Nothing will make your users swear at > you as certainly as when you refuse to accept the e-mail address at > which the reeive e-mail all day every day. Amusingly, every time I log into Discovercard's web site, I get a red-letter warning that my registered email address is invalid. Inquiring, I was told that the presence of the substring "spam" anywhere in the address (including "@spamcop.net") makes the address invalid in Discovercard's opinion. -- To email me, substitute nowhere->spamcop, invalid->net. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a custom fields plugin or component of django
kevon wang wrote: > I want to find a plugin of django what it can custom fields in the form. > The functions include custom fields in web page and create the fields in > database. > You might have more luck getting an answer to this question on the django list (django-us...@googlegroups.com if you're using Google Groups). Cheers -- http://mail.python.org/mailman/listinfo/python-list
Re: installing 2 and 3 alongside on MS Windows
Ulrich Eckhardt wrote: > Hi! > > I'm using Python 2.7 for mostly unit testing here. I'm using > Boost.Python to wrap C++ code into a module, in another place I'm > also embedding Python as interpreter into a test framework. This > is the stuff that must work, it's important for production use. > I'm running MS Windows XP here and developing C++ with > VS2005/VC8. > > What I'm considering is installing Python 3 alongside, in order > to prepare the code for this newer version. What I'd like to know > first is whether there are any problems I'm likely to encounter > and possible workarounds. > > Thank you! > > Uli > > PS: Dear lazyweb, is there any way to teach VC8 some syntax > highlighting for Python? > One hassle is that .py files can only be associated with one program. The proposed launcher works fine for me: https://bitbucket.org/vinay.sajip/pylauncher/downloads (I'm not sure that is the most up to date place for the launcher, but that's the one I am using) Max -- http://mail.python.org/mailman/listinfo/python-list
Re: Email Id Verification
On Sat, May 26, 2012 at 2:25 AM, Peter Pearson wrote: > Amusingly, every time I log into Discovercard's web site, I > get a red-letter warning that my registered email address is > invalid. Inquiring, I was told that the presence of the > substring "spam" anywhere in the address (including > "@spamcop.net") makes the address invalid in Discovercard's > opinion. I had no idea it was so easy to prevent spam from getting through. I am in awe, Discovercard! Yet, invalid or not, it apparently works for you? ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Email Id Verification
On Fri, May 25, 2012 at 10:33 AM, Chris Angelico wrote: > On Sat, May 26, 2012 at 2:25 AM, Peter Pearson > wrote: >> Amusingly, every time I log into Discovercard's web site, I >> get a red-letter warning that my registered email address is >> invalid. Inquiring, I was told that the presence of the >> substring "spam" anywhere in the address (including >> "@spamcop.net") makes the address invalid in Discovercard's >> opinion. > > I had no idea it was so easy to prevent spam from getting through. I > am in awe, Discovercard! I would think that it is not an anti-spam measure, but simply due to the fact that most addresses containing "spam" tend to be something like "nos...@invalid.net", being either a fake address or a junk inbox that is only checked when an important mail is expected. -- http://mail.python.org/mailman/listinfo/python-list
Re: Email Id Verification
On Sat, May 26, 2012 at 3:04 AM, Ian Kelly wrote: > I would think that it is not an anti-spam measure, but simply due to > the fact that most addresses containing "spam" tend to be something > like "nos...@invalid.net", being either a fake address or a junk inbox > that is only checked when an important mail is expected. If it's fake, you'll find out when you send to it. If it's checked only when important mail is expected, you accept it. I'm not seeing a problem here. I have a @yahoo.com.au address that is used solely in the latter form; it's checked maybe once or twice a month (in comparison to my two primary accounts, which both alert me on incoming mail, one of them in direct response to the SMTP server receiving it); and if any form rejects it, that's flat wrong. DNS lookups aren't particularly expensive. A check for whether the domain has an MX record will catch most forms of fakery without needing any extra effort. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
SQLObject 1.3.1
Hello! I'm pleased to announce version 1.3.1, the first bug-fix release of branch 1.3 of SQLObject. What is SQLObject = SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be easy to use and quick to get started with. SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite, Firebird, Sybase, MSSQL and MaxDB (also known as SAPDB). Where is SQLObject == Site: http://sqlobject.org Development: http://sqlobject.org/devel/ Mailing list: https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss Archives: http://news.gmane.org/gmane.comp.python.sqlobject Download: http://pypi.python.org/pypi/SQLObject/1.3.1 News and changes: http://sqlobject.org/News.html What's New == * Fixed a minor bug in PostgreSQL introspection: VIEWs don't have PRIMARY KEYs - use sqlmeta.idName as the key. * Fixed a bug in cache handling while unpickling. For a more complete list, please see the news: http://sqlobject.org/News.html Oleg. -- Oleg Broytmanhttp://phdru.name/p...@phdru.name Programmers don't die, they just GOSUB without RETURN. -- http://mail.python.org/mailman/listinfo/python-list
PEP 405 vs 370
http://www.python.org/dev/peps/pep-0405/ I don't get what PEP 405 (Python Virtual Environments) brings vs what we already had in PEP 370 since Python 2.6. Obviously 405 has a tool to create virtual environments, but that's trivial for PEP 370 [1], and has support for isolation from the system-wide site patch which could've been added in addition to PEP 370. So maybe I'm missing something? [1] PYTHONUSERBASE=~/my-py-venv pip install --user Whatever will create ~/my-py-venv and everything under it as needed PYTHONUSERBASE=~/my-py-venv python setup.py install --user the same without pip -- damjan -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP 405 vs 370
On Fri, May 25, 2012 at 1:45 PM, Damjan Georgievski wrote: > http://www.python.org/dev/peps/pep-0405/ > > I don't get what PEP 405 (Python Virtual Environments) brings vs what we > already had in PEP 370 since Python 2.6. > > Obviously 405 has a tool to create virtual environments, but that's trivial > for PEP 370 [1], and has support for isolation from the system-wide site > patch which could've been added in addition to PEP 370. > > So maybe I'm missing something? Virtual environments entail not just isolation from the system environment, but also the ability to switch between different virtual environments on demand. A single user site-packages directory can't easily support that. The two PEPs are related but geared toward very different purposes. Virtual environments are for setting up a multitude of environments in order to support running scripts with different requirements or configurations on a single platform. The user site-packages directory is for augmenting the static system environment with packages desired by individual users, who can't or simply don't want to install the package for all users of the system. Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP 405 vs 370
Am 25.05.2012 21:45, schrieb Damjan Georgievski: > http://www.python.org/dev/peps/pep-0405/ > > I don't get what PEP 405 (Python Virtual Environments) brings vs what we > already had in PEP 370 since Python 2.6. My PEP 370 is about installing additional packages as an unprivileged user and for the current user. It's a simplistic approach that just adds one more site-package directory in the user's home directory. PEP 405 is a different beast. It adds support for isolated environment that don't share state with the site wide installation. A user can have multiple virtual envs and install different sets of packages in each env. Christian -- http://mail.python.org/mailman/listinfo/python-list
Re: Email Id Verification
On 25May2012 13:36, Grant Edwards wrote: | On 2012-05-25, Steven D'Aprano wrote: | > On Thu, 24 May 2012 05:32:16 -0700, niks wrote: | >> Hello everyone.. | >> I am new to asp.net... | >> I want to use Regular Expression validator in Email id verification.. | > | > Why do you want to write buggy code that makes your users hate your | > program? Don't do it! Write good code, useful code! Validating email | > addresses is the wrong thing to do. | | I have to agree with Steven. Nothing will make your users swear at | you as certainly as when you refuse to accept the e-mail address at | which the reeive e-mail all day every day. And it will get better. If the validation code is sufficiently widespread, the user may be unable to complain or report the issue. -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ Don't have awk? Use this simple sh emulation: #!/bin/sh echo 'Awk bailing out!' >&2 exit 2 - Tom Horsley -- http://mail.python.org/mailman/listinfo/python-list
Re: getting started
On 25May2012 09:37, Dave Angel wrote: | On 05/25/2012 09:12 AM, Harvey Greenberg wrote: | > elementary ques...I set | > s.name = ["a","b"] | > s.value = [3,5] | > | > I get error that s is not defined. How do I define s and proceed to | > give its attributes? [...] | Of course if you told why you want to do it, we might be able to suggest | a better type for s. If he's just mucking around to get a feel for the language then there probably isn't a better type. So a trite subclass of "object" is the go. Just a brief aside for Harvey: I spent a brief while confused that this doesn't work: o = object() o.x = 1 and that I needed to do this: class O(object): pass o = O() o.x = 1 until I realised that plain "object", the root of all classes, doesn't accept arbitrary attributes. But subclasses do. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ ..And in all of Babylonia there was wailing and gnashing of teeth, till the prophets bade the multitudes get a grip on themselves and shape up. - Woody Allen -- http://mail.python.org/mailman/listinfo/python-list
Re: Email Id Verification
On Friday, 25 May 2012 14:36:18 UTC+1, Grant Edwards wrote: > On 2012-05-25, Steven D'Aprano wrote: > > On Thu, 24 May 2012 05:32:16 -0700, niks wrote: > > > >> Hello everyone.. > >> I am new to asp.net... > >> I want to use Regular Expression validator in Email id verification.. > > > > Why do you want to write buggy code that makes your users hate your > > program? Don't do it! Write good code, useful code! Validating email > > addresses is the wrong thing to do. > > I have to agree with Steven. Nothing will make your users swear at > you as certainly as when you refuse to accept the e-mail address at > which the reeive e-mail all day every day. > > -- > Grant Edwards grant.b.edwardsYow! I appoint you > at ambassador to Fantasy > gmail.comIsland!!! Ditto. This would be my public email, but (like most I believe) also have 'private' and work email addresses. For the OP, just trying to check an email is syntactically correct is okay-ish if done properly. Normally as mentioned you just send a confirmation email to said address with some id and link that confirms (normally with an expiry period). Some mail servers support the "does this mailbox exist?" request, but I fear these days due to spam, most will just say no -- so the only option is to send and handle a bounce (and some don't even send back bounces). And a pretty good way for malicious people to make mail servers think you're trying a DoS. Although, what I'm finding useful is an option of "auth'ing" with twitter, facebook, google etc... Doesn't require a huge amount of work, and adds a bit of validity to the request. Jon (who still didn't get any bloody Olympic tickets). -- http://mail.python.org/mailman/listinfo/python-list
Re: Dynamic comparison operators
> > Any time you find yourself thinking that you want to use eval to solve a > problem, take a long, cold shower until the urge goes away. > > If you have to ask why eval is dangerous, then you don't know enough > about programming to use it safely. Scrub it out of your life until you > have learned about code injection attacks, data sanitation, trusted and > untrusted input. Then you can come back to eval and use it safely and > appropriately. I would +1 QOTW - but fear might have to cheat and say +1 to 2 paragraphs of the week :) Jon. -- http://mail.python.org/mailman/listinfo/python-list
usenet reading
Hi All, Normally use Google Groups but it's becoming absolutely frustrating - not only has the interface changed to be frankly impractical, the posts are somewhat random of what appears, is posted and whatnot. (Ironically posted from GG) Is there a server out there where I can get my news groups? I use to be with an ISP that hosted usenet servers, but alas, it's no longer around... Only really interested in Python groups and C++. Any advice appreciated, Jon. -- http://mail.python.org/mailman/listinfo/python-list
Re: usenet reading
On Friday, May 25, 2012 3:38:55 PM UTC-7, Jon Clements wrote: > Hi All, > > Normally use Google Groups but it's becoming absolutely frustrating - not > only has the interface changed to be frankly impractical, the posts are > somewhat random of what appears, is posted and whatnot. (Ironically posted > from GG) > > Is there a server out there where I can get my news groups? I use to be with > an ISP that hosted usenet servers, but alas, it's no longer around... > > Only really interested in Python groups and C++. > > Any advice appreciated, > > Jon. Have you tried news.gmane.org? They have a Mail2News gateway for many popular mailing lists, as well as some of the traditional usenet hierarchy - including this group. Here is a link to their page for this group, to give you an idea of what kind of reading options they provide. http://dir.gmane.org/gmane.comp.python.general Or you can point your usenet reader @ news.gmane.org and subscribe 'normally'. HTH, Monte -- http://mail.python.org/mailman/listinfo/python-list
Re: usenet reading
On Fri, May 25 2012, Jon Clements wrote: > Hi All, > > Normally use Google Groups but it's becoming absolutely frustrating - > not only has the interface changed to be frankly impractical, the > posts are somewhat random of what appears, is posted and > whatnot. (Ironically posted from GG) > > Is there a server out there where I can get my news groups? I use to > be with an ISP that hosted usenet servers, but alas, it's no longer > around... > > Only really interested in Python groups and C++. > > Any advice appreciated, > > Jon. I have had good success with news.eternal-september.org . http://www.eternal-september.org/ Jason -- http://mail.python.org/mailman/listinfo/python-list
Re: usenet reading
[Default] On Fri, 25 May 2012 23:30:24 -0600, Jason Earl wrote: >On Fri, May 25 2012, Jon Clements wrote: > >> Hi All, >> >> Normally use Google Groups but it's becoming absolutely frustrating - >> not only has the interface changed to be frankly impractical, the >> posts are somewhat random of what appears, is posted and >> whatnot. (Ironically posted from GG) >> >> Is there a server out there where I can get my news groups? I use to >> be with an ISP that hosted usenet servers, but alas, it's no longer >> around... >> >> Only really interested in Python groups and C++. >> >> Any advice appreciated, >> >> Jon. > >I have had good success with news.eternal-september.org . > >http://www.eternal-september.org/ > >Jason I could definitely make use of this. Even though I use Agent, I've mostly just been using the mailing list in lieu of having an actual newsgroup subscription. Now I can turn that habit around! Not the OP, but you have my appreciation regardless! ~Temia -- When on earth, do as the earthlings do. -- http://mail.python.org/mailman/listinfo/python-list