Re: Help with Latin Characters

2011-07-24 Thread Benjamin Kaplan
On Sun, Jul 24, 2011 at 3:47 PM, Joao Jacome wrote: > > 2011/7/24 Chris Angelico >> >> On Mon, Jul 25, 2011 at 5:01 AM, Joao Jacome wrote: >> > Already tried without unicode string in rootdir, same results. What if try >> > using raw strings? >> >> Raw strings are just another way of typing them

Re: os.path.dirname(sys.argv[0]) always returns nothing

2011-08-01 Thread Benjamin Kaplan
On Mon, Aug 1, 2011 at 1:38 PM, happykid wrote: > I want to use this function to get the directory path of the running > script, but it always returns empty string. Can anyone help me solve > this? Thank you. > -- > sys.argv[0] is the name of the script you called. If you call "python spam.py",

Re: Why no warnings when re-assigning builtin names?

2011-08-15 Thread Benjamin Kaplan
On Aug 15, 2011 5:56 PM, "Gerrat Rickert" wrote: > > With surprising regularity, I see program postings (eg. on StackOverflow) from inexperienced Python users accidentally re-assigning built-in names. > > > > For example, they’ll innocently call some variable, “list”, and assign a list of items t

Re: 'super' object has no attribute '__setitem__'

2011-08-18 Thread Benjamin Peterson
luvspython gmail.com> writes: > def __setitem__(self, item, value): > super(HistoryKeeper, self).__setitem__(item, value) object has no __setitem__. Are you looking for __setattr__? > > class Vehicle(HistoryKeeper): > def __init__(self, tag, make, model): > args = locals

Re: Installing numpy on 2.7 (OS X 10.7)

2011-08-21 Thread Benjamin Kaplan
On Sun, Aug 21, 2011 at 6:03 AM, jefflovejapan wrote: > I'm following the instructions given http://www.scipy.org/ > Installing_SciPy/Mac_OS_X">here, but it isn't working. > Specifically, I'm getting: > > Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/ > Contents/MacOS/Pytho

Re: Python IDE/Eclipse

2011-08-26 Thread Benjamin Kaplan
On Aug 26, 2011 11:39 AM, "Moises Alberto Lindo Gutarra" wrote: > > I like Aptana Studio > http://www.aptana.com/products/studio3 > FYI, Aptana is just a set of extensions for Eclipse. Aptana Studio is just Eclipse with all of the Aptana extensions (including PyDev) preinstalled. > 2011/8/26 Dav

Re: PC locks up with list operations

2011-08-31 Thread Benjamin Kaplan
On Wed, Aug 31, 2011 at 8:40 AM, Chris Withers wrote: > > On 31/08/2011 13:33, Steven D'Aprano wrote: >> >> I am using Linux desktops; both incidents were with Python 2.5. Do newer >> versions of Python respond to this sort of situation more gracefully? > > Ironically, Windows does better here and

Re: Python thread

2011-09-01 Thread Benjamin Kaplan
On Thu, Sep 1, 2011 at 6:21 PM, Prasad, Ramit wrote: >>So what exactly does threading module do, if it doesn't create a subprocess. >>Does each thread have its own stack and PC. >>What advantage would a threading module provide over sequential execution. > > I believe it merely simulates multiple

Re: convert python List to javascript array

2011-09-02 Thread Benjamin Kaplan
On Fri, Sep 2, 2011 at 11:34 AM, Vineet Deodhar wrote: > Hi ! > Within a web framework, I want want to pass a python sequence (list or > tuple) to client-side javascript function as an array (javascript > compatible) > e.g., I have this list: > L = ['spam', 'ham', 'eggs', 12, (13.63)] > What is th

Need advice on Web / Database framework...

2011-09-03 Thread Benjamin Schollnick
Folks, I need some advice on a python web & database framework to use...? I have handcrafted a sqllite3 python script, that is a basic web application, interfacing with a sqlite3 database... But I am concerned at the thought of handcrafting a administration interface, and so forth. Are there

Re: Running Scripts vs Interactive mode

2011-02-24 Thread Benjamin Kaplan
On Thu, Feb 24, 2011 at 10:34 AM, grobs456 wrote: > c:\dev\python>python HelloWorld.py > 'python' is not recognized as an internal or external command, > operable program or batch file. > > #I then tried this for a success!: > > c:\dev\python>c:\python27\python.exe HelloWorld.py > Hello WOrld! > >

Re: backwards-compatibility

2011-02-26 Thread Benjamin Kaplan
On Sat, Feb 26, 2011 at 8:11 AM, Jason Swails wrote: > Hello, > > I have a question I was having a difficult time finding with a quick google > search, so I figured someone on here might know.  For the sake of backwards > compatibility (and supporting systems whose default python is OLD), I'd like

Re: Python Language Question?

2011-02-27 Thread Benjamin Kaplan
On Sun, Feb 27, 2011 at 11:45 AM, Paul Symonds wrote: > Can someone give and explanation of what is happening with the following: > a,b = 0,1                       # this assigns a = 0 and b = 1 > while b < 10: > > ...     print b > ...     a, b = b, a+b > ... > 1 > 1 > 2 > 3 > 5 > 8 > >

