Re: Choosing a Python IDE. what is your Pythonish recommendation? I do not know what to choose.

2017-01-02 Thread Michael Torrie
On 01/02/2017 04:38 AM, Antonio Caminero Garcia wrote: > The problem with Vim is the learning curve, so I know the very basic > stuff, but obviously not enough for coding and I do not have time to > learn it, it is a pity because there are awesome plugins that turns > Vim into a lightweight

Re: Cleaning up conditionals

2016-12-30 Thread Michael Torrie
On 12/30/2016 05:26 PM, Deborah Swanson wrote: > I'm still wondering if these 4 lines can be collapsed to one or two > lines. If the logic is clearly expressed in the if blocks that you have, I don't see why collapsing an if block into one or two lines would even be desirable. Making a clever

Re: learning and experimenting python.

2016-12-30 Thread Michael Torrie
On 12/30/2016 07:05 PM, Wildman via Python-list wrote: > On Fri, 30 Dec 2016 23:39:43 +, Erik wrote: > >> On 30/12/16 23:34, einstein1...@gmail.com wrote: >>> You are also confusing me. >>> But there mustbe some reason. >>> What happens if your student questions you like this.? >>> And may

Re: learning and experimenting python.

2016-12-30 Thread Michael Torrie
On 12/30/2016 04:26 PM, einstein1...@gmail.com wrote: > That's not the answer. > If you don't have answer, please don't answer like this, because that will > confuse others also. I don't believe anyone will be confused. Clearly there's no answer that you understand, or one that would satisfy

Re: learning and experimenting python.

2016-12-30 Thread Michael Torrie
On 12/30/2016 06:46 PM, eryk sun wrote: > On Fri, Dec 30, 2016 at 7:49 PM, Michael Torrie <torr...@gmail.com> wrote: >> >> Is there a special reason bourne shell uses $ and #? > > To me, "$" is for the [$]tandard shell prompt, and "#" noticeably &

Re: learning and experimenting python.

2016-12-30 Thread Michael Torrie
On 12/30/2016 12:08 PM, einstein1...@gmail.com wrote: > LAN you are right. I am agree with you that it's easy to recognise. > > But look > $ for normal user > # for special user/root > % for other shell For python > And so on... > Why? > Why their developer selected that? > Is there any

Re: python list index - an easy question

2016-12-18 Thread Michael Torrie
On 12/18/2016 09:21 AM, BartC wrote: > On 18/12/2016 10:59, Paul Götze wrote: >> Hi John, >> >> there is a nice short article by E. W. Dijkstra about why it makes sense >> to start numbering at zero (and exclude the upper given bound) while >> slicing a list. Might give a bit of additional

Re: Running python from pty without prompt

2016-12-14 Thread Michael Torrie
On 12/14/2016 09:29 PM, Samuel Williams wrote: > Here are some examples of different languages: > > https://github.com/ioquatix/script-runner/blob/master/examples/python-eot.py Okay so it looks like you're just opening a pipe to a subprocess and feeding it a script and input. So there's no pty

Re: OT - "Soft" ESC key on the new MacBook Pro

2016-12-14 Thread Michael Torrie
On 12/13/2016 09:22 PM, Gregory Ewing wrote: > Paul Rubin wrote: >> First it was the hipster Mac users >> with the Beatnik black berets and turtlenecks, and now this. > > Once you're in the clutches of Apple, there is no Escape. That's so not true! I've escaped dozens of times! ;) --

Re: OT - "Soft" ESC key on the new MacBook Pro

2016-12-13 Thread Michael Torrie
On 12/13/2016 06:06 PM, Skip Montanaro wrote: > So, for those of you who've tried it, does the lack of a physical ESC key > create problems? If there were problems with it I imagine ViM users would probably be more inconvenienced than Emacs users. I haven't heard anything about people's

Re: Running python from pty without prompt

2016-12-13 Thread Michael Torrie
On 12/13/2016 05:10 PM, Steve D'Aprano wrote: > Can you show a simple demonstration of what you are doing? I think they want to run Python, perhaps remotely via ssh, and feed it both a script and input over standard-in (though a tty comes into this somehow and I'm not clear on that). Apparently

Re: Running python from pty without prompt

2016-12-13 Thread Michael Torrie
On 12/13/2016 10:48 AM, Random832 wrote: > The problem is there's currently no way to differentiate "interactive > mode" from "script run on a tty". > > You can get similar behavior with python -c "import > sys;exec(sys.stdin.read())" Are you sure? I can pipe scripts into Python and they run

