Re: tuple.index() and tuple.count()

2008-06-23 Thread Benjamin
On Jun 23, 3:13 pm, [EMAIL PROTECTED] wrote: > never mind... a coworker pointed me to this > > http://bugs.python.org/issue1696444 > > apparently they're there in py3k... and 2.6 -- http://mail.python.org/mailman/listinfo/python-list

Re: Threads, GIL and re.match() performance

2008-06-25 Thread Benjamin
On Jun 25, 9:05 am, Mirko Dziadzka <[EMAIL PROTECTED]> wrote: > > 1) Is there a reason for this? I think it is because the Python re library uses the Python C-API which is not threadsafe. > 2) Is the regex library not thread-safe? > 3) Is it possible, to release the GIL in re.match() to >    get m

Re: Problem found in tutorial

2008-06-25 Thread Benjamin
On Jun 25, 2:09 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > John W. Hamill wrote: > > C:\__jh\ftp\python\2_5_2\doc\tutorial\node11.html > > When reporting doc bugs, it is a good idea to check the most recent > version.  The 3.0 version has the same problems (no changes have been > made -- page and

Re: CAPI and thread safety

2008-06-27 Thread Benjamin
On Jun 27, 4:33 pm, Lane Brooks <[EMAIL PROTECTED]> wrote: > I am writing an extension module that needs to release the global > interpreter lock during some blocking I/O calls, but I need a mutex in > the C code to make some of the shared data in the extension module are > kept thread safe.  Can a

Re: Embedded Python Import problem

2008-06-27 Thread Benjamin
On Jun 27, 5:47 pm, sleek <[EMAIL PROTECTED]> wrote: > I am having trouble with the following code: > > PyObject *module = PyImport_ImportModule(modulename); > if (module == NULL) { > >     PyObject* et, *ev, *etr; >     PyErr_Fetch(&et, &ev, &etr); >     PyObject* traceback = PyImport_ImportModule

Re: surprising behaviour of os.environ.clear

2008-06-27 Thread Benjamin
On Jun 27, 4:05 pm, "Joe P. Cool" <[EMAIL PROTECTED]> wrote: > If I call os.environ.clear in a python program child processes still > see the deleted entries. But when I iterate over the keys like so > > names =  os.environ.keys > for k in names: >     del  os.environ[k] > > then the entries are al

Re: surprising behaviour of os.environ.clear

2008-06-28 Thread Benjamin
On Jun 28, 1:23 am, Tim Roberts <[EMAIL PROTECTED]> wrote: > Benjamin <[EMAIL PROTECTED]> wrote: > > >This is because of how os.environ is implement with a UserDict > >subclass. > > Why?  I mean, I can see that it happens, but I don't understand why being a

Re: HTML Parsing

2008-06-28 Thread Benjamin
On Jun 28, 9:03 pm, [EMAIL PROTECTED] wrote: > Hi everyone > I am trying to build my own web crawler for an experiement and I don't > know how to access HTTP protocol with python. Look at the httplib module. > > Also, Are there any Opensource Parsing engine for HTML documents > available in Pytho

Re: using Python's AST generator for other languages

2008-07-10 Thread Benjamin
On Jul 10, 12:40 pm, eliben <[EMAIL PROTECTED]> wrote: > Hello, > > I'm building a parser in Python, and while pondering on the design of > my ASTs had the idea to see what Python uses. I quickly got to the > compiler.ast module, and understood it's automatically generated. So I > went to the sourc

Re: Python 3.0 and removal of the 'string' module

2008-07-11 Thread Benjamin
On Jul 11, 3:06 am, Ben Finney <[EMAIL PROTECTED]> wrote: > "Martin v. Löwis" <[EMAIL PROTECTED]> writes: > > > > This is rather disappointing. Is that entire page suspect? > > > All documentation about Python 3 is suspect until Python 3 gets > > actually released (nobody can say for sure how the r

Re: using Python's AST generator for other languages

2008-07-11 Thread Benjamin
On Jul 11, 12:27 am, eliben <[EMAIL PROTECTED]> wrote: > > > 2) What is the meaning of the comment in astgen.py ? Are the Python > > > maintainers unhappy with the design of the AST ?3 > > > Node, I think, is talking about a node in the parse tree. (AST is > > generated from another parse tree.) Se

Re: Python Embedding Thread

2008-07-21 Thread Benjamin
On Jul 21, 6:56 am, [EMAIL PROTECTED] wrote: > Hi :) > > I want to run Python in my app. That works still fine. But my app > supports now Threads and I would like to know what to do, that it runs > without problems. > > PyGILState_Release and PyGILState_Ensure should solve the problem > right? Wher

Re: sys.stderr.write returns string length in Python 3

2008-07-22 Thread Benjamin
Alan G Isaac wrote: > Is this new behavior intentional? :: Yes, it's in the PEP http://www.python.org/dev/peps/pep-3116/. > > >>> sys.stderr.write("thisisatest\n") > thisisatest > 12 > > Here is the reason for it: > > >>> help(sys.stderr.write) > Help on method writ

Re: Is this a valid use of 'import'?

2008-07-22 Thread Benjamin
On Jul 22, 12:26 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > > *Python2 has a built-in reload function, but in 3.0 it is removed > because it almost never did what people wanted or expected and thus lead > to surprising bugs.  You can delete a module from sys.modules and > re-import it, but the mo

Re: Attack a sacred Python Cow

2008-07-24 Thread Benjamin
On Jul 24, 11:43 am, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > > "explicit-is-etc" - just like the remaining of Python's zen - is a > general philosophy statement, not an absolute rule. Another quote states > that practicality beats purity. Very much so. In fact, I'd like you all to take a

Re: Is it allowed to use function results as default arguments ?

2008-07-28 Thread Benjamin
On Jul 28, 3:28 pm, Stef Mientki <[EMAIL PROTECTED]> wrote: > hello, > > I've a perfect working procedure, > at least as far I've tested it it works perfect. > > But I was just experimenting with inspect, > and saw that the default argument was not parsed correctly. > > So I wonder if this is allow

Re: Class definition attribute order

2008-08-01 Thread Benjamin
On Aug 1, 6:23 pm, Andrew Lentvorski <[EMAIL PROTECTED]> wrote: > How do I determine the order of definition of class attributes? > > For example, if I have a class > > class Test(object): >      y = 11 >      x = 22 > > How do I tell that y was defined before x? You wait until Python 3.0 where yo

Re: Using QSystemTrayIcon with PyQt

2008-03-30 Thread Benjamin
On Mar 29, 11:02 pm, Alex Teiche <[EMAIL PROTECTED]> wrote: > Hello, > > I am pretty new to Python, and have never learned C++. I am trying to > implement the following thing into my python application: > > http://doc.trolltech.com/4.3/qsystemtrayicon.html > > Through PyQt. I have been using PyQt

Re: Using QSystemTrayIcon with PyQt

2008-03-31 Thread Benjamin
On Mar 31, 8:41 pm, Alex Teiche <[EMAIL PROTECTED]> wrote: > On Mar 31, 6:40 pm, Alex Teiche <[EMAIL PROTECTED]> wrote: > > > > > On Mar 31, 11:49 am, Alex Teiche <[EMAIL PROTECTED]> wrote: > > > > On Mar 30, 3:50 pm, Benjamin <[EMAIL PROTECTED]

Re: Using QSystemTrayIcon with PyQt

2008-04-01 Thread Benjamin
On Apr 1, 7:56 am, BlueBird <[EMAIL PROTECTED]> wrote: > On Apr 1, 6:00 am, Alex Teiche <[EMAIL PROTECTED]> wrote: > > > > > On Mar 31, 7:53 pm, Benjamin <[EMAIL PROTECTED]> wrote: > > > > On Mar 31, 8:41 pm, Alex Teiche <[EMAIL PROTECTED]> wr

Re: Classes in modules

2008-04-02 Thread Benjamin
On Apr 2, 8:05 pm, [EMAIL PROTECTED] wrote: > I'm trying to get this source code split into multiple files: > > http://pygermanwhist.googlecode.com/files/pygermanwhist.12.py > > I've been trying to make so that I have one class per file for easier > readability. My problem is that the interpreter

Parsing HTML?

2008-04-02 Thread Benjamin
I'm trying to parse an HTML file. I want to retrieve all of the text inside a certain tag that I find with XPath. The DOM seems to make this available with the innerHTML element, but I haven't found a way to do it in Python. -- http://mail.python.org/mailman/listinfo/python-list

Re: How is GUI programming in Python?

2008-04-09 Thread Benjamin
On Apr 9, 8:54 pm, Chris Stewart <[EMAIL PROTECTED]> wrote: > I've always had an interest in Python and would like to dabble in it > further. I've worked on a few very small command line programs but > nothing of any complexity. I'd like to build a really simple GUI app > that will work across Ma

Re: Module Conflicts

2008-04-09 Thread Benjamin
On Apr 9, 5:33 pm, Jose <[EMAIL PROTECTED]> wrote: > I have a module named math.py in a package with some class > definitions. I am trying to import the standard python math module > inside of math.py but It seems to be importing itself. Is there any > way around this problem without renaming my

Re: How to use my dynamic link libraries in python??

2008-04-10 Thread Benjamin
On Apr 10, 9:21 pm, "郭勇军" <[EMAIL PROTECTED]> wrote: > Hello: > My OS is Linux, I compile my dynamic link libraries , and > want to call the function of my dynamic library through python! > How can I realize the function? Please give me some advices! Thanks You have several opt

Re: Brand New!

2008-04-14 Thread Benjamin
On Apr 14, 9:00 pm, agent E 10 <[EMAIL PROTECTED]> wrote: >Hi, I'm brand new to programming. Have any suggestions? I'm young. > Was it a good idea to start with python? I was planning on creating a > very simple program that asked yes/no questions for a school project. IMHO, Python is an excell

Re: about the ';'

2008-04-14 Thread Benjamin
On Apr 13, 10:33 pm, "Penny Y." <[EMAIL PROTECTED]> wrote: > I saw many python programmers add a ';' at the end of each line. > As good style, should or should not we do coding with that? Where did you see that? > > Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Brand New!

2008-04-15 Thread Benjamin
On Apr 15, 6:37 pm, agent E 10 <[EMAIL PROTECTED]> wrote: > On Apr 14, 8:37 pm, Benjamin <[EMAIL PROTECTED]> wrote: > > > On Apr 14, 9:00 pm, agent E 10 <[EMAIL PROTECTED]> wrote:>Hi, I'm brand > > new to programming. Have any suggestions? I

Re: How is GUI programming in Python?

2008-04-15 Thread Benjamin
On Apr 15, 9:17 pm, [EMAIL PROTECTED] wrote: > On 11 abr, 20:31, sturlamolden <[EMAIL PROTECTED]> wrote: > > > On Apr 11, 5:01 am, "Gabriel Genellina" <[EMAIL PROTECTED]> > > wrote: > > > > Another annoying thing with the Qt license is that you have to choose it > > > at the very start of the proje

Re: How to print a unicode string?

2008-04-18 Thread Benjamin
On Apr 18, 7:14 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > From what I've googled, I think I need to set my locale. > > Not on this operating system. On Windows, you need to change > your console. If it is a cmd.exe-style console, use chcp. > For IDLE, changing the output encoding is not

Re: Explicit variable declaration

2008-04-22 Thread Benjamin
On Apr 22, 7:39 pm, "Filip Gruszczyński" <[EMAIL PROTECTED]> wrote: > Hello everyone! > > It is my first message on this list, therefore I would like to say > hello to everyone. I am fourth year student of CS on the Univeristy of > Warsaw and recently I have become very interested in dynamically ty

Re: Parsing HTML?

2008-04-26 Thread Benjamin
On Apr 3, 9:10 pm, 7stud <[EMAIL PROTECTED]> wrote: > On Apr 3, 12:39 am, [EMAIL PROTECTED] wrote: > > > BeautifulSoup does what I need it to.  Though, I was hoping to find > > something that would let me work with the DOM the way JavaScript can > > work with web browsers' implementations of the DO

Re: Parsing HTML?

2008-04-26 Thread Benjamin
On Apr 6, 11:03 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: > Benjamin wrote: > > I'm trying to parse an HTML file.  I want to retrieve all of the text > > inside a certain tag that I find with XPath.  The DOM seems to make > > this available with the innerHTML el

Re: Are rank noobs tolerated, here?

2008-05-04 Thread Benjamin
On May 4, 6:45 pm, notbob <[EMAIL PROTECTED]> wrote: > I'm trying to learn how to program. I'm using: > > How to Think Like a Computer Scientist > > Learning with Python > 2nd Edition > > Am I likely to receive any help, here, or is there another irc, forum, etc, > that might better serve a comple

Re: Class definition attribute order

2008-08-15 Thread Benjamin
On Aug 5, 12:53 am, Michele Simionato <[EMAIL PROTECTED]> wrote: > BTW, since I do not really follow python-dev, do you know > if some consensus was reached on the issue of adding an ordered dict > implementation to the standard library? I believe it has been deferred to 2.7/3.1. -- http://mail.p

Re: Parsing and Editing Source

2008-08-15 Thread Benjamin
On Aug 15, 9:21 am, "Paul Wilson" <[EMAIL PROTECTED]> wrote: > Hi all, > > I'd like to be able to do the following to a python source file > programmatically: >  * Read in a source file >  * Add/Remove/Edit Classes, methods, functions >  * Add/Remove/Edit Decorators >  * List the Classes >  * List

Re: Suggestion for improved ImportError message

2008-08-15 Thread Benjamin
On Aug 13, 3:55 pm, Kent Tenney <[EMAIL PROTECTED]> wrote: > Howdy, > > I was just bit by > > from image import annotate > > ImportError: cannot import name annotate > > I found the problem via > > import image > print image.__file__ > > which made it clear that the wrong image module had been foun

Re: python interpreter

2008-08-15 Thread Benjamin
On Aug 12, 10:06 am, Wojtek Walczak <[EMAIL PROTECTED]> wrote: > > And keep in mind that reload() is removed in Py3k. Hope this helps. It's not gone; it's just renamed to imp.reload. > > -- > Regards, > Wojtek Walczak,http://www.stud.umk.pl/~wojtekwa/ -- http://mail.python.org/mailman/listinfo/py

Re: A variables variables

2008-08-23 Thread Benjamin
On Aug 23, 7:25 pm, Gandalf <[EMAIL PROTECTED]> wrote: > how can I declare a variable with another variable  name? > > for example  I will use PHP: > > $a= "hello"; > > $a_hello="baybay"; > > print ${'a_'.$a)  //output: baybay Doing this sort of thing in Python is very anti idiom. > > how can i do

Re: Python 3000 C API Changes

2008-08-23 Thread Benjamin
On Aug 23, 10:34 am, rahul <[EMAIL PROTECTED]> wrote: > I am trying to find out what Python C APIs are changing from Python > 2.5 to Python 3.0 but there does not seem to be a single list of > changes (or at least google is not finding one). > If someone knows about where I should look, please let

Re: Enhanced property decorator

2008-08-25 Thread Benjamin
On Aug 25, 8:45 pm, Daniel <[EMAIL PROTECTED]> wrote: > I've often been frustrated by the inability of the built-in property > descriptor to handle anything other than a read-only property when > used as a decorator. Furthermore, read/write/delete properties take > their doc-string and property def

Re: Enhanced property decorator

2008-08-26 Thread Benjamin
On Aug 25, 9:00 pm, Daniel <[EMAIL PROTECTED]> wrote: > On 25 Aug, 21:52, Benjamin <[EMAIL PROTECTED]> wrote: > > > ... I think Python 2.6 may have > > want you want: > > > class A(object): > > >     @property > >     def my_prop(): return se

Re: Abstract Base Class register function

2008-09-27 Thread Benjamin
On Sep 27, 4:50 pm, "Mikolai Fajer" <[EMAIL PROTECTED]> wrote: > I have been experimenting with the abc module in py3k and thought > about using the register method of an ABC as a class decorator: > > > import abc > class MyABC(metaclass=abc.ABCMeta): >     pass > > @MyABC.register > class MySub()

Re: docstrings => RestructuredText => Sphinx => Nice html docs (?)

2008-10-01 Thread Benjamin
On Oct 1, 4:10 pm, Infinity77 <[EMAIL PROTECTED]> wrote: > Hi All, > >     I apologize in advance if my question sounds dumb. I googled back > and forth but my google-fu today is not working very well... > I have seen the new style Python html documentation, which is > extremely nice, and by readin

Re: lint for Python?

2008-10-04 Thread Benjamin
On Oct 3, 4:38 pm, Pat <[EMAIL PROTECTED]> wrote: > I've been searching for a good multi-module lint checker for Python and > I haven't found one yet. > > Pylint does a decent job at checking for errors only within a single module. > > Here's one of my problems.  I have two modules. > > In module o

Re: find overlapping lines & output times observed

2013-05-06 Thread Oscar Benjamin
On 6 May 2013 19:39, Linsey Raaijmakers wrote: > I have a file like this: > action startend > 50 53215321 > 7 53235347 > 12 53395351 > 45 53735373 > 45 54205420 > 25 54255425 [snip] your code below suggests

Re: Why do Perl programmers make more money than Python programmers

2013-05-07 Thread Benjamin Kaplan
On May 7, 2013 5:42 PM, "Neil Hodgson" wrote: > > jmfauth: > >> 2) More critical, Py 3.3, just becomes non unicode compliant, >> (eg European languages or "ascii" typographers !) >> ... > > >This is not demonstrating non-compliance. It is comparing performance, not compliance. > >Please sh