Re: subprocess running ant

2011-03-03 Thread Benjamin Kaplan
On Mar 3, 2011 1:19 PM, "Thom Hehl" wrote: > > I am attempting to write a python script that will check out and build our code, then deploy the executable. It will report any failures via e-mail. > > > > To this end, I’m trying to run my ant build from inside of python. I have tried the following:

Re: changing to function what works like a function

2011-03-07 Thread Benjamin Kaplan
On Mar 7, 2011 6:35 AM, "Victor Paraschiv" wrote: > > Hi everyone > i understood that the goal of Python is to make programing easy (of course, powerful at the same time). > I think one way to do it is to eliminate unnecessary syntax exceptions. One is the following: > for a complex number "z", to

Re: how to communicate in python with an external process

2011-03-07 Thread Benjamin Kaplan
On Mon, Mar 7, 2011 at 6:12 PM, Danny Shevitz wrote: > >> >> http://pypi.python.org/pypi/pymatlab/ >> >> Cheers, >> Chris > > I am on a mac. Does pymatlab support mac's? I tried the linux 64 bit egg > (downloaded to my local machine) and got: > > macshevitz:~ dannyshevitz$ sudo easy_install > pym

Re: questions about multiprocessing

2011-03-07 Thread Benjamin Kaplan
On Mon, Mar 7, 2011 at 7:47 PM, Vincent Ren wrote: > Got it, thanks. > But what should I do if I want to improve the efficiency of my > program? > Is there any particular reason you're using processes and not threads? Functions that wait for stuff to happen in C land, such as I/O calls, release t

Re: Defining class attributes + inheritance

2011-03-08 Thread Benjamin Kaplan
On Mar 8, 2011 6:02 PM, "Martin De Kauwe" wrote: > > Hi, > > I think this might be obvious? I have a base class which contains X > objects which other classes inherit e.g. > > class BaseClass(object): >def __init__(self, something, something_else): >self.something = something >

Re: Don't Want Visitor To See Nuttin'

2011-03-10 Thread Benjamin Kaplan
On Thu, Mar 10, 2011 at 6:48 PM, Victor Subervi wrote: > On Wed, Mar 9, 2011 at 5:33 PM, Ian wrote: >> >> On 09/03/2011 21:01, Victor Subervi wrote: >>> >>> The problem is that it prints "Content-Type: text/html" to the screen >> >> If you can see what is intended to be a header, then it follows

Re: Grabbing user's agent and OS type

2011-03-11 Thread Benjamin Kaplan
2011/3/11 Νικόλαος Κούρας : > Thanks a lot Steven! > > The following code worked like a charm! > > ** > agent = os.environ['HTTP_USER_AGENT'] > > # determination of user browser > agent = agent.lower() > if 'chrome' in agent: >        agent = 'Chrome' > if 'firefox' in agent: >    

Re: Calling C++ Modules in Python

2011-03-11 Thread Benjamin Kaplan
On Mar 11, 2011 4:23 PM, "Patrick" wrote: > > Hi, > > I saw in the Beginner document that "•Is easily extended by adding new > modules implemented in a compiled language such as C or C++. ". > > While to my investigation, it seems not that easy or did I miss > something? > > boost python (C++ libr

Re: os.path.walk() to get full path of all files

2011-03-16 Thread Benjamin Kaplan
On Wed, Mar 16, 2011 at 5:00 PM, dude wrote: > awesome, that worked.  I'm not sure how the magic is working with your > underscores there, but it's doing what I need.  thanks. > -- It's not magic at all. _ is just a variable name. When someone names a variable _, it's just to let you know that t

Re: how to use variable to substitute class's variable?

2011-03-17 Thread Benjamin Kaplan
On Thu, Mar 17, 2011 at 3:31 AM, Hans wrote: > I have things like: > file1: > class aaa: >    def __init__(self): >        self.variable1='a1' >        self.variable2='a2' >        self.varable3='a3' > > > in main proc: > import file1 > b=file1.aaa() > c={'variable1':'value1','variable2':'value2',

Re: Some Minor questions on Class and Functions

2011-03-19 Thread Benjamin Kaplan
On Sat, Mar 19, 2011 at 7:57 PM, joy99 wrote: > > Dear Group, > > I am trying to pose two small questions. > > 1) I am using Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v. > 1500 32 bit (Intel)] on win32 Type "copyright", "credits" or > "license()" for more information, on WINXP SP2. > >

Re: Regex in if statement.

2011-03-20 Thread Benjamin Kaplan
On Sun, Mar 20, 2011 at 8:46 PM, Ken D'Ambrosio wrote: > Hey, all -- I know how to match and return stuff from a regex, but I'd > like to do an if, something like (from Perl, sorry): > > if (/MatchTextHere/){DoSomething();} > > How do I accomplish this in Python? > > Thanks! > > -Ken > Python doe