Re: Running python from pty without prompt

2016-12-13 Thread Michael Torrie
On 12/13/2016 09:01 AM, Michael Torrie wrote: > On 12/13/2016 05:39 AM, Samuel Williams wrote: >> Michael, yes. >> >> FYI, I found out why this works. Pressing Ctrl-D flushes the input >> buffer. If you do this on an empty line, it causes read(...) to return >> 0

Re: Running python from pty without prompt

2016-12-13 Thread Michael Torrie
On 12/13/2016 05:39 AM, Samuel Williams wrote: > Michael, yes. > > FYI, I found out why this works. Pressing Ctrl-D flushes the input > buffer. If you do this on an empty line, it causes read(...) to return > 0 which Ruby considers end of input for the script, but the pipe is > not closed.

Re: Running python from pty without prompt

2016-12-09 Thread Michael Torrie
On 12/09/2016 06:43 PM, Steve D'Aprano wrote: > On Sat, 10 Dec 2016 10:11 am, space.ship.travel...@gmail.com wrote: > >> Hello. >> >> I'm working on a script runner for Atom. >> >> https://github.com/ioquatix/script-runner >> >> We are trying to understand how to make python work well. I'll use a

Re: Running python from pty without prompt

2016-12-09 Thread Michael Torrie
On 12/09/2016 04:11 PM, space.ship.travel...@gmail.com wrote: > When you invoke `ruby` from a pty, you get no output (as opposed to > `irb`, interactive ruby [shell]). You can write a script to stdin, > and send Ctrl-D (EOT / 0x04). Then, ruby will execute the script. > stdin is not closed so

Re: Running python from pty without prompt

2016-12-09 Thread Michael Torrie
On 12/09/2016 04:11 PM, space.ship.travel...@gmail.com wrote: > Hello. > > I'm working on a script runner for Atom. > > https://github.com/ioquatix/script-runner > > We are trying to understand how to make python work well. I'll use a > comparison to the ruby executable because it's convenient

Re: MacOSX SpeechRecognition installation problems

2016-12-08 Thread Michael Torrie
On 12/08/2016 05:22 PM, 3dB wrote: >> pip install --user virtualenv >> >> It will wind up in $HOME/.local/lib/python2.7/site-packages (or similar) I >> believe. > > Skip, thanks, that worked for virtualenv. > > I'll now try sudo for Speechrecognition. You should be able to install speach

Re: MacOSX SpeechRecognition installation problems

2016-12-08 Thread Michael Torrie
On 12/08/2016 05:19 PM, 3dB wrote: >>> pip install --user virtualenv >>> >>> It will wind up in $HOME/.local/lib/python2.7/site-packages (or >>> similar) I believe. > > Michael, Skip, > > I've noticed that Python is in the highest level of the drive, > HDD/Library/Python as opposed to

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-08 Thread Michael Torrie
On 12/08/2016 04:19 PM, BartC wrote: > What were we talking about again? Oh yes, belittling me because I work > with Windows! Yes it's kind of getting that way, which means this conversation is at an end. I don't think Chris or Steven or anyone else who has gone round and round with you has

Re: Linux terminals vs Windows consoles - was Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-08 Thread Michael Torrie
On 12/08/2016 02:46 PM, Gregory Ewing wrote: > Michael Torrie wrote: >> For example, on Macs, >> control-key is not normally used, but rather the Command-key (the apple >> key) which happens to be where the Alt key is on our PC keyboards. > > Actually, Alt is usuall

Re: MacOSX SpeechRecognition installation problems

2016-12-08 Thread Michael Torrie
On 12/08/2016 02:27 PM, Skip Montanaro wrote: > Sorry, I haven't been following this thread carefully. Michael's use of > "sudo" caught my eye though. I know virtualenv might be "special", but > shouldn't this work? > > pip install --user virtualenv > > It will wind up in

Re: MacOSX SpeechRecognition installation problems

2016-12-08 Thread Michael Torrie
On 12/08/2016 01:48 PM, 3dB wrote: > Michael, > > I tried installing virtual env but got similar permissions error: > > IOError: [Errno 13] Permission denied: > '/Library/Python/2.7/site-packages/virtualenv.py' Just to get virtual environment support you definitely have to install this

Re: MacOSX SpeechRecognition installation problems

2016-12-08 Thread Michael Torrie
On 12/08/2016 01:26 PM, 3dB wrote: > Thanks Michael, > > I think I was confusing Virtual Environment (VE) with IDE. > > Probably best if I get to grips with virtualenv to start with since I > can't complete installations at present and VE appears to offer best > solution. Despite Anton's