Re: object.enable() anti-pattern

2013-05-09 Thread Oscar Benjamin
On 9 May 2013 14:07, Roy Smith wrote: > In article <518b32ef$0$11120$c3e8...@news.astraweb.com>, > Steven D'Aprano wrote: > >> There is no sensible use-case for creating a file without opening it. > > Sure there is. Sometimes just creating the name in the file system is > all you want to do. T

Re: object.enable() anti-pattern

2013-05-10 Thread Oscar Benjamin
On 10 May 2013 15:01, Roy Smith wrote: > In article , > Robert Kern wrote: > >> I'd be curious to see in-the-wild instances of the anti-pattern that >> you are talking about, then. I think everyone agrees that entirely >> unmotivated "enable" methods should be avoided, but I have my doubts >> th

Re: in need of some help regarding my rock paper scissors game

2013-05-12 Thread Benjamin Kaplan
On Sun, May 12, 2013 at 12:33 PM, Alex Norton wrote: > im new to python and im in the middle of making a RPS game for a college > unit. > > i have used PyQt to create the GUI and i have received help regarding adding > the code to the buttons. > > but its missing something as the error > > 'Traceb

Re: Python 2.7.x - problem with obejct.__init__() not accepting *args and **kwargs

2013-05-15 Thread Oscar Benjamin
On 15 May 2013 12:18, wzab wrote: > I had to implement in Python 2.7.x a system which heavily relies on > multiple inheritance. > Working on that, I have came to very simplistic code which isolates > the problem: > (The essential thing is that each base class receives all arguments > and uses only

Re: Determine actually given command line arguments

2013-05-15 Thread Oscar Benjamin
On 15 May 2013 13:52, Henry Leyh wrote: > On 15.05.2013 14:24, Roy Smith wrote: >> >> In article , >> Henry Leyh wrote: >> >>> Is there a simple way to determine which >>> command line arguments were actually given on the commandline, i.e. does >>> argparse.ArgumentParser() know which of its na

[RELEASED] Python 2.7.5

2013-05-15 Thread Benjamin Peterson
in 2.7.4.) This is a production release. Happy May, Benjamin Peterson 2.7 Release Manager (on behalf of all of Python 2.7's contributors) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.7.x - problem with obejct.__init__() not accepting *args and **kwargs

2013-05-16 Thread Oscar Benjamin
On 16 May 2013 03:06, Steven D'Aprano wrote: > On Wed, 15 May 2013 13:16:09 +0100, Oscar Benjamin wrote: > > >> I don't generally use super() > > Then you should, especially in Python 3. > > If you're not using super in single-inheritance classes, then y

Re: Harmonic distortion of a input signal

2013-05-19 Thread Oscar Benjamin
On 19 May 2013 23:25, wrote: > How can i at least find a peek in FFT spectrum of a square wave ? > From there i could easily build formula. Sorry for bothering but i am new to > Python. Are you the same person who posted the original question? You probably want to use numpy for this. I'm not s

Re: Harmonic distortion of a input signal

2013-05-21 Thread Oscar Benjamin
On 20 May 2013 18:23, jmfauth wrote: > Non sense. > > The discrete fft algorithm is valid only if the number of data > points you transform does correspond to a power of 2 (2**n). As with many of your comments about Python's unicode implementation you are confusing performance with validity. The

Re: file I/O and arithmetic calculation

2013-05-22 Thread Oscar Benjamin
On 22 May 2013 22:05, Carlos Nepomuceno wrote: > > filenames = ['1.txt', '2.txt', '3.txt', '4.txt', '5.txt'] > contents = [[[int(z) for z in y.split(',')] for y in open(x).read().split()] > for x in filenames] > s1c = [sum([r[0] for r in f]) for f in contents] > a1r = [sum(f[0])/float(len(f[0]

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-22 Thread Oscar Benjamin
On 22 May 2013 23:31, Carlos Nepomuceno wrote: > > I still don't understand why % benefits from literals optimization > ("'%d'%12345") while '{:d}'.format(12345) doesn't. There's no reason why that optimisation can't happen in principle. However no one has written a patch for it. Why don't you l

Re: file I/O and arithmetic calculation

2013-05-22 Thread Oscar Benjamin
On 23 May 2013 00:49, Carlos Nepomuceno wrote: > > The code is pretty obvious to me, I mean there's no obfuscation at all. I honestly can't tell if you're joking. -- http://mail.python.org/mailman/listinfo/python-list

Re: file I/O and arithmetic calculation

2013-05-23 Thread Oscar Benjamin
On 23 May 2013 04:15, Carlos Nepomuceno wrote: > The last line of my noob piece can be improved. So this is it: Most of it can be improved. > filenames = ['1.txt', '2.txt', '3.txt', '4.txt', '5.txt'] > contents = [[[int(z) for z in y.split(',')] for y in open(x).read().split()] > for x in file

RE: Python #ifdef

2013-05-28 Thread Benjamin Kaplan
On May 28, 2013 1:10 PM, "Carlos Nepomuceno" wrote: > > Thank you! I made it run like the following. What do you think about that? IS there a better way? > > > > #The following runs on Python 2.7 > sc3=''' > # Python 3 > def original(n): > m = 0 > for b in n.to_bytes(6, 'big'): > m

Re: Fatal Python error

2013-05-29 Thread Oscar Benjamin
On 29 May 2013 12:48, Joshua Landau wrote: > Hello all, again. Instead of revising like I'm meant to be, I've been > delving into a bit of Python and I've come up with this code: Here's a simpler example that gives similar results: $ py -3.3 Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:

Re: Fatal Python error

2013-05-29 Thread Oscar Benjamin
On 29 May 2013 14:02, Dave Angel wrote: > On 05/29/2013 08:45 AM, Oscar Benjamin wrote: > > More likely a bug in the 2.x interpreter. Once inside an exception handler, > that frame must be held somehow. If not on the stack, then in some separate > list. So the logic will presuma

Re: Apache and suexec issue that wont let me run my python script

2013-06-04 Thread Benjamin Schollnick
I hope this clears some of this up. If I have made any mistakes here, please feel free to politely correct me |-) - Benjamin -- http://mail.python.org/mailman/listinfo/python-list

Re: Re-using copyrighted code

2013-06-08 Thread Benjamin Kaplan
On Sat, Jun 8, 2013 at 2:31 PM, Malte Forkel wrote: > Hello, > > I have written a small utility to locate errors in regular expressions > that I want to upload to PyPI. Before I do that, I would like to learn > a litte more about the legal aspects of open-source software. What would > be a good i

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Benjamin Kaplan
On Sun, Jun 9, 2013 at 2:38 AM, Νικόλαος Κούρας wrote: > Τη Κυριακή, 9 Ιουνίου 2013 12:20:58 μ.μ. UTC+3, ο χρήστης Lele Gaifax έγραψε: > >> > How about a string i wonder? >> > s = "νίκος" >> > what_are these_bytes = s.encode('iso-8869-7').encode(utf-8') > >> Ignoring the usual syntax error, this i

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Benjamin Kaplan
On Sun, Jun 9, 2013 at 2:20 AM, Νικόλαος Κούρας wrote: > Τη Κυριακή, 9 Ιουνίου 2013 12:12:36 μ.μ. UTC+3, ο χρήστης Cameron Simpson > έγραψε: >> On 09Jun2013 02:00, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= >> wrote: >> >> | Steven wrote: >> >> | >> Since 1 byte can hold up to 256 chars, why not

Re: Re-using copyrighted code

2013-06-09 Thread Benjamin Kaplan
On Sun, Jun 9, 2013 at 1:32 PM, Mark Janssen wrote: > On Sun, Jun 9, 2013 at 12:50 PM, Michael Torrie wrote: >> On 06/09/2013 11:18 AM, Mark Janssen wrote: >>> You actually do not. Attaching a legal document is purely a secondary >>> protection from those who would take away right already grante

Re: Re-using copyrighted code

2013-06-09 Thread Benjamin Kaplan
On Sun, Jun 9, 2013 at 6:40 PM, Mark Janssen wrote: >> Mark, ever watched TV? Or gone to the movies? Or walked into a bookshop? >> Listened to the radio? All these things publish copyrighted work. It is >> utter nonsense that merely publishing something in public gives up the >> monopoly privilege

Re: Harmonic distortion of a input signal

2013-06-12 Thread Oscar Benjamin
On 20 May 2013 00:36, wrote: > One more question. Function np.argmax returns max of non-complex numbers ? > Because FFT array of my signal is complex. Use abs() like in my example. This will give the absolute value of the complex numbers: >>> z = 1+1j >>> z (1+1j) >>> abs(z) 1.4142135623730951

Re: Short-circuit Logic

2013-06-12 Thread Oscar Benjamin
On 30 May 2013 22:03, Carlos Nepomuceno wrote: >> Here's another way, mathematically equivalent (although not necessarily >> equivalent using floating point computations!) which avoids the divide-by- >> zero problem: >> >> abs(a - b) < epsilon*a > > That's wrong! If abs(a) < abs(a-b)/epsilon you w

Re: Split a list into two parts based on a filter?

2013-06-13 Thread Oscar Benjamin
On 12 June 2013 19:47, Terry Reedy wrote: > The proper loop statement > > for s in songs: > (new_songs if s.is_new() else old_songs).append(s) I think I would just end up rewriting this as for s in songs: if s.is_new(): new_songs.append(s) else: old_songs.append(s) b

Re: Version Control Software

2013-06-13 Thread Benjamin Kaplan
On Jun 13, 2013 10:17 AM, "Grant Edwards" wrote: > > On 2013-06-13, Ben Finney wrote: > > cutems93 writes: > > > >> I am looking for an appropriate version control software for python > >> development, and need professionals' help to make a good decision. > > > >> Currently I am considering four

Re: Eval of expr with 'or' and 'and' within

2013-06-14 Thread Benjamin Kaplan
On Jun 14, 2013 9:34 AM, "Michael Torrie" wrote: > > On 06/14/2013 03:50 AM, Nick the Gr33k wrote: > > >>> print(name or month or year) > > abcd > > >>> print(name and month and year) > > ijkl > > Interesting. I'd have thought a boolean expression would return True or > False, not a string. Le

Re: Why 'files.py' does not print the filenames into a table format?

2013-06-15 Thread Benjamin Schollnick
d.com/327/ http://imgs.xkcd.com/comics/exploits_of_a_mom.png";> They didn't sanitize your database inputs. My suggestion would be for you to stop trying to re-invent the wheel, and use COTS software. - Benjamin -- http://mail.python.org/mailman/listinfo/python-list

Re: A few questiosn about encoding

2013-06-15 Thread Benjamin Schollnick
ider that? Try this: 1) Open a Web browser 2) Go to Google.com 3) Type in "Hex 1B" 4) Click on the first link 5) In the Hexadecimal column find 1B. Or open your favorite calculator, and convert Hexadecimal 1B to Decimal (Base 10). - Benjamin -- http://mail.python.org/mailman/listinfo/python-list

Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.]

