Python-list Digest, Vol 81, Issue 266

anu python anupython at gmail.com
Sat Jun 26 04:17:52 EDT 2010


Thanks for your reply  to Shashwat Anand & thomas.sub( Help on finding word
is valid as per English Dictionary through   python )

Let me try.


On Fri, Jun 25, 2010 at 8:57 PM, <python-list-request at python.org> wrote:

> Send Python-list mailing list submissions to
>        python-list at python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://mail.python.org/mailman/listinfo/python-list
> or, via email, send a message with subject or body 'help' to
>        python-list-request at python.org
>
> You can reach the person managing the list at
>        python-list-owner at python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Python-list digest..."
>
> Today's Topics:
>
>   1. Re: best way to increment an IntVar? (Alan G Isaac)
>   2. Re: Help on finding word is valid as per English Dictionary
>      through   python (Shashwat Anand)
>   3. Re: Why Is Escaping Data Considered So Magical? (Stephen Hansen)
>   4. Re: GDAL-1.7.1 : vcvarsall.bat missing (kBob)
>   5. Re: GDAL-1.7.1 : vcvarsall.bat missing (kBob)
>   6. Re: Python dynamic attribute creation (Bruno Desthuilliers)
>   7. python source code -> win/dos executable (on linux) (superpollo)
>   8. Re: GDAL-1.7.1 : vcvarsall.bat missing (Christian Heimes)
>   9. Re: python source code -> win/dos executable (on linux)
>      (Grant Edwards)
>  10. os.system: string encoding (Peter Kleiweg)
>  11. Re: deprecated string module issue (Stephen Hansen)
>
>
> ---------- Forwarded message ----------
> From: Alan G Isaac <alan.isaac at gmail.com>
> To: python-list at python.org
> Date: Fri, 25 Jun 2010 10:12:21 -0400
> Subject: Re: best way to increment an IntVar?
> On 6/24/2010 1:59 AM, Dennis Lee Bieber wrote:
>
>> It is NOT a numeric "variable" in Python realms.
>>
>
> Sure, but why does it not behave more like one?
> It seems both obvious and desirable, so I'm
> guessing there is a good reason not to do it.
>
>         So var+=increment can't be used because Python would rebind the
>> name
>> var to a new object
>>
>
>  import Tkinter as tk
>>>>
>>>> class IntVar2(tk.IntVar):
>>>>
>>> ...   def __iadd__(self, val):
> ...     self.set(self.get()+val)
> ...     return self
> ...
>
>> root = tk.Tk()
>>>> myintvar2 = IntVar2()
>>>> temp = myintvar2
>>>> myintvar2 += 5
>>>> print(myintvar2.get(),myintvar2 is temp)
>>>>
>>> (5, True)
>
> Alan Isaac
>
>
>
> ---------- Forwarded message ----------
> From: Shashwat Anand <anand.shashwat at gmail.com>
> To: Thomas Jollans <thomas at jollans.com>
> Date: Fri, 25 Jun 2010 19:50:55 +0530
> Subject: Re: Help on finding word is valid as per English Dictionary
> through python
> why do you need that ?
> which platform are you onto ?
>
> On OSX you can use 'DictionaryServices' API
> eg.,
>
> import sys
> import DictionaryServices
> word = " ".join(sys.argv[1:])
> print DictionaryServices.DCSCopyTextDefinition(None, word, (0, len(word)))
>
> Gives the meaning of the input word (works with python 2.5)
>
> You can use this script for Vi  (~/.vimrc) if you want, control+a will do a
> spell check.
>
> " Toggle Spell-Check
> set spell spelllang=
> function ToggleSpellCheck()
>  if &spelllang == "en"
> set spelllang=
> else
>  set spelllang=en
> endif
> endfunction
> command! ToggleSpellChecking call ToggleSpellCheck()
> nmap <c-a> :ToggleSpellChecking<cr>
>
> But again am not aware of your use case.
>
> On Fri, Jun 25, 2010 at 7:19 PM, Thomas Jollans <thomas at jollans.com>wrote:
>
>> On 06/25/2010 03:30 PM, anu python wrote:
>> > Hi,
>> >               I have a text file ,
>> > a.txt
>> > ------------------------
>> >
>> > this is a lcose button
>> >
>> > where u can observer  "lcose"  is not a valid word.It's typing
>> > mistake.Actual word is "close".
>> >
>> > How can i check that each word entered in txt file having correct
>> > meaningful words as per English Dictionary.
>> >
>> > Do you have any package which can check "English Dictionary"
>>
>> In a pinch, I might use open("/usr/share/dict/words", "r") as a
>> thesaurus, and check for words in there. Read the file and create a
>> giant frozenset or something. For something a bit more civilized, I
>> expect that there's a python package interfacing at least one of
>> (ispell, aspell, hunspell, myspell) (and what they're all called.
>>
>> There is a multitude of "English dictionaries". Some don't even include
>> "neighbour", imagine that!
>>
>> >
>> > Please help me.
>> >
>> > Thanks,
>> > Anu
>> >
>>
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
>
>
>
> ---------- Forwarded message ----------
> From: Stephen Hansen <me+list/python at ixokai.io>
> To: python-list at python.org
> Date: Fri, 25 Jun 2010 07:27:44 -0700
> Subject: Re: Why Is Escaping Data Considered So Magical?
> On Fri, Jun 25, 2010 at 5:15 AM, Jorgen Grahn <grahn+nntp at snipabacken.se<grahn%2Bnntp at snipabacken.se>
> > wrote:
>
>> Am I missing something?  If not, I can go back to sleep -- and keep
>> avoiding SQL and web programming like the plague until that community
>> has entered the 21st century.
>>
>
> You're not missing anything. Its been the accepted industry practice for
> years and years (and /years/), the taught industry practice, the advised
> industry practice, the constantly repeated practice on every even vaguely
> database related forum forever now.
>
> However:
>
>   a) Some people are convinced of their own infallibility, and prefer a
> clever construct generating a string that has to be parsed due to the
> cleverness of said construct.
>   b) Some people don't listen / understand.
>   c) Some people don't care.
>
> And so, SQL injection attacks continue to persist. Then again, its not like
> anyone in the C-ish world doesn't know about bounds checking on arrays, do
> they? But buffer overflows persist. Probably for similar reasons as above
> (with slightly different 'and prefer' clause)
>
> --Stephen
>
>
> ---------- Forwarded message ----------
> From: kBob <krdean at gmail.com>
> To: python-list at python.org
> Date: Fri, 25 Jun 2010 07:29:07 -0700 (PDT)
> Subject: Re: GDAL-1.7.1 : vcvarsall.bat missing
> On Jun 25, 1:26 am, Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
> > On 24/06/2010 21:48, Christian Heimes wrote:
> >
> > >>   I am attempting to install the GDAL bindings (GDAL-1.7.1) on a
> > >> Windows XP Desktop with Python 2.6 and GDAL. During install, the
> > >> script finishes with "error: Unable to find vcvarsall.bat".
> >
> > >> What dependencies am I missing?
> >
> > > Visual Studio 2008
> >
> > > Christian
> >
> > Not always, see my comment here.
> >
> > http://www.mail-archive.com/python-win32@python.org/msg06755.html
> >
> > Kindest regards.
> >
> > Mark Lawrence
>
>  Thanks for the tips, gentlemen.
>
>  I'll try my luck with Cygwin's ggc before I look into another C/C++
> compiler.
>
> Kelly Dean
> Fort Collins, CO
>
>
>
> ---------- Forwarded message ----------
> From: kBob <krdean at gmail.com>
> To: python-list at python.org
> Date: Fri, 25 Jun 2010 07:29:07 -0700 (PDT)
> Subject: Re: GDAL-1.7.1 : vcvarsall.bat missing
> On Jun 25, 1:26 am, Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
> > On 24/06/2010 21:48, Christian Heimes wrote:
> >
> > >>   I am attempting to install the GDAL bindings (GDAL-1.7.1) on a
> > >> Windows XP Desktop with Python 2.6 and GDAL. During install, the
> > >> script finishes with "error: Unable to find vcvarsall.bat".
> >
> > >> What dependencies am I missing?
> >
> > > Visual Studio 2008
> >
> > > Christian
> >
> > Not always, see my comment here.
> >
> > http://www.mail-archive.com/python-win32@python.org/msg06755.html
> >
> > Kindest regards.
> >
> > Mark Lawrence
>
>  Thanks for the tips, gentlemen.
>
>  I'll try my luck with Cygwin's ggc before I look into another C/C++
> compiler.
>
> Kelly Dean
> Fort Collins, CO
>
>
>
> ---------- Forwarded message ----------
> From: Bruno Desthuilliers <bruno.42.desthuilliers at websiteburo.invalid>
> To: python-list at python.org
> Date: Fri, 25 Jun 2010 16:34:23 +0200
> Subject: Re: Python dynamic attribute creation
> WANG Cong a écrit :
>
>> Hi, list!
>>
>> I have a doubt about the design of dynamic attribute creation by
>> assignments in Python.
>>
>> As we know, in Python, we are able to create a new attribute of
>> a class dynamically by an assignment:
>>
>>  class test: pass
>>>>>
>>>> ...
>>
>>> test.a = "hello"
>>>>> test.a
>>>>>
>>>> 'hello'
>>
>> However, I still don't get the points why Python designs it like this.
>>
>> My points are:
>>
>>  (snip)
>
> Python's classes are plain objects, and like any other object are created
> at runtime. Having to special-case them would break the simplicity and
> uniformity of Python for no good reason. Just like there's no good reason to
> make setattr() working differently for class and non-class objects.
>
> FWIW, what you call "metaprogramming" is just ordinary programming - at
> least in Python. All your fears and concerns about Python's dynamism are
> just a priori learned from the "mainstream" B&D culture. From experience,
> these are non-issues - unless of course misused by some fool, but then
> there's no way to prevent stupids from doing stupid things. So, yes, Python
> rely quite a lot on programmer's common sense and discipline. Now the good
> news is that is JustWork(tm).
>
>
>
>
>
>
>
>
> ---------- Forwarded message ----------
> From: superpollo <utente at esempio.net>
> To: python-list at python.org
> Date: Fri, 25 Jun 2010 16:46:41 +0200
> Subject: python source code -> win/dos executable (on linux)
> hi.
>
> suppose i work in a linux environment, but i would like to ship a win/dos
> executable file from time to time, just for test purposes (my "testers" are
> windows users and don't want to go through the hassle of installing python
> on their win boxes). what is the best way to do that? (the application
> should be a simple console app, but my question applies to gui/tkinter apps
> too)
>
> hint: when i do the same in C, i usually do something like:
>
> http://www.youtube.com/watch?v=rhe6N7FB1D4
>
> bye
>
>
>
> ---------- Forwarded message ----------
> From: Christian Heimes <lists at cheimes.de>
> To: python-list at python.org
> Date: Fri, 25 Jun 2010 16:53:30 +0200
> Subject: Re: GDAL-1.7.1 : vcvarsall.bat missing
> >  I'll try my luck with Cygwin's ggc before I look into another C/C++
> > compiler.
>
> Better grab a recent build of MinGW32. Python's build system has native
> support for mingw32. IIRC Cygwin's GCC is only supported for Cygwin
> builds of Python.
>
> Christian
>
>
>
>
> ---------- Forwarded message ----------
> From: Grant Edwards <invalid at invalid.invalid>
> To: python-list at python.org
> Date: Fri, 25 Jun 2010 14:53:21 +0000 (UTC)
> Subject: Re: python source code -> win/dos executable (on linux)
> On 2010-06-25, superpollo <utente at esempio.net> wrote:
>
> > suppose i work in a linux environment, but i would like to ship a
> > win/dos executable file from time to time, just for test purposes (my
> > "testers" are windows users and don't want to go through the hassle
> > of installing python on their win boxes). what is the best way to do
> > that?  (the application should be a simple console app, but my
> > question applies to gui/tkinter apps too)
>
> http://www.google.com/search?q=python+windows+executable
>
> You're not going to be able to do it on linux.  A virtual machine
> running win2k works fine, though.
>
> --
> Grant Edwards               grant.b.edwards        Yow! I left my WALLET in
>                                  at               the BATHROOM!!
>                              gmail.com
>
>
>
> ---------- Forwarded message ----------
> From: Peter Kleiweg <p.c.j.kleiweg at rug.nl>
> To: python-list at python.org
> Date: Fri, 25 Jun 2010 17:13:19 +0200
> Subject: os.system: string encoding
>
> How do I set the string encoding for os.system to anything other then
> UTF-8?
>
>
> (peter) ~ echo $LANG
> nl_NL at euro
> (peter) ~ python3
> Python 3.1.1 (r311:74480, Oct  2 2009, 11:50:52)
> >>> '\N{EURO SIGN}'
> '€'
> >>> import os
> >>> os.system('echo \N{EURO SIGN}')
> â?¬
> 0
> >>>
>
>
> --
> Peter Kleiweg
>
>
>
> ---------- Forwarded message ----------
> From: Stephen Hansen <me+list/python at ixokai.io>
> To: python-list at python.org
> Date: Fri, 25 Jun 2010 08:26:39 -0700
> Subject: Re: deprecated string module issue
> On Fri, Jun 25, 2010 at 7:02 AM, GrayShark <howe.steven at gmail.com> wrote:
>
>> Thanks for the suggestion. I gave it a quick try. Same 'warning'. No,
>> using the string module is the issue. Perhaps I'll just ignore it.
>>
>
> Perhaps? Why perhaps? The warning is simply factually wrong-- therefore,
> there's no reason in the world not to ignore it. You can submit a bug to the
> pylint people though, that may be nice :)
>
> Remember that pylint is a third-party tool made by a group of people who
> have a certain understanding and set of expectations for what's good / bad /
> right / wrong.  It isn't *really* an authoritative voice of "what is
> supported by Python" or "what is good Python code" -- and they even know
> that, which is why exactly what warnings and such it spits out are *very*
> configurable, so it can be adjusted to different peoples needs and
> standards.
>
> Its a very useful metric, but consider what it spits out advice and not
> necessarily errors or problems that need addressing. You have to decide that
> for yourself on a case-by-case basis.
>
> --S
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100626/3e9ffed0/attachment.html>


More information about the Python-list mailing list