Re: Decorator Syntax

2011-03-21 Thread Benjamin Kaplan
On Mon, Mar 21, 2011 at 8:59 PM, Mike Patterson wrote: > In my Python class the other day, the professor was going over > decorators and he briefly mentioned that there had been this huge > debate about the syntax and using the @ sign to signify decorators. > > I read about the alternative forms p

Re: Problem with keyboard up/down arrows in Python 2.4 interpreter

2011-03-21 Thread Benjamin Kaplan
On Tue, Mar 22, 2011 at 2:27 AM, Julien wrote: > Hi, > > I'm having problems when typing the up/down arrows in the Python 2.4 > interpreter (exact version: Python 2.4.6 (#1, Mar  3 2011, 15:45:53) > [GCC 4.2.1 (Apple Inc. build 5664)] on darwin). > > When I press the up arrow it outputs "^[[A" and

Re: Problem with re module

2011-03-22 Thread Benjamin Kaplan
On Tue, Mar 22, 2011 at 2:40 PM, John Harrington wrote: > On Mar 22, 11:16 am, John Bokma wrote: >> John Harrington writes: >> > I'm trying to use the following substitution, >> >> >      lineList[i]=re.sub(r'(\\begin{document})([^$])',r'\1\n\n >> > \2',lineList[i]) >> >> > I intend this to matc

Re: Python 3.2 Debug build

2011-03-22 Thread Benjamin Kaplan
On Tue, Mar 22, 2011 at 6:25 PM, Willis Cheung wrote: > Thanks for your answers. Just to make sure I do it correctly, is it the > CPython package on http://hg.python.org the one which I should be > downloading? Thanks again > > > > Wilis > If you want to compile your own copy of Python 3.2, you s

Re: Problem with keyboard up/down arrows in Python 2.4 interpreter

2011-03-25 Thread Benjamin Kaplan
On Fri, Mar 25, 2011 at 2:25 AM, Julien wrote: > On Mar 22, 5:37 pm, Benjamin Kaplan wrote: >> On Tue, Mar 22, 2011 at 2:27 AM, Julien wrote: >> > Hi, >> >> > I'm having problems when typing the up/down arrows in the Python 2.4 >> > interpreter (e

Re: functools.partial doesn't work without using named parameter

2011-03-25 Thread Benjamin Kaplan
On Fri, Mar 25, 2011 at 2:30 AM, Paddy wrote: > Hi, I just found the following oddity where for function fsf1 I am forced to > use a named parameter for correct evaluation and was wondering why it doesn't > work, yet the example from the docs of wrapping int to create basetwo doesn't > need thi

Re: Directly Executable Files in Python

2011-03-28 Thread Benjamin Kaplan
On Tue, Mar 29, 2011 at 12:16 AM, harrismh777 wrote: > Chris Rebert wrote: >> >> Yes. py2exe is a tool which generates such Windows executables: >> http://www.py2exe.org/ > > Interesting... but it can't possibly be creating .exe files (compiling)... I > don't buy it... it has to be reproducing the

Re: Sudden error: SyntaxError: Non-ASCII character '\xc2' in file

2011-03-30 Thread Benjamin Kaplan
On Wed, Mar 30, 2011 at 10:34 AM, Gnarlodious wrote: > RSS script runs fine on my dev machine but errors on the server > machine. Script was last run 3 days ago with no problem. Possible > clue: dev machine is (Mac OSX) running Python 3.1.1 while server is > running Python 3.1.3. I have not update

Re: Guido rethinking removal of cmp from sort method

2011-04-01 Thread Benjamin Peterson
Paul Rubin nospam.invalid> writes: > > I actually think Python3 actually didn't go far enough in fixing > Python2. I'd have frankly preferred delaying it by a few years, to > allow PyPy to come to maturity and serve as the new main Python > implementation, and have that drive the language change

Re: Get subprocess error output from shell command

2011-04-02 Thread Benjamin Kaplan
On Sat, Apr 2, 2011 at 11:07 PM, Gnarlodious wrote: > I'm running a shell command like: > plutil -convert xml1 "~/Library/Preferences/iCab/iCab 4 Bookmarks" > > Getting error: > ~/Library/Preferences/iCab/iCab 4 Bookmarks: Permission denied > > How would I capture this error using a method of subp

Re: Get subprocess error output from shell command

2011-04-02 Thread Benjamin Kaplan
On Sat, Apr 2, 2011 at 11:50 PM, Gnarlodious wrote: > I get it, you instantiate an object, call a method and get a tuple in > response. However, here is what I see: > process.communicate() > (b'~/Library/Preferences/iCab/iCab 4 Bookmarks: Permission denied\n', > b'') > > So all I get is the s

Re: [OT] Free software versus software idea patents

2011-04-07 Thread Benjamin Kaplan
On Thu, Apr 7, 2011 at 11:31 AM, harrismh777 wrote: > Steven D'Aprano wrote: >> >> Let's reword your concern slightly: >> >> >>     It's difficult to take a claim of “free” seriously for >>     technologies (including, but not limited to, HTML, CSS, C++, >>     XML, Public Key Cryptography, packet