Re: MacOSX SpeechRecognition installation problems

2016-12-08 Thread Michael Torrie
On 12/08/2016 11:23 AM, 3dB wrote: > Anton, Thanks for the detailed response. I will look into virtualenv > and others. Please excuse beginner's question, but is Xcode of any > use in this type of situation? Not directly, but it does provide a C compiler, which some Python modules require when

Re: Linux terminals vs Windows consoles - was Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-08 Thread Michael Torrie
On 12/08/2016 10:05 AM, Grant Edwards wrote: > Or various other terminal emulators tha are mostly ANSI and Unicode > aware... > > And the Linux console... True. > > It's interesting to note that the "real" xterm terminal emulator will > still emulate a Tektronix storage-scope graphics terminal

Re: PonyORM: generators as a query syntax

2016-12-08 Thread Michael Torrie
On 12/08/2016 07:26 AM, Alex Kaye wrote: > Can you describe some uses or example for using ORM for a Newbie ? Simply put, ORM is a method for making objects that represent records in a database. It's usually done in such a way that the objects are "live." In other words if the object has an

Re: Linux terminals vs Windows consoles - was Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-08 Thread Michael Torrie
On 12/08/2016 09:35 AM, Michael Torrie wrote: > Yes Control codes are, well control codes. Any ascii value under 32. > They are more or less common across terminal types. I don't know of any > way around that with terminals. That is to say that on all terminal types that I'm aware of,