2013-06-17 Thread Benjamin Kaplan
On Mon, Jun 17, 2013 at 8:55 AM, Simpleton wrote: > On 17/6/2013 5:22 μμ, Terry Reedy wrote: >> >> On 6/17/2013 7:34 AM, Simpleton wrote: >>> >>> On 17/6/2013 9:51 πμ, Steven D'Aprano wrote: Now, in languages like Python, Ruby, Java, and many others, there is no table of memory addr

Re: Don't feed the troll...

2013-06-17 Thread Oscar Benjamin
On 17 June 2013 17:35, D'Arcy J.M. Cain wrote: > On Mon, 17 Jun 2013 14:39:56 + (UTC) > Grant Edwards wrote: >> I don't want _any_ copies from from Mailman. I don't subscribe to >> whatever mailing list you're talking about. I'm reading this via an >> NNTP server. Keep replies in the group

Re: Python Liscensing

2013-06-18 Thread Oscar Benjamin
On 18 June 2013 09:56, Steven Hern wrote: > > We are an educational establishment which wishes to use Python 3.3.2 – Does > the license cover multi-users in a classroom environment? Yes, absolutely. Many educational institutions universities, schools, etc. use Python in classroom environments (th

Re: Beginner Question: 3D Models

2013-06-19 Thread Oscar Benjamin
On 19 June 2013 12:13, wrote: > > I've seen some information on Blender. Is it possible to have the entire > program contained within a single exe (or exe and some other files) so that > it can be passed around and used by others without having to install blender? I don't know if Blender woul

Re: Beginner Question: 3D Models

2013-06-19 Thread Oscar Benjamin
On 19 June 2013 14:14, wrote: > This sounds similar to what I might want. So you know of any online tutorials > for this? It's hard to tell what you're referring to since you haven't included any quoted context in your message (like I have above). I'll assume you're referring to what Fábio said

Re: Problem with the "for" loop syntax

2013-06-20 Thread Oscar Benjamin
On 20 June 2013 04:11, Cameron Simpson wrote: > I use vi/vim and it both shows the matching bracket when the cursor > is on one and also have a keystroke to bounce the curser between > this bracket and the matching one. > > If you suspect you failed to close a bracket, one approach is to > go _bel

Re: Is this PEP-able? fwhile

2013-06-24 Thread Benjamin Kaplan
On Mon, Jun 24, 2013 at 8:54 PM, Chris Angelico wrote: > On Tue, Jun 25, 2013 at 12:01 PM, rusi wrote: >> On Tuesday, June 25, 2013 3:08:57 AM UTC+5:30, Chris Angelico wrote: >>> On Tue, Jun 25, 2013 at 5:52 AM, <> wrote: >>> >>> > (NOTE: Many people are being taught to avoid 'break' and 'conti

Re: Why is the argparse module so inflexible?

2013-06-27 Thread Oscar Benjamin
On 27 June 2013 22:30, Jason Swails wrote: > > An alternative is, of course, to simply subclass ArgumentParser and copy > over all of the code that catches an ArgumentError to eliminate the internal > exception handling and instead allow them to propagate the call stack. I would think it easier t

Re: How to tell Script to use pythonw.exe ?

2013-07-03 Thread Benjamin Kaplan
On Jul 3, 2013 8:27 AM, "Νίκος" wrote: > > Στις 3/7/2013 6:43 πμ, ο/η Tim Roberts έγραψε: > >> goldtech wrote: >>> >>> >>> I just changed the file extension of the script file from .py to .pyw >>> and it uses pythonw.exe. I didn't read it anywhere, just intuited it >>> and tried it. Python has so

Re: Importing modules into IronPython

2013-07-03 Thread Benjamin Kaplan
On Wed, Jul 3, 2013 at 3:05 PM, HighBeliever wrote: > Hi, I have to shift a Python 2.7 program to run in Windows. Doing that has > forced me to use IronPython because my program is dependent on a .dll file > that uses .NET framework. > > I moved all my code to Iron Python and modified it to work

Re: python adds an extra half space when reading from a string or list

2013-07-03 Thread Oscar Benjamin
On 4 July 2013 01:53, Ben Finney wrote: > rusi writes: > >> As a good Christian I believe that Chris tried more than anyone else >> on this list to help Nikos before talking recourse to another gem of >> biblical wisdom: > >> He that spareth his rod hateth his son: but he that loveth him >> chast

Re: Coping with cyclic imports

2013-07-04 Thread Oscar Benjamin
On 4 July 2013 13:48, wrote: > On Tuesday, April 8, 2008 10:06:46 PM UTC+2, Torsten Bronger wrote: [snip] > > If you do "import foo" inside bar and "import bar" inside foo, it will work > fine. By the time anything actually runs, both modules will be fully loaded > and will have references to e

Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte

2013-07-05 Thread Benjamin Kaplan
On Jul 5, 2013 12:12 AM, "Lele Gaifax" wrote: > > Νίκος Gr33k writes: > > > try: > > host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0] > > except Exception as e: > > host = "Reverse DNS Failed" > > > > How can the above code not be able to reeverse dns any more and it > > fa

Re: Coping with cyclic imports

2013-07-05 Thread Oscar Benjamin
On 5 July 2013 02:24, Cameron Simpson wrote: > On 04Jul2013 16:03, Oscar Benjamin wrote: > | > | Is there some reason you're responding to a post from 5 years ago? > > Is there some reason not to, if no newer solutions are available? No, I was genuinely curious. My way of

Re: How to make this faster

2013-07-05 Thread Oscar Benjamin
On 5 July 2013 09:22, Helmut Jarausch wrote: > Hi, > > I have coded a simple algorithm to solve a Sudoku (probably not the first > one). > Unfortunately, it takes 13 seconds for a difficult problem which is more than > 75 times slower > than the same algorithm coded in C++. > Is this to be expec

Re: How to make this faster

2013-07-05 Thread Oscar Benjamin
On 5 July 2013 11:53, Helmut Jarausch wrote: > I even tried to use dictionaries instead of Numpy arrays. This version is a > bit > slower then the lists of lists version (7.2 seconds instead of 6 second) but > still > much faster than the Numpy array solution. When you switched to dictionaries

Re: How to make this faster

2013-07-05 Thread Oscar Benjamin
On 5 July 2013 15:28, Helmut Jarausch wrote: > On Fri, 05 Jul 2013 14:41:23 +0100, Oscar Benjamin wrote: > >> On 5 July 2013 11:53, Helmut Jarausch wrote: >>> I even tried to use dictionaries instead of Numpy arrays. This version is a >>> bit >>> slow

Re: How to make this faster

2013-07-05 Thread Oscar Benjamin
On 5 July 2013 15:48, Helmut Jarausch wrote: > On Fri, 05 Jul 2013 12:02:21 +, Steven D'Aprano wrote: > >> On Fri, 05 Jul 2013 10:53:35 +, Helmut Jarausch wrote: >> >>> Since I don't do any numerical stuff with the arrays, Numpy doesn't seem >>> to be a good choice. I think this is an argu

Re: How to make this faster

2013-07-05 Thread Oscar Benjamin
On 5 July 2013 16:17, Helmut Jarausch wrote: > > I've tried the following version > > def find_good_cell() : > Best= None > minPoss= 10 > for r,c in Grid : > if Grid[(r,c)] > 0 : continue Sorry, I think what I meant was that you should have a structure called e.g. Remaining which is th

Re: Explain your acronyms (RSI?)

2013-07-06 Thread Benjamin Kaplan
On Sat, Jul 6, 2013 at 12:38 PM, Terry Reedy wrote: > "rms has crippling RSI" (anonymous, as quoted by Skip). > > I suspect that 'rms' = Richard M Stallman (but why lower case? to insult > him?). I 'know' that RSI = Roberts Space Industries, a game company whose > Kickstarter project I supported.

Re: xslice idea | a generator slice

2013-07-11 Thread Oscar Benjamin
On 11 July 2013 15:54, Russel Walker wrote: > ...oh and here is the class I made for it. > > class xslice(object): > ''' > xslice(seq, start, stop, step) -> generator slice > ''' > > def __init__(self, seq, *stop): Wouldn't it be better if it has the same signature(s) as itertools

Re: xslice idea | a generator slice

2013-07-11 Thread Oscar Benjamin
On 11 July 2013 17:21, Russel Walker wrote: > To confess, this is the second time I've made the mistake of trying to > implement generator like functionality of a builtin when there already is on > in itertools. Need to start studying that module abit more I think. I'm > looking at the docs now

Re: GeoIP2 for retrieving city and region ?

2013-07-15 Thread Benjamin Kaplan
On Sat, Jul 13, 2013 at 10:43 AM, Νικόλας wrote: > Στις 13/7/2013 7:54 μμ, ο/η Dennis Lee Bieber έγραψε: >> >> Are you paying for a fixed IP number? I suspect you are if you >> were >> running a world-accessible server. >> >> Obviously a fixed IP will be tied to a fixed connection

Re: Python 3: dict & dict.keys()

2013-07-24 Thread Oscar Benjamin
On Jul 24, 2013 7:25 AM, "Peter Otten" <__pete...@web.de> wrote: > > Ethan Furman wrote: > > > So, my question boils down to: in Python 3 how is dict.keys() different > > from dict? What are the use cases? > > I just grepped through /usr/lib/python3, and could not identify a single > line where s

<    1   2   3   4   5   6   7   8   9   10   >