Re: Argument of the bool function

2011-04-08 Thread Benjamin Kaplan
On Fri, Apr 8, 2011 at 12:26 PM, candide wrote: > About the standard function bool(), Python's official documentation tells us > the following : > > bool([x]) > Convert a value to a Boolean, using the standard truth testing procedure. > > > In this context, what exactly a "value" is referring to ?

Re: Python program termination and exception catching

2011-04-10 Thread Benjamin Kaplan
On Sun, Apr 10, 2011 at 4:05 PM, Jason Swails wrote: > > > On Sun, Apr 10, 2011 at 12:34 PM, Laszlo Nagy wrote: >> >> 2011.04.10. 21:25 keltezéssel, Jason Swails írta: >> >> Hello everyone, >> >> This may sound like a bit of a strange desire, but I want to change the >> way in which a python prog

Re: installing setuptools on Windows custom python install

2011-04-18 Thread Benjamin Kaplan
On Apr 18, 2011 12:55 PM, "Eric Frederich" wrote: > > Hello, > > I have a python installation that I built myself using Visual Studio 2005. > I need this version because I need to link Python bindings to a 3rd > party library that uses VS 2005. > > I want to get setuptools installed to this Python

Re: [Tutor] working with strings in python3

2011-04-18 Thread Benjamin Kaplan
On Mon, Apr 18, 2011 at 8:58 PM, Westley Martínez wrote: > On Tue, 2011-04-19 at 10:34 +1000, James Mills wrote: >> On Tue, Apr 19, 2011 at 10:17 AM, Rance Hall wrote: >> > pseudo code: >> > >> > >> > message = "Bah." >> > >> > if test: >> >   message = message + " Humbug!" >> > >> > print(messag

Re: A question about Python Classes

2011-04-21 Thread Benjamin Kaplan
On Apr 21, 2011 12:55 PM, "chad" wrote: > > On Apr 21, 9:30 am, Jean-Michel Pichavant > wrote: > > chad wrote: > > > Let's say I have the following > > > > > class BaseHandler: > > > def foo(self): > > > print "Hello" > > > > > class HomeHandler(BaseHandler): > > > pass > > >

Re: Input() in Python3

2011-04-22 Thread Benjamin Kaplan
On Apr 22, 2011 10:12 AM, "Mel" wrote: > > Westley Martínez wrote: > > On Fri, Apr 22, 2011 at 04:49:19PM +1000, Chris Angelico wrote: > > >> U NO. NO NO NO. What if someone enters "os.exit()" as their > >> number? You shouldn't eval() unchecked user input! > >> > >> Chris Angelico > > > >

Re: Function __defaults__

2011-04-24 Thread Benjamin Kaplan
On Sun, Apr 24, 2011 at 5:58 AM, Steven D'Aprano wrote: > Consider this in Python 3.1: > > def f(a=42): > ...     return a > ... f() > 42 f.__defaults__ = (23,) f() > 23 > > > Is this an accident of implementation, or can I trust that changing > function defaults in this fashio

Re: ElementTree XML parsing problem

2011-04-27 Thread Benjamin Kaplan
On Wed, Apr 27, 2011 at 2:26 PM, Mike wrote: > I'm using ElementTree to parse an XML file, but it stops at the second > record (id = 002), which contains a non-standard ascii character, ä. Here's > the XML: > > > > > > > > > > > The complaint offered up by the parser is > > Unexpected erro

Re: Compile 32bit C-lib on 64 bit

2011-05-01 Thread Benjamin Kaplan
On Sun, May 1, 2011 at 4:14 PM, Hegedüs Ervin wrote: > Hello, > > this is not a "clear" Python question - I've wrote a module in C, > which uses a 3rd-party lib - it's a closed source, I just get the > .so, .a and a header file. > > Looks like it works on 32bit (on my desktop), but it must be run

Re: What other languages use the same data model as Python?

2011-05-04 Thread Benjamin Kaplan
On Wed, May 4, 2011 at 12:40 PM, sturlamolden wrote: > > On May 4, 5:40 pm, Michael Torrie wrote: > > > Which is exactly what the code showed.  The first one isn't a mistake. > > You just read it wrong. > > No, I read "call-by-value" but it does not make a copy. Call-by-value > dictates a deep co

Re: What other languages use the same data model as Python?

2011-05-04 Thread Benjamin Kaplan
On Wed, May 4, 2011 at 3:22 PM, harrismh777 wrote: > Hans Georg Schaathun wrote: >> >> It only works by assuming >> knowledge of C, which is language which has proved unsuitable for >> complex and abstract data modelling. > >   That statement is untrue; evidenced by the very fact the CPython's com

Re: PyGTK, Glade/libglade. What am I doing wrong?

2011-05-06 Thread Benjamin Kaplan
On May 6, 2011 7:05 PM, "Даниил Рыжков" wrote: > > Sorry for my English (I could not find help in the Russian community) > I'm trying to learn PyGTK and Glade. I made test window in Glade and > saved it as "test.glade" (attached). Then I wrote script > "test.py"(attached, http://pastebin.com/waKyt

Re: Python3: imports don't see files from same directory?

2011-05-07 Thread Benjamin Kaplan
On Sat, May 7, 2011 at 11:04 PM, John O'Hagan wrote: > On Sat, 7 May 2011, Ian Kelly wrote: > [...] >> >> Implicit relative imports were removed in Python 3 to prevent >> ambiguity as the number of packages grows.  See PEP 328. >> >> If you have two modules in the same package, pack1.mod1 and >> p

Re: Dictionary from String?

2011-05-08 Thread Benjamin Kaplan
On Sun, May 8, 2011 at 8:20 AM, Greg Lindstrom wrote: > Is it possible to create a dictionary from a string value?  Something along > these lines (but that works): > mystring = "{'name':'greg','hatsize':'7 5/8'}" mystring > "{'name':'greg','hatsize':'7 5/8'}" dict(mystring) > Traceb

Re: unicode by default

2011-05-11 Thread Benjamin Kaplan
On Wed, May 11, 2011 at 2:37 PM, harrismh777 wrote: > hi folks, >   I am puzzled by unicode generally, and within the context of python > specifically. For one thing, what do we mean that unicode is used in python > 3.x by default. (I know what default means, I mean, what changed?) > >   I think p

Re: unicode by default

2011-05-11 Thread Benjamin Kaplan
On Wed, May 11, 2011 at 8:44 PM, harrismh777 wrote: > Steven D'Aprano wrote: >>> >>> You need to understand the difference between characters and bytes. >> >> http://www.joelonsoftware.com/articles/Unicode.html >> >> is also a good resource. > > Thanks for being patient guys, here's what I've done

Re: portable multiprocessing code

2011-05-17 Thread Benjamin Kaplan
On Tue, May 17, 2011 at 8:14 AM, Eric Frederich wrote: > I have written some code using Python 2.7 but I'd like these scripts > to be able to run on Red Hat 5's 2.4.3 version of Python which doesn't > have multiprocessing. > I can try to import multiprocessing and set a flag as to whether it is >

[RELEASE] 3.1.4 release candidate 1

2011-05-29 Thread Benjamin Peterson
ed to: http://bugs.python.org Enjoy! -- Benjamin Peterson Release Manager benjamin at python.org (on behalf of the entire python-dev team and 3.1.4's contributors) -- http://mail.python.org/mailman/listinfo/python-list

[RELEASE] Python 2.7.2 release candidate 1

2011-05-29 Thread Benjamin Peterson
major problems, 2.7.2 will be released in two weeks. Please report any bugs you find to http://bugs.python.org/ Enjoy! -- Benjamin Peterson Release Manager benjamin at python.org (on behalf of the entire python-dev team and 2.7.2's contributors) -- http://mail.python.org/mailman/listinfo/python-list

Re: scope of function parameters (take two)

2011-05-30 Thread Benjamin Kaplan
On Mon, May 30, 2011 at 5:28 PM, Henry Olders wrote: > > On 2011-05-29, at 4:30 , Henry Olders wrote: > >> I just spent a considerable amount of time and effort debugging a program. >> The made-up code snippet below illustrates the problem I encountered: >> >> def main(): >>       a = ['a list','

Re: Beginner needs advice

2011-05-30 Thread Benjamin Kaplan
On Mon, May 30, 2011 at 10:20 PM, Dennis Lee Bieber wrote: > On Mon, 30 May 2011 21:34:09 -0400, Terry Reedy > declaimed the following in gmane.comp.python.general: > >> On 5/30/2011 8:32 PM, harrismh777 wrote: >> >> > Ever tried to read Beowulf in the original? Ever tried to write Ænglisc ? >> >

Re: sqlalchemy and Unicode strings: errormessage

2011-05-31 Thread Benjamin Kaplan
On Tue, May 31, 2011 at 8:45 AM, Wolfgang Meiners wrote: > Am 31.05.11 13:32, schrieb Daniel Kluev: >> On Tue, May 31, 2011 at 8:40 AM, Wolfgang Meiners >> wrote: >>> metadata = MetaData('sqlite://') >>> a_table = Table('tf_lehrer', metadata, >>>    Column('id', Integer, primary_key=True), >>>  

[RELEASE] Python 2.7.14

2017-09-16 Thread Benjamin Peterson
ython-2714/ Bugs may be reported at https://bugs.python.org/ Warmly, Benjamin 2.7 release manager (on behalf of all of 2.7's contributors) -- https://mail.python.org/mailman/listinfo/python-list

Re: Automatic Gain Control in Python?

2022-05-29 Thread Benjamin Schollnick
estions/57925304/how-to-normalize-a-raw-audio-file-with-python <https://stackoverflow.com/questions/57925304/how-to-normalize-a-raw-audio-file-with-python> - Benjamin > On May 29, 2022, at 11:04 AM, Steve GS wrote: > >>> From your description, your fundamental pr

Re: Automatic Gain Control in Python?

2022-05-29 Thread Benjamin Schollnick
audio level, and then adjusting the volume out of the Smart Speaker is really doing more than adding complexity. An all analog solution might be the better route, although finding something that is inexpensive might be an issue as well. - Benjamin > On May 29, 2022, at 11:32 AM,

Re: Automatic Gain Control in Python?

2022-05-29 Thread Benjamin Schollnick
it for reference. - Benjamin > On May 29, 2022, at 3:18 PM, Grant Edwards wrote: > > On 2022-05-29, Benjamin Schollnick wrote: > >> Why not just right a 3rd party package to normalize the audio levels >> in the digital file? It’ll be faster, and probably eas

Re: Why isn't there a built-in product()?

2022-07-07 Thread Oscar Benjamin
On Thu, 7 Jul 2022 at 22:55, Michael F. Stemper wrote: > > sum() is wonderful. > > >>> nums = [1,2,3] > >>> sum(nums) > 6 > >>> product(nums) > Traceback (most recent call last): > File "", line 1, in > NameError: name 'product' is not defined > >>> > > I understand that there i

Re: Parallel(?) programming with python

2022-08-08 Thread Oscar Benjamin
On Mon, 8 Aug 2022 at 19:01, Andreas Croci wrote: > > tI would like to write a program, that reads from the network a fixed > amount of bytes and appends them to a list. This should happen once a > second. > > Another part of the program should take the list, as it has been filled > so far, every

Re: Does one have to use curses to read single characters from keyboard?

2022-12-11 Thread Oscar Benjamin
On Sun, 11 Dec 2022 at 15:55, Chris Green wrote: > > Is the only way to read single characters from the keyboard to use > curses.cbreak() or curses.raw()? If so how do I then read characters, > it's not at all obvious from the curses documentation as that seems to > think I'm using a GUI in some

Re: ok, I feel stupid, but there must be a better way than this! (finding name of unique key in dict)

2023-01-20 Thread Oscar Benjamin
On Fri, 20 Jan 2023 at 17:30, Dino wrote: > > let's say I have this list of nested dicts: > > [ >{ "some_key": {'a':1, 'b':2}}, >{ "some_other_key": {'a':3, 'b':4}} > ] > > I need to turn this into: > > [ >{ "value": "some_key", 'a':1, 'b':2}, >{ "value": "some_other_key", 'a':3, '

Re: HTTP server benchmarking/load testing in Python

2023-01-26 Thread Benjamin Schollnick
ling, it’s the OS and CPU protecting themselves from overheating. Usually because the manufacturer didn’t add enough cooling to keep the system cool enough with a continuous load. (Which to be honest, almost no laptop designers do, because they assuming you are going to be having a spiky load instead… - Benjamin -- https://mail.python.org/mailman/listinfo/python-list

Re: Precision Tail-off?

2023-02-14 Thread Oscar Benjamin
On Tue, 14 Feb 2023 at 07:12, Stephen Tucker wrote: > > Hi, > > I have just produced the following log in IDLE (admittedly, in Python > 2.7.10 and, yes I know that it has been superseded). > > It appears to show a precision tail-off as the supplied float gets bigger. > > I have two questions: > 1.

Re: Precision Tail-off?

2023-02-17 Thread Oscar Benjamin
On Fri, 17 Feb 2023 at 10:29, Stephen Tucker wrote: > > Thanks, one and all, for your reponses. > > This is a hugely controversial claim, I know, but I would consider this > behaviour to be a serious deficiency in the IEEE standard. [snip] > > Perhaps this observation should be brought to the atte

Re: Precision Tail-off?

2023-02-17 Thread Oscar Benjamin
On Sat, 18 Feb 2023 at 01:47, Chris Angelico wrote: > > On Sat, 18 Feb 2023 at 12:41, Greg Ewing via Python-list > wrote: > > > > On 18/02/23 7:42 am, Richard Damon wrote: > > > On 2/17/23 5:27 AM, Stephen Tucker wrote: > > >> None of the digits in RootNZZZ's string should be different from the >

Re: Precision Tail-off?

2023-02-18 Thread Oscar Benjamin
On Sat, 18 Feb 2023 at 11:19, Peter J. Holzer wrote: > > On 2023-02-18 03:52:51 +, Oscar Benjamin wrote: > > On Sat, 18 Feb 2023 at 01:47, Chris Angelico wrote: > > > On Sat, 18 Feb 2023 at 12:41, Greg Ewing via Python-list > > > > To avoid it you would need

Re: Python 3.10 Fizzbuzz

2023-02-27 Thread Oscar Benjamin
On Mon, 27 Feb 2023 at 21:06, Ethan Furman wrote: > > On 2/27/23 12:20, rbowman wrote: > > > "By using Black, you agree to cede control over minutiae of hand- > > formatting. In return, Black gives you speed, determinism, and freedom > > from pycodestyle nagging about formatting. You will save

Re: Python 3.10 Fizzbuzz

2023-02-28 Thread Oscar Benjamin
On Tue, 28 Feb 2023 at 20:55, Mats Wichmann wrote: > > On 2/27/23 16:42, Oscar Benjamin wrote: > > On Mon, 27 Feb 2023 at 21:06, Ethan Furman wrote: > >> > >> On 2/27/23 12:20, rbowman wrote: > >> > >> > "By using Black, you agree to ced

Re: Debugging reason for python running unreasonably slow when adding numbers

2023-03-14 Thread Oscar Benjamin
On Tue, 14 Mar 2023 at 16:27, Alexander Nestorov wrote: > > I'm working on an NLP and I got bitten by an unreasonably slow behaviour in > Python while operating with small amounts of numbers. > > I have the following code: > > ```python > import random, time > from functools import reduce > > def

Re: built-in pow() vs. math.pow()

2023-03-30 Thread Oscar Benjamin
On Thu, 30 Mar 2023 at 17:31, Andreas Eisele wrote: > > I sometimes make use of the fact that the built-in pow() function has an > optional third argument for modulo calculation, which is handy when dealing > with tasks from number theory, very large numbers, problems from Project > Euler, etc.

Re: built-in pow() vs. math.pow()

2023-03-31 Thread Oscar Benjamin
On Fri, 31 Mar 2023 at 20:24, Peter J. Holzer wrote: > > On 2023-03-31 07:39:25 +0100, Barry wrote: > > On 30 Mar 2023, at 22:30, Chris Angelico wrote: > > > It's called math.pow. That on its own should be a strong indication > > > that it's designed to work with floats. > > > > So long as you kn

Re: Christoph Gohlke and compiled packages

2023-04-11 Thread Oscar Benjamin
On Tue, 11 Apr 2023 at 12:01, Chris Angelico wrote: > > On Tue, 11 Apr 2023 at 20:15, Jim Schwartz wrote: > > > > What’s the problem now? Is it with python on windows? I use python on > > windows so I’d like to know. Thanks > > > > Python itself is fine, but a lot of third-party packages are h

Re: Christoph Gohlke and compiled packages

2023-04-11 Thread Oscar Benjamin
On Tue, 11 Apr 2023 at 14:55, Mats Wichmann wrote: > > On 4/11/23 06:03, Roel Schroeven wrote: > > Op 11/04/2023 om 12:58 schreef Chris Angelico: > > >> Python itself is fine, but a lot of third-party packages are hard to > >> obtain. So if you need numpy, for instance, or psycopg2, you might > >>

Re: An "adapter", superset of an iterator

2023-05-03 Thread Oscar Benjamin
On Wed, 3 May 2023 at 18:52, Thomas Passin wrote: > > On 5/3/2023 5:45 AM, fedor tryfanau wrote: > > I've been using python as a tool to solve competitive programming problems > > for a while now and I've noticed a feature, python would benefit from > > having. > > Consider "reversed(enumerate(a))

Re: Learning tkinter

2023-05-18 Thread Oscar Benjamin
On Thu, 18 May 2023 at 10:16, Rob Cliffe via Python-list wrote: > > I am trying to learn tkinter. > Several examples on the internet refer to a messagebox class > (tkinter.messagebox). > But: > > Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 > bit (Intel)] on win32 > Typ

Re: txtorcon 23.5.0

2023-05-19 Thread Benjamin Schollnick
ake this as the creative criticism that I am offering it as. - Benjamin > On May 18, 2023, at 9:37 PM, [email protected] wrote: > > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA512 > > I'm happy to announce txtorcon 23.5.0 with the following changes: > >

Re: txtorcon 23.5.0

2023-05-19 Thread Benjamin Schollnick
e the package then it’s worth the couple of sentences or a short paragraph to allow someone that is unfamiliar with the package to be able to see if they should investigate the package. Cryptic names maybe cute, but if they are not descriptive, then they are not really that helpful other than bei

Re: New Python implementation

2021-02-19 Thread Benjamin Schollnick
l LISP programmer. - Benjamin -- https://mail.python.org/mailman/listinfo/python-list

Re: How do I read .csv files

2021-03-16 Thread Benjamin Schollnick
really simplifies the learning process, and gives you a foundation to build upon. - Benjamin > On Mar 16, 2021, at 8:23 AM, Gys wrote: > > On 3/12/21 11:28 AM, Johann Klammer wrote: >> Specifically ones with quoted strings. I'll have whitespace in >> there

Re: .title() - annoying mistake

2021-03-21 Thread Benjamin Schollnick
ce it, and petition that it be moved into the standard library. Since this seems to be bugging you this much, come up with a solution. I suspect the problem you are going to have is that in effect you’ll be creating a multi-language parser, even worse, you may have to add nameparsing into this.

Re: .title() - annoying mistake

2021-03-21 Thread Benjamin Schollnick
eck, how do we prevent it from titlecasing abbreviations? (This is plain text not XML…. If it was XML it would be easy!) - Benjamin -- https://mail.python.org/mailman/listinfo/python-list

Re: .title() - annoying mistake

2021-03-21 Thread Benjamin Schollnick
there is no place in the text string to put metadata that would help assist parsing the string. By definition the text can’t have metadata, since it’s plaintext. - Benjamin -- https://mail.python.org/mailman/listinfo/python-list

Re: .title() - annoying mistake

2021-03-22 Thread Benjamin Schollnick
to upper and lower. Why should python not offer title in light of this? > said, I doubt that .title() would make it into Python today if it weren't > there > already. I'm having fun with this. Ah, so while being a bit serious, I’m reading a bit too much into this. At this point, it’s become an interesting thought experiment for you. Good luck, - Benjamin -- https://mail.python.org/mailman/listinfo/python-list

Re: .title() - annoying mistake

2021-03-22 Thread Benjamin Schollnick
> character can titlecase to two characters, or to a single character > that isn't the same as if you uppercase or lowercase it. See examples > in previous post. Or Kanji, etc. Where a single character can represent more than one in a different unicode standard, as I understand.

Re: .title() - annoying mistake

2021-03-22 Thread Benjamin Schollnick
to keep updating, because you’ll need to document every and all edge-cases, and then need to know when one of those edge cases breaks, etc. The core concept is documented, and it’s pretty straight-forward. I’m sorry, but it’s as if he’s arguing for the sake of arguing. It’s starting to

Re: not able to download PyAudio

2021-04-02 Thread Benjamin Schollnick
pypi.org/> and do a search. - Benjamin -- https://mail.python.org/mailman/listinfo/python-list

Re: neoPython : Fastest Python Implementation: Coming Soon

2021-05-05 Thread Benjamin Schollnick
change, then a freakin’ computer programming language. - Benjamin -- https://mail.python.org/mailman/listinfo/python-list

Re: How Do I Get A Bug In Multiprocessing Fixed?

2021-06-18 Thread Oscar Benjamin
On Fri, 18 Jun 2021 at 15:27, Michael Boom wrote: > The below issue is pretty serious and it is preventing me from using a > system I wrote on a larger scale. How do I get this bug fixed? Thanks. > https://bugs.python.org/issue43329 On Fri, 18 Jun 2021 at 06:07, Alexander Neilson wrote: > >

Re: Optimizing Small Python Code

2021-06-22 Thread Benjamin Schollnick
How would you measure the steps that it takes? - Benjamin > On Jun 22, 2021, at 7:04 PM, Greg Ewing wrote: > > On 23/06/21 3:03 am, Kais Ayadi wrote: >> for n in range(1, 7): >> print (n) >> for x in range(0, n): >> print(" &q

Re: on floating-point numbers

2021-09-03 Thread Oscar Benjamin
On Fri, 3 Sept 2021 at 13:48, Chris Angelico wrote: > > On Fri, Sep 3, 2021 at 10:42 PM jak wrote: > > > > Il 03/09/2021 09:07, Julio Di Egidio ha scritto: > > > On Friday, 3 September 2021 at 01:22:28 UTC+2, Chris Angelico wrote: > > >> On Fri, Sep 3, 2021 at 8:15 AM Dennis Lee Bieber > > >> w

Re: Different "look and feel" of some built-in functions

2021-09-24 Thread Oscar Benjamin
On Sat, 25 Sept 2021 at 00:37, Greg Ewing wrote: > On 25/09/21 10:15 am, Steve Keller wrote: > > BTW, I like how the min() and max() functions allow both ways of being > > called. > > That wouldn't work for set.union and set.intersection, because as > was pointed out, they're actually methods, so

Re: Different "look and feel" of some built-in functions

2021-09-24 Thread Oscar Benjamin
On Sat, 25 Sept 2021 at 02:01, Chris Angelico wrote: > On Sat, Sep 25, 2021 at 10:56 AM Oscar Benjamin > wrote: > > > > On Sat, 25 Sept 2021 at 00:37, Greg Ewing > > wrote: > > > I suppose they could be fiddled somehow to make it possible, but > > &g

Re: Different "look and feel" of some built-in functions

2021-09-25 Thread Oscar Benjamin
On Sat, 25 Sept 2021 at 02:16, Chris Angelico wrote: > On Sat, Sep 25, 2021 at 11:11 AM Oscar Benjamin > wrote: > > > > On Sat, 25 Sept 2021 at 02:01, Chris Angelico wrote: > >> > >> On Sat, Sep 25, 2021 at 10:56 AM Oscar Benjamin > >> wrote: >

Re: Different "look and feel" of some built-in functions

2021-10-02 Thread Oscar Benjamin
On Sat, 25 Sept 2021 at 02:11, Oscar Benjamin wrote: > On Sat, 25 Sept 2021 at 02:01, Chris Angelico wrote: > >> On Sat, Sep 25, 2021 at 10:56 AM Oscar Benjamin >> wrote: >> > >> > On Sat, 25 Sept 2021 at 00:37, Greg Ewing >> > wrote: >> >

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