Linux terminals vs Windows consoles - was Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-08 Thread Michael Torrie
On 12/08/2016 05:43 AM, BartC wrote: > (Neither will see Shift+Ctrl+B, which means go to start of the file, > same as Ctrl+Home. Ubuntu sees Ctrl+Home, but not Debian, although it > will report Alt+Home. And some laptop keyboards already have Home on an > Alternate-Function shift! It's a mess.)

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread Michael Torrie
On 12/07/2016 11:26 PM, Gregory Ewing wrote: > BartC wrote: >> println dirlist(cmdparams[2])# Windows >> println tail(cmdparams) # Linux > > I'm not familiar with your language, so I'll reply > in Python. If you write it like this: > > for arg in sys.argv[1:]: >

Re: MacOSX SpeechRecognition installation problems

2016-12-07 Thread Michael Torrie
On 12/07/2016 11:09 PM, 3dB wrote: > trying to install SpeechRecognition for Python results in error: > > running install_lib > creating /Library/Python/2.7/site-packages/speech_recognition > error: could not create > '/Library/Python/2.7/site-packages/speech_recognition': Permission

PonyORM: generators as a query syntax

2016-12-07 Thread Michael Torrie
I was just made aware of a very interesting ORM project that has been around since about 2013, while listening to a recent episode of the Talk Python To Me podcast. The idea of using generators to build queries is really cool. I'm sure PonyORM has its limitations and drawbacks, as all ORM models

Re: calling a program from Python batch file

2016-12-07 Thread Michael Torrie
On 12/07/2016 10:59 AM, John Gordon wrote: > In Karim Farokhnia > writes: > >> Hi there, > >> I am writing a batch file in Python. The batch file, in part, calls a >> program named "oq-console.bat" to run. Then

Re: calling a program from Python batch file

2016-12-07 Thread Michael Torrie
On 12/07/2016 10:43 AM, Karim Farokhnia wrote: >> Is the program that oq-console.bat runs interactive? After it >> launches into its own console window it asks for more input? > The program doesn't ask for more input parameters as all parameters > are in input files and the program will

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread Michael Torrie
On 12/07/2016 07:57 AM, BartC wrote: > I don't follow you. "?" is problematical on both systems. I think > Windows disallows it completely: I get 'Protocol error' if I copy such a > file from Linux to Windows. Presumably there is an escaping system, but > I don't know what it is. As Chris

Re: calling a program from Python batch file

2016-12-07 Thread Michael Torrie
On 12/07/2016 09:38 AM, Karim Farokhnia wrote: > I am writing a batch file in Python. The batch file, in part, calls a > program named "oq-console.bat" to run. Then once the program comes up > (it looks like windows CMD), I need the batch file to type some > commands to make it run (just like I

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread Michael Torrie
On 12/07/2016 08:48 AM, BartC wrote: > I would prefer that the program "t" can be invoked exactly the same way > under both systems. I don't want different instructions for Linux, or > for the user (of my language) to have to write two lots of code, as that > is my job... Ahh now we come to

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread Michael Torrie
On 12/07/2016 07:58 AM, Marko Rauhamaa wrote: > Steve D'Aprano : > >> I don't know any Unix programs that provide file spec processing. >> (That's not to say that there are absolutely none, only that I don't >> know of any.) > > I can think of "find", "git" and "scp".

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread Michael Torrie
On 12/06/2016 04:37 PM, BartC wrote: > How does that work? > > Suppose I provide an assortment of applications that would work better > if wildcards are expanded. > > Do I then have to provide one more application, a shell, to be run first > if someone wants to run any of my applications?

Re: Detect Linux Runlevel

2016-12-06 Thread Michael Torrie
On 12/06/2016 03:29 PM, Marko Rauhamaa wrote: > Another thing is that, as stated before, the runlevel business is > legacy. It is still supported by systemd-update-utmp, but for how long > is anybody's guess. System V compatibility is still important to Linux, and as long as it is, something

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread Michael Torrie
On 12/06/2016 03:35 PM, Nathan Ernst wrote: > One other consideration in regards to globbing in the argument list: > there's a static limit to the byte length of argv. On windows, it's 8191 > bytes (I'm assuming a null-terminator brings that to 8192, which is a weird > 2**13). For Linux, as of

Re: Detect Linux Runlevel

2016-12-06 Thread Michael Torrie
On 12/06/2016 09:18 AM, Wildman via Python-list wrote: > It is sad that you consider learning something new to > be worthless. I used the term "worthlessware" in an > economical sense, meaning it has little or no commercial > value. However, from a learning standpoint I consider > it to be

Re: Detect Linux Runlevel

2016-12-06 Thread Michael Torrie
On 12/06/2016 06:51 AM, Tim Chase wrote: > Based on the OP's description, this is a small part of a much larger > program. And I would personally rather maintain a large Python > code-base than a large Bash code-base. Absolutely. Especially when you consider inxi is 12,000 lines of bash code in

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread Michael Torrie
On 12/06/2016 06:52 AM, BartC wrote: > But those would be silly. But why? > Some special syntax is known about: | < and > for example. % less so > (I've never, ever used it in live input AFAIK). Yup and why would you think the ? * special syntax is not known about or should be known about?

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread Michael Torrie
On 12/06/2016 04:43 AM, BartC wrote: >> Read the Python documentation for argparse > > I just tried it, but it was too complex for me to set it up so as to > discover with it did with * arguments. > >> Again, start with argparse... Any command line argument that is left >> after it

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread Michael Torrie
On 12/05/2016 07:25 PM, Dennis Lee Bieber wrote: > On Mon, 5 Dec 2016 20:55:41 +, BartC declaimed > the following: > >> This was a response to someone saying the wildcard param needs to >> be at the end. There need be no such restriction if handled >> properly (ie. no

Re: Detect Linux Runlevel

2016-12-05 Thread Michael Torrie
On 12/05/2016 08:27 PM, Wildman via Python-list wrote: > On Mon, 05 Dec 2016 18:25:58 -0700, Michael Torrie wrote: > >> I think Python is a good choice for such a utility, but I agree it is >> much better to rely on these external utilities as children to do the >> platfor

Re: Detect Linux Runlevel

2016-12-05 Thread Michael Torrie
On 12/05/2016 07:48 PM, Steve D'Aprano wrote: > On Tue, 6 Dec 2016 11:08 am, Michael Torrie wrote about systemd: > >> I have yet to see any evidence of this Pyonguang situation. > > Let me guess... you're running a single-user Linux box? No I've done it on servers that weren't

Re: Detect Linux Runlevel

2016-12-05 Thread Michael Torrie
On 12/05/2016 05:14 PM, Bernd Nawothnig wrote: > On 2016-12-05, Wildman wrote: >> And I am trying to write it without using external programs, where >> possible. > > That is not the Unix way. > >> I am a hobby programmer and I've been trying to learn python >> for a few months now. The program

Re: Detect Linux Runlevel

2016-12-05 Thread Michael Torrie
On 12/05/2016 04:37 PM, Marko Rauhamaa wrote: > Unfortunately, I am not wholly impressed by the end result. Mogadishu > has been replaced by Pyongyang. Some age-old Unix principles have been > abandoned without clear justification. For example, I was appalled to > find out that a systemd unit can

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread Michael Torrie
On 12/05/2016 04:38 PM, Marko Rauhamaa wrote: > Michael Torrie <torr...@gmail.com>: >> As I've gotten older I've learned the truth of this quotation: >> "Those who do not understand UNIX are condemned to reinvent it, poorly." >> -- Henry Spencer > > I t

Re: Detect Linux Runlevel

2016-12-05 Thread Michael Torrie
On 12/05/2016 03:29 PM, Marko Rauhamaa wrote: > Chris Angelico : > >> On Tue, Dec 6, 2016 at 8:38 AM, Lew Pitcher >> wrote: >>> The OP asked for the runlevel, not the systemd target. >> >> Runlevels don't exist in systemd. And systemd targets

Re: Detect Linux Runlevel

2016-12-05 Thread Michael Torrie
On 12/05/2016 03:34 PM, Wildman via Python-list wrote: > Too bad I don't speak C. I am an amateur programmer and most or all > my experience has been with assembly and various flavors of BASIC, > including VB and PowerBASIC. I did look over the code but I guess > I'm just a rebel without a clue.

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread Michael Torrie
On 12/05/2016 01:35 PM, BartC wrote: >>> It seems shell language authors have nothing better to do than adding >>> extra quirky features that sooner or later are going to bite somebody >>> on the arse. Mainly I need a shell to help launch a program and give it >>> some basic input; that's all. >>

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread Michael Torrie
On 12/05/2016 01:09 PM, Random832 wrote: > The rules are simpler than you're probably thinking of. There's actually > no relationship between globs on the left and on the right. Globs on the > left simply select the files to rename as normal, the glob pattern > doesn't inform the renaming

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread Michael Torrie
Bored to day since it's -20 and I don't want to work outside. On 12/05/2016 12:24 PM, BartC wrote: >> If it sees "*", it will try to open a file named "*". > > And people still say that the way Windows works is crazy! > > That's a valid >> filename in Unix, but it should be avoided. > > No,

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread Michael Torrie
On 12/05/2016 11:50 AM, BartC wrote: > It doesn't matter, and is not the concern of the shell. It should > restrict itself to the basic parsing that may be necessary when > parameters are separated by white-space and commas, if a parameter can > contain white-space or commas. That usually

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread Michael Torrie
On 12/05/2016 11:21 AM, Chris Angelico wrote: > On Tue, Dec 6, 2016 at 5:02 AM, BartC wrote: >> If the syntax is: >> >> program filespec >> >> or: >> >> program filespec file >> >> how do you tell whether the last file in an argument list is the optional >> 'file', or the

Re: correct way to catch exception with Python 'with' statement

2016-12-02 Thread Michael Torrie
On 12/01/2016 08:39 PM, Ned Batchelder wrote: > On Thursday, December 1, 2016 at 7:26:18 PM UTC-5, DFS wrote: >> How is it possible that the 'if' portion runs, then 44/100,000ths of a >> second later my process yields to another process which deletes the >> file, then my process continues. > >

Re: Simple Python equivalent for the shell command

2016-11-28 Thread Michael Torrie
On 11/28/2016 08:55 AM, Michael Torrie wrote: > Well Bash is really good at some things. Piping commands together is > one of those things. Python can do such things but not in as compact a > way. For one Python has no quick way of interfacing with subprograms as > if they were la

Re: correct way to catch exception with Python 'with' statement

2016-11-28 Thread Michael Torrie
On 11/28/2016 08:18 AM, Ganesh Pal wrote: > On Mon, Nov 28, 2016 at 1:16 PM, Steven D'Aprano < > steve+comp.lang.pyt...@pearwood.info> wrote: > >> >> >> There is no need to return True. The function either succeeds, or it >> raises an >> exception, so there is no need to return any value at all.

Re: Simple Python equivalent for the shell command

2016-11-28 Thread Michael Torrie
On 11/28/2016 08:08 AM, Ganesh Pal wrote: > I was trying to write a function that will return me the unique number > associated with each employee id.The command has the output in the below > pattern > > Linux-Box-1# employee_details ls > List of names: > 100910bd9 s7018 > 100d60003 s7019 >

Re: The Case Against Python 3

2016-11-26 Thread Michael Torrie
On 11/26/2016 06:26 PM, Nathan Ernst wrote: > Sure, what if the input used a double quote instead of single, cursory > glance looks like it might vulnerable. Either a single quote or a double quote would not pass the sanitizer. Or am I misunderstanding you? --

Re: NameError

2016-11-24 Thread Michael Torrie
As alister said, please do not just hit reply and type your message at the top. Instead, place your reply below the quoted text you are replying too. This is not hard. I realize there's a language barrier, but please patiently read what alister said and understand what he's saying. I know

Re: Reposting On Python-List PROHIBITED

2016-11-23 Thread Michael Torrie
On 11/23/2016 04:31 PM, mm0fmf wrote: > On 23/11/2016 23:28, Lawrence D’Oliveiro wrote: >> Therefore, to see you take offence at something I said, and use >> that as an excuse to “ban” me from your list, is an act of >> breathtaking hypocrisy. As far as I am concerned, it is you lot who >> should

Re: Couldn't load SIP module.

2016-11-19 Thread Michael Torrie
On 11/19/2016 01:44 PM, Xristos Xristoou wrote: > hello > i using python 2.7.12 on ubuntu 16.04 and i have that error with SIP : > > Couldn't load SIP module. > > > Traceback (most recent call last): > File "", line 1, in > ImportError: /usr/local/lib/python2.7/site-packages/sip.so:

Re: help on "from deen import *" vs. "import deen"

2016-11-19 Thread Michael Torrie
On 11/19/2016 08:46 AM, Steve D'Aprano wrote: > I think you're being harsh on J Fong. And for what it is worth, I think that > I (slightly) agree with him: in my experience, many people have difficulty > understanding object model at first, especially if they've come from a > background of named

Re: help on "from deen import *" vs. "import deen"

2016-11-17 Thread Michael Torrie
On 11/17/2016 08:41 PM, jf...@ms4.hinet.net wrote: > The fact that most novices will stumble on Python variable many times > until it becomes his "second nature" proves it's different from the > human language:-) The fact is that most novices don't stumble when dealing with Python variables. The

Re: help on "from deen import *" vs. "import deen"

2016-11-17 Thread Michael Torrie
On 11/17/2016 07:23 PM, jf...@ms4.hinet.net wrote: >> Python's variables are different from other languages, but in an >> understandable way. > > Unfortunately it's also different from human language. How so? I don't find this to be true at all. --

Re: help on "from deen import *" vs. "import deen"

2016-11-17 Thread Michael Torrie
On 11/16/2016 07:01 PM, jf...@ms4.hinet.net wrote: > Michael Torrie at 2016/11/16 11:15:11AM wrote: >> ... The globals object is a dictionary and is itself mutable. But >> when we assign a new object to a particular dictionary key, it >> tosses out the old reference and ma

Re: PyQt pass data from class

2016-11-16 Thread Michael Torrie
On 11/16/2016 12:47 AM, luca72 via Python-list wrote: > Thanks for your reply > > Is the latter, can you explain how i can do it. Just add an argument to __init__() of the one class where you will pass the instance of the other class to it. Then you can store it inside the instance, and use it

Re: help on "from deen import *" vs. "import deen"

2016-11-15 Thread Michael Torrie
On 11/15/2016 07:39 PM, jf...@ms4.hinet.net wrote: > Michael Torrie at 2016/11/15 10:43:58PM wrote: >> Seems like you're still not understanding Python variables. > > I do, just not get used to it yet:-) No you don't yet. See below. > Why? the name "tblm" is alread

Re: PyQt pass data from class

2016-11-15 Thread Michael Torrie
On 11/15/2016 10:01 AM, luca72 via Python-list wrote: > in wich way i can have access to the lineedit of class Form without event > from class Cornice If I understand you, you are asking how to set the text without having it emit a signal. Is that correct? Or are you asking how to access the

Re: help on "from deen import *" vs. "import deen"

2016-11-15 Thread Michael Torrie
On 11/14/2016 11:32 PM, jf...@ms4.hinet.net wrote: > But obviously it's not. The compiled code of function gpa is still > reference to a hidden deen.tblm 'global' object which I can't access > anymore. A bad news:-( Seems like you're still not understanding Python variables. After importing all

Re: Best way to go about embedding python

2016-11-13 Thread Michael Torrie
On 11/13/2016 08:40 PM, Kaylen Wheeler wrote: > I wonder if Lua would be a better option. Does it suffer from the > same sandboxing issues that python does? Lua was designed for this sort of thing and it can be secured and sandboxed. -- https://mail.python.org/mailman/listinfo/python-list

Re: Best way to go about embedding python

2016-11-13 Thread Michael Torrie
On 11/13/2016 12:10 AM, kfjwhee...@gmail.com wrote: > 2. How would I go about including python scripts to run with the > engine. Would the .py files from the standard libraries be > necessary, or is anything built in? It's usually just a matter of asking the python instance to load and run the

Re: I want to insert beacon scan result in to a database using python and mysql

2016-11-10 Thread Michael Torrie
On 11/10/2016 06:10 PM, Dennis Lee Bieber wrote: > {I could swear I'd included an example of a parameterized query in my > response... I didn't want to go into the details of "SQL injection attack" > as, based on the rest of the OPs post, it would have needed a large > explanation... And the

Re: I want to insert beacon scan result in to a database using python and mysql

2016-11-10 Thread Michael Torrie
On 11/10/2016 11:32 AM, Chris Angelico wrote: > The easiest way is to use a parameterized query: > > cur.execute("insert into beacon VALUES(null, %s)", (beacon,)) > > I don't understand why so many people conflate parameterized with > prepared. "Prepared statements" have a two-step execution. >

Re: I want to insert beacon scan result in to a database using python and mysql

2016-11-10 Thread Michael Torrie
On 11/10/2016 06:15 AM, Dennis Lee Bieber wrote: > On Wed, 9 Nov 2016 21:05:50 -0800 (PST), sudeeratechn...@gmail.com > declaimed the following: > >> >> sql = "insert into beacon VALUES(null, '%s')" % \ >> (beacon) >> > DON'T DO THAT... Wouldn't hurt to include a brief why on this, and the

Re: Python rules!

2016-11-09 Thread Michael Torrie
On 11/09/2016 05:54 PM, Chris Angelico wrote: > On Thu, Nov 10, 2016 at 11:42 AM, Michael Torrie <torr...@gmail.com> wrote: >> On 11/09/2016 12:39 PM, jlada...@itu.edu wrote: >>> On Wednesday, November 9, 2016 at 4:32:15 AM UTC-8, Rustom Mody wrote: >>>> h

Re: Python rules!

2016-11-09 Thread Michael Torrie
On 11/09/2016 12:39 PM, jlada...@itu.edu wrote: > On Wednesday, November 9, 2016 at 4:32:15 AM UTC-8, Rustom Mody wrote: >> https://twitter.com/UdellGames/status/788690145822306304 > > It took me a minute to see it. That's insane! Yeah it is... however Java actually looks pretty nice without

Re: [Theory] How to speed up python code execution / pypy vs GPU

2016-11-09 Thread Michael Torrie
On 11/09/2016 02:10 PM, BartC wrote: > Good point, I use Ubuntu under Windows. It should be child's play, > except... 'sudo apt-get install numpy' or 'python-numpy' doesn't work. Something is wrong with your setup then. Because both python-numpy and python3-numpy are in the standard ubuntu

Re: Help me cythonize a python routine!

2016-11-09 Thread Michael Torrie
On 11/09/2016 04:21 PM, Ethan Furman wrote: >> On 09/11/2016 21:25, breamore...@gmail.com wrote: > > [...filtered...] > > Mark, you do not need to be insulting nor condescending. Agreed. Is he still being filtered on the mailing list? He's still in my killfile. --

Re: [Theory] How to speed up python code execution / pypy vs GPU

2016-11-07 Thread Michael Torrie
On 11/05/2016 11:10 AM, Mr. Wrobel wrote: > Hi, > > Some skeptics asked my why there is a reason to use Python against of > any other "not interpreted" languages, like objective-C. As my > explanation, I have answered that there is a a lot of useful APIs, > language is modern, has advanced

Re: pip3 : command not found

2016-11-06 Thread Michael Torrie
On 11/05/2016 11:27 PM, Jon Ribbens wrote: >> 2) If Python notices that its executable comes from a venv, it uses it. > > Yes. My question is *how does it notice*? I'm guessing that it notices by examining the path it was launched from and looks for virtual environment files relative to that

Re: Announcement: PythonQL - An integrated query language for Python

2016-11-01 Thread Michael Torrie
On 11/01/2016 12:46 PM, Pavel Velikhov wrote: > Thanks for the feedback, will try to make the examples easier to find, > definitely! > Not too happy with the site layout myself... Was it obvious that you can play > around > with the examples - i.e. edit them and run modified versions? After I

Re: Announcement: PythonQL - An integrated query language for Python

2016-11-01 Thread Michael Torrie
On 11/01/2016 02:56 AM, Pavel Velikhov wrote: > Hi Folks, > > We have released PythonQL, a query language extension to Python (we > have extended Python’s comprehensions with a full-fledged query > language, drawing from the useful features of SQL, XQuery and > JSONiq). Take a look at the project

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-29 Thread Michael Torrie
On 10/29/2016 06:16 PM, BartC wrote: > An editor is either line-oriented or it isn't. Free-flowing English text > usually isn't, but most program code is. And a line-oriented editor > should have hard stops at the line ends. (IMO which apparently isn't > shared by anyone else on the planet.)

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-28 Thread Michael Torrie
On 10/28/2016 06:28 AM, Chris Angelico wrote: > On Fri, Oct 28, 2016 at 11:12 PM, Terry Reedy wrote: >> The only specification he has given is reference to the BASIC INKEY$ >> variable. I don't know how consistent this was across different BASICs. I >> looked in Microsoft's

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-27 Thread Michael Torrie
On 10/27/2016 04:07 AM, Terry Reedy wrote: > As I and others have said, those keyboard functions are not available on > text terminals. I predict that keyboard functions that so not work on > all systems will never become built-ins. But some are available with an > import. Sure you can't get

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Michael Torrie
On 10/25/2016 10:22 AM, Steve D'Aprano wrote: > So how would you do non-blocking keyboard input? How would it work? What > would be the interface? Curses must allow you to do this because I've seen text-mode games made in curses and you could do things with arrow keys, etc, all while ascii

Re: Obtain javascript result

2016-10-21 Thread Michael Torrie
On 10/21/2016 07:29 AM, epro...@gmail.com wrote: > Hello NG. > > I'm new in Python for fun. > > I have a html page (I load it by BeautifulSoap) that contain > also this javascript code: > ... > > $(document).ready(function() { > matchdetails_init('rLu2Xsdi', '1x2'); > }); > > ... >

Re: dll files missings ....how to solve this problem

2016-10-21 Thread Michael Torrie
On 10/21/2016 09:00 AM, mohammed iqtefan wrote: > hi > > i installed python 3.5.2 but i coudln't run it because i always have > this msg > > api-ms-win-crt-conio-l1-1-0.dll is missing > > and its not the only dll file that missing there is dozens more The api-ms-win-crt-conio dll is part of

Re: [FAQ] "Best" GUI toolkit for python

2016-10-19 Thread Michael Torrie
On 10/19/2016 01:13 PM, Demosthenes Koptsis wrote: > Did you suggest PySide than PyQt...? Only that I'm using it right now, but I'm making sure my code will run with PyQt. I don't see a huge benefit of PySide except for the source code license (LGPL so you can use it without fee in a proprietary

Re: [FAQ] "Best" GUI toolkit for python

2016-10-19 Thread Michael Torrie
On 10/19/2016 12:18 PM, Demosthenes Koptsis wrote: > I thought PyQt was supported by Qt company... I don't think so. PyQt is a commercial product of Riverbank Computing. It's dual-licensed under the GPL and a proprietary license you can buy. Riverbank may have had a relationship with Trolltech

Re: [FAQ] "Best" GUI toolkit for python

2016-10-18 Thread Michael Torrie
On 10/18/2016 03:23 PM, pozz wrote: > Il 18/10/2016 18:41, Demosthenes Koptsis ha scritto: > > My favorite GUIs are PyQt and wxPython. > > > > I prefer PyQt than PySide because PySide seem to me like an abandoned > > project. > > > > Also i prefer PyQt than wxPython because i can design the

Re: [FAQ] "Best" GUI toolkit for python

2016-10-18 Thread Michael Torrie
On 10/18/2016 10:01 AM, pozz wrote: > What are the differences between PySides and PyQt... apart the licence? > Is PySides usable as PyQt? PySide aims to be pretty close to PyQt. Both of them wrap the C++ api, so class names and method calls should be identical. There are some differences

Re: [FAQ] "Best" GUI toolkit for python

2016-10-18 Thread Michael Torrie
On 10/18/2016 01:16 AM, pozz wrote: >> I am also learning Python so my experience is limited. I have >> tried pyGTK and Tkinter. GTK's concept of the hbox and vbox >> gave me of difficulty. I couldn't get the GUI to look the way >> I wanted. > > Yes, it's exactly my situation. I understand

Re: [FAQ] "Best" GUI toolkit for python

2016-10-18 Thread Michael Torrie
On 10/18/2016 02:33 AM, Mark Summerfield wrote: > When I started out I used Qt Designer to produce .ui files (XML) and > then used the Qt uic tool to convert this to C++ (although you can > convert to Python using pyuic). I then studied the code and learnt > from that. And it turns out that it

Re: Help me!, I would like to find split where the split sums are close to each other?

2016-10-16 Thread Michael Torrie
On 10/16/2016 05:25 AM, k.adema...@gmail.com wrote: > Help me!, I would like to find split where the split sums are close > to each other? > > I have a list is > > test = [10,20,30,40,50,60,70,80,90,100] > > ​and I would like to find split where the split sums are close to > each other by

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