Re: error of opening Python

2023-09-26 Thread Chris Roy-Smith via Python-list
On 26/9/23 22:27, Abdelkhelk ashref salay eabakh via Python-list wrote: Dear Python team, This is my not first time using Python, I tried to launch Python and it showed I'm no expert but "Python 3.11.3 (tags/v3.11.3:f3909b8, Apr 4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)] on win surel

Re: NoneType List

2022-12-31 Thread Chris Roy-Smith
On 31/12/22 16:45, Goran Ikac wrote: Happy New Year, everybody! I'm new in the Python List, new in Python world, and new in coding. A few days (weeks?) ago, I faced a problem trying to write a program for an exercise. I asked for help and nobody answered. In the meantime, I found a part of the so

Re: Python program to phone?

2019-02-04 Thread Chris Roy-Smith
" NOT "reply" Sorry I can't help you on your initial problem Regards, Chris Roy-Smith -- https://mail.python.org/mailman/listinfo/python-list

Re: What's with all of the Case Solution and Test Bank nonsense posts?

2017-07-09 Thread Chris Roy-Smith
On Sun, 09 Jul 2017 21:47:58 -0500, John Black wrote: > In article <477bde19-0653-4e41-a717-0efe90ac5...@googlegroups.com>, > timetowal...@gmail.com says... >> >> I use https://groups.google.com/forum/#!forum/comp.lang.python to look >> over message posts. >> >> What's with all of the Case Solut

Re: textwrap.wrap() breaks non-breaking spaces

2015-05-21 Thread Roy Smith
In article , Johannes Bauer wrote: > so that textwrap.wrap() breks non-breaking spaces, is this a bug or > intended behavior? I opened http://bugs.python.org/issue16623 on this a couple of years ago. Looks like it was being worked (http://bugs.python.org/issue20491) but got stalled in the te

Re: Deep comparison of dicts - cmp() versus ==?

2015-03-20 Thread Roy Smith
In article <550bbfc1$0$13010$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > I cannot remember the details, and I don't have my copy of the Apple > Standard Numerics manual here to look it up Amongst the details you don't remember is the correct name :-) It was Standard Apple N

Re: Python 2 to 3 conversion - embrace the pain

2015-03-15 Thread Roy Smith
In article , Mario Figueiredo wrote: > What makes you think your anedoctal bugs constitute any sort of > evidence this programming language isn't ready to be used by the > public? There's several levels of "ready". I'm sure the core language is more than ready for production use for a project

Re: HELP!! How to ask a girl out with a simple witty Python code??

2015-03-04 Thread Roy Smith
In article <8c09473e-92df-40ac-b083-d2b3a2b75...@googlegroups.com>, Xrrific wrote: > Guys, please Help!!! > > I am trying to impress a girl who is learning python and want ask her out at > the same time. > > Could you please come up with something witty incorporating a simple python > line l

Re: Python Worst Practices

2015-03-01 Thread Roy Smith
In article , Gregory Ewing wrote: > But in documentation, in contexts where it's not critical, > I'm more likely to use the spelling I'm most familiar > with, which is "colour". I can't imagine any English > speaker, native or otherwise, being unable to cope with > that. What abut people who ca

Re: Bug in timsort!?

2015-02-25 Thread Roy Smith
In article , Sturla Molden wrote: > On 24/02/15 22:34, Roy Smith wrote: > > http://envisage-project.eu/proving-android-java-and-python-sorting-algorithm > > -is-broken-and-how-to-fix-it/ > > > > This is awful. It is broken for arrays longer than 2**49 elements. W

Bug in timsort!?

2015-02-24 Thread Roy Smith
http://envisage-project.eu/proving-android-java-and-python-sorting-algorithm-is-broken-and-how-to-fix-it/ -- https://mail.python.org/mailman/listinfo/python-list

Re: Flagging classes as not intended for direct initialization

2015-02-16 Thread Roy Smith
In article , Mario Figueiredo wrote: > It's not been an easy ride trying to decide whether or not to use super. > I started learning python from a Mark Lutz book that advised me against > it. I'm curious, what were the arguments against it? -- https://mail.python.org/mailman/listinfo/python

Re: [OT] fortran lib which provide python like data type

2015-02-01 Thread Roy Smith
In article <54ceda0b$0$12977$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > What is the plural of octopus? It's a trick question. Octopus is already plural. Monopus is singular. -- https://mail.python.org/mailman/listinfo/python-list

Re: [OT] fortran lib which provide python like data type

2015-02-01 Thread Roy Smith
In article , Chris Angelico wrote: > On Mon, Feb 2, 2015 at 1:35 PM, Matthew Barnett > wrote: > > And the plural of "virus" is "viruses", not "viri" (that's the plural of > > "vir") or "virii" (that would be the plural of "virius", if it existed). > > Yes indeed."Virii" and "octopi" are as wro

Re: Python Sanity Proposal: Type Hinting Solution

2015-01-24 Thread Roy Smith
In article <54c3a0c1$0$13013$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Tim Chase wrote: > > > On 2015-01-24 17:21, Steven D'Aprano wrote: > >> # Cobra > >> def sqroot(i as int) as float > >> > >> # Python > >> def sqroot(i:int)->float: > >> > >> > >> Cobra's use of "as" c

Re: Hello World

2015-01-18 Thread Roy Smith
In article <54bb2c5f$0$12977$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > You know that two-factor authentication doesn't offer any real security > against Man In The Middle attacks? The fact that TFA doesn't solve all problems doesn't change the fact that it solves some of th

Re: Hello World

2015-01-17 Thread Roy Smith
In article <54bb1c83$0$12979$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Even that doesn't protect you, because your security is controlled by > websites and banks etc. with stupid security policies. E.g. I am forced to > deal with one bank that uses a cryptographic key to sign

Re: lambdak: multi-line lambda implementation in native Python

2015-01-17 Thread Roy Smith
In article <54ba5a25$0$12991$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Whitespace is significant in nearly all programming languages, and so it > should be. Whitespace separates tokens, and lines, and is a natural way of > writing (at least for people using Western languages)

Re: lambdak: multi-line lambda implementation in native Python

2015-01-17 Thread Roy Smith
In article , Skip Montanaro wrote: > On Sat, Jan 17, 2015 at 5:59 AM, Jussi Piitulainen > wrote: > > How far do you want to go? Is "a b + c" the same as "a(b) + c" or the > > same as "a(b + c)"? > > I think there is only one practical interpretation, the one that all > shells I'm familiar wit

Re: lambdak: multi-line lambda implementation in native Python

2015-01-17 Thread Roy Smith
In article <54ba39e0$0$13008$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Every time I think I would like to learn a new language, I quite quickly run > into some obvious feature that Python has but the newer language lacks, and > I think "bugger this for a game of soldiers" and

Re: recursive function: use a global or pass a parameter?

2015-01-17 Thread Roy Smith
In article <54ba3654$0$13008$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Good reasons for using global variables are few and far between. Just about > the only good reason for using global variables that I can think of is if > you have one or more settings/preference that get s

Re: lambdak: multi-line lambda implementation in native Python

2015-01-15 Thread Roy Smith
In article <87zj9kb2j0@elektro.pacujo.net>, Marko Rauhamaa wrote: > Skip Montanaro : > > > Beautiful is better than ugly. > > Yes, our job is to increase the Harmony of the Universe. Useful > applications are happy side effects. > > > Explicit is better than implicit. > > Corollary: Cons

Re: lambdak: multi-line lambda implementation in native Python

2015-01-15 Thread Roy Smith
yawar.a...@gmail.com wrote: > I have implemented what I believe is a > fairly robust, if ugly-looking, native Python module I don't know which zen this is, but "Beauty is important". -- https://mail.python.org/mailman/listinfo/python-list

Re: Hello World

2014-12-22 Thread Roy Smith
In article , Tim Chase wrote: > On 2014-12-22 19:05, MRAB wrote: > > On 2014-12-22 18:51, Mark Lawrence wrote: > > > I'm having wonderful thoughts of Michael Palin's favourite Python > > > sketch which involved fish slapping. > > > > > Well, ChrisA _has_ mentioned Pike in this thread. :-) > > B

Re: Hello World

2014-12-22 Thread Roy Smith
In article <87egrrrf2i@elektro.pacujo.net>, Marko Rauhamaa wrote: > Roy Smith : > > > If I really didn't trust something, I'd go to AWS and spin up one of > > their free-tier micro instances and run it there :-) > > Speaking of trust and AWS, Am

Re: Hello World

2014-12-22 Thread Roy Smith
In article <5497e1d5$0$12978$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Steve Hayes wrote: > > > Yes, my initial reaction was "that's awesome". > > > > And my second thought was that it was scary. > > > > I ran it. It worked, and printed "Hello world". I was awed. > > > >

Re: Hello World

2014-12-22 Thread Roy Smith
In article <0udf9a1m3n02rt06a5ib58mvifm7sde...@4ax.com>, Steve Hayes wrote: > On Mon, 22 Dec 2014 09:51:02 +1100, Steven D'Aprano > wrote: > > >Tony the Tiger wrote: > > > >> On Sat, 20 Dec 2014 23:57:08 +1100, Steven D'Aprano wrote: > >> > >>> I am in total awe. > >> > >> I'm not. It has no

Re: List Comprehensions

2014-12-22 Thread Roy Smith
In article , Chris Angelico wrote: > On Mon, Dec 22, 2014 at 4:42 PM, Ganesh Pal wrote: > > (a) I was trying to reduce the below piece of code using List comprehension > > ? Any suggestion please let me know > > > > > > for opt in options: > > opt['result'] = Queue.Queue() > >

Re: Hello World

2014-12-21 Thread Roy Smith
In article , Chris Angelico wrote: > On Mon, Dec 22, 2014 at 10:50 AM, Roy Smith wrote: > > Heh. I once worked on a C++ project that included its own crypo code > > (i.e. custom implementations of things like AES and SHA-1). The person > > who wrote some particula

Re: Hello World

2014-12-21 Thread Roy Smith
In article <54974ed7$0$12986$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Obviously you don't write obfuscated code like this for production use, > except in such cases where you deliberately want to write obfuscated code > for production use. Heh. I once worked on a C++ proje

Re: Python console rejects an object reference, having made an object with that reference as its name in previous line

2014-12-14 Thread Chris Roy-Smith
On 15/12/14 10:21, Simon Evans wrote: Dear Jussi, and Billy I have changed the input in accordance with your advice, re: -- Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win here the user

Re: how to delete my file if exits in the remote server with paramiko?

2014-12-14 Thread Roy Smith
In article , "" <1248283...@qq.com> wrote: > I want to delete the file "names.txt" if it exits in "/home/names.txt" in my > remote vps server. > import paramiko > host = "vps ip" > port = 22 > transport = paramiko.Transport((host, port)) > password = "key" > username = "root" > transport.co

Re: Python Iterables struggling using map() built-in

2014-12-11 Thread Roy Smith
In article , Ian Kelly wrote: > I never said that functions can't be used as namespaces. I said that > functions are *bad* namespaces, and I gave reasons why I think this is true. An excellent example of functions acting as namespaces is nosetest's @attr() decorator. We use this, for example,

Re: Python Iterables struggling using map() built-in

2014-12-09 Thread Roy Smith
In article <54878f8a$0$13010$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > I really think you guys are trying too hard to make this function seem more > complicated than it is. If you find it so hard to understand a simple > function with four short lines, one wonders how you wou

Re: Python Iterables struggling using map() built-in

2014-12-08 Thread Roy Smith
In article <5485721c$0$2817$c3e8da3$76491...@news.astraweb.com>, Steven D'Aprano wrote: > On Mon, 08 Dec 2014 11:35:36 +1100, Chris Angelico wrote: > > > On Mon, Dec 8, 2014 at 11:27 AM, Roy Smith wrote: > >> Although, to be honest, I'm wondering if thi

Re: Python Iterables struggling using map() built-in

2014-12-07 Thread Roy Smith
In article , Chris Angelico wrote: > > Next problem, what the heck is "res"? We're not back in the punch-card > > days. We don't have to abbreviate variable names to save columns. > > Variable names are supposed to describe what they hold, and thus help > > you understand the code. I have no

Re: Python Iterables struggling using map() built-in

2014-12-07 Thread Roy Smith
In article , Chris Angelico wrote: > On Mon, Dec 8, 2014 at 10:33 AM, Steven D'Aprano > wrote: > > How would we re-write this to work in the future Python 3.7? Unless I have > > missed something, I think we could write it like this: > > > > def myzip37(*args): > > iters = list(map(iter, arg

Re: Python Iterables struggling using map() built-in

2014-12-07 Thread Roy Smith
Chris Angelico wrote: > > I'm actually glad PEP 479 will break this kind of code. Gives a good > > excuse for rewriting it to be more readable. Steven D'Aprano wrote: > What kind of code is that? Short, simple, Pythonic and elegant? :-) > > Here's the code again, with indentation fixed: > > >

Re: Proposed new conditional operator: "or else"

2014-12-02 Thread Roy Smith
In article , Chris Angelico wrote: > On Wed, Dec 3, 2014 at 4:41 AM, Zachary Ware > wrote: > > On Tue, Dec 2, 2014 at 11:18 AM, Roy Smith wrote: > >> Wouldn’t it be neat to write: > >> > >>foo == 42 or else > >> > >> and ha

Proposed new conditional operator: "or else"

2014-12-02 Thread Roy Smith
In the process of refactoring some code, I serendipitously created what I think is an essential new bit of Python syntax. The “or else” statement. I ended up with: sites_string = args.sites or else self.config['sites'] which, of course, is a syntax error today, but it got me thinking

Re: Read response XML attributes in django rest framework

2014-12-01 Thread Roy Smith
In article <1248a112-88fd-4346-a733-7716671b8...@googlegroups.com>, reetesh nigam wrote: > I need to read xml attributes coming in response data. I am using Django rest > framework. > > requested XML : startDate="02-02-2014"/> > > Response I am getting: {'xyz': None} > > I am using : 'DEFA

Re: Comprehension with two variables - explanation needed

2014-11-23 Thread Roy Smith
t;. I see one of these that has my name on the commit: report = [keys] + [[line[key] for key in keys] for line in results] but I'm glad to report that this was merely some third-party code that I imported into our repo. Whew, that was close! On Nov 23, 2014, at 11:45 AM, Skip Montanaro

Re: Comprehension with two variables - explanation needed

2014-11-23 Thread Roy Smith
In article , Skip Montanaro wrote: > > But it breaks all the picture that I've built in my head about comps till > > now... > > Note that list comprehensions are little more than syntactic sugar for for > loops. If you're having terrible writing or understanding one, especially a > compound one

Re: python 2.7 and unicode (one more time)

2014-11-22 Thread Roy Smith
In article <87y4r348uf@elektro.pacujo.net>, Marko Rauhamaa wrote: > Steven D'Aprano : > > > You haven't given any good reason for objecting to calling Unicode > > strings by what they are. Maybe you think that it is an implementation > > detail, and that some version of Python might suddenl

Re: pack circles into a partial annulus

2014-11-20 Thread Roy Smith
In article , Robin Becker wrote: > I need to pack circles into a partial annulus ie part of a larger circle > bounded by two radii [...] > Circle packing is hard so I'm thinking of using some kind of spring/repulsion > model to do this. > > Has anyone any ideas about how to do this? This is

Re: How to fix those errors?

2014-11-16 Thread Roy Smith
In article <54694389$0$13001$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Chris Angelico wrote: > > > You should be able to use two semicolons, that's equivalent to one colon > > right? > > > > ChrisA > > (No, it isn't, so don't take this advice. Thanks.) > > > Oooh! Python-

Re: How to fix those errors?

2014-11-16 Thread Roy Smith
In article , Chris Angelico wrote: > On Mon, Nov 17, 2014 at 8:32 AM, Abdul Abdul wrote: > > from PIL import Image > > import os > > > > for inputfile in filelist > > outputfile = os.path.splitext(inputfile)[0]+".jpg" > > if inputfile != outputfile: > > try: > >

Re: OTish: using short-term TCP connections to send to multiple slaves

2014-11-16 Thread Roy Smith
In article , Chris Angelico wrote: > UDP for anything more than your network's MTU is inefficient Why do you say it's inefficient? Sure, the UDP datagram will get fragmented and re-assembled at the other end, but it's not like TCP would do any better. One way or another, your data is going

Re: Bad file descriptor

2014-11-13 Thread Roy Smith
In article , Ben Finney wrote: > satishmlm...@gmail.com writes: > > > import os > > os.write(1, b'Hello descriptor world\n') > > OSError: Bad file descriptor > > It works fine for me:: > > >>> import os > >>> os.write(1, b'Hello descriptor world\n') > Hello descriptor world >

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-13 Thread Roy Smith
In article , Lie Ryan wrote: > On 13/11/14 03:57, Larry Martell wrote: > > We were all making this much harder than it is. I ended up doing this: > > > > wp = urllib.request.urlopen('http://php_page/?' + request.POST.urlencode()) > > pw = wp.read() You can do this if you want, but it's much eas

Re: How about some syntactic sugar for " __name__ == '__main__' "?

2014-11-13 Thread Roy Smith
In article , Chris Angelico wrote: > On Thu, Nov 13, 2014 at 7:47 PM, Cameron Simpson wrote: > > My view is that if there's a main (i.e. the module implements a small app > > all on its own, however tiny), then the main program logic should come > > first. The details follow later. > > Ah, I s

Re: Combining lists to dictionary

2014-11-11 Thread Roy Smith
In article , Denis McMahon wrote: > Hi > > Given x,y are a lists of keys and value that I wish to combine to a > dictionary, such that x[n] is the key for value y[n], which is preferred: > > z = {a:b for (a,b) in zip(x,y)} > z = {x[n]:y[n] for n in range(min(len(x),len(y)))} > > The zip feel

Re: I don't read docs and don't know how to use Google. What does the print function do?

2014-11-10 Thread Roy Smith
In article , sohcahto...@gmail.com wrote: > Please help me this assignment is due in an hour. Don't give me hints, just > give me the answer because I only want a grade. I'm not actually interested > in learning how to program, but I know software engineers make lots of money > so I want to

Re: A syntax question

2014-11-10 Thread Roy Smith
In article , Chris Angelico wrote: > On Tue, Nov 11, 2014 at 3:11 AM, Grant Edwards > wrote: > > I know, but in c.l.p, even jokes get nicely pednatic answers. > > And in c.l.p, odd jokes get even more pedantic spelling corrections. > > ChrisA a n d i m a g i n a r y j o k e s g e t r o

Re: Python modules

2014-11-10 Thread Roy Smith
In article , Steve Hayes wrote: > I have a book on Python that advocates dividing programs into modules, and > importing them when needed. Yes, this is a good idea. Breaking your program down into modules, each of which does a small set of closely related things, makes it easier to manage.

Re: Different behaviour in list comps and generator expressions

2014-11-07 Thread Roy Smith
In article <545d76fe$0$12980$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > The following list comprehension and generator expression are almost, but > not quite, the same: > > [expr for x in iterable] > > list(expr for x in iterable) > > > The difference is in the handling of

Re: Python Style Question

2014-10-30 Thread Roy Smith
In article <54521c8f$0$12982$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Anton wrote: > > > Let's say I have an incoming list of values *l*. Every element of *l* can > > be one of the following options: > > 1) an integer value > > 2) a string in form of '', e.g. '7' > > 3) a

Re: Status of side-effecting functions in python

2014-10-27 Thread Roy Smith
In article <544e2cf2$0$13009$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Roy Smith wrote: > > >> Yes and no. If something goes wrong in a .write() method, > >> is not Python supposed to raise an error? (!) > > > > Define &qu

Re: id == vs is

2014-10-27 Thread Roy Smith
In article , Cameron Simpson wrote: > The "is" test is more direct and less subject to iffiness because the longer > expression using id() leaves more scope/time for things to change, and of > course "id" itself can be rebound to something weird. Not to mention that Python is case-sensitive a

Re: Status of side-effecting functions in python

2014-10-26 Thread Roy Smith
In article <683c84d8-d916-4b63-b4b2-92cd2763e...@googlegroups.com>, wxjmfa...@gmail.com wrote: > Le dimanche 26 octobre 2014 14:41:43 UTC+1, Dan Sommers a écrit : > > On Sun, 26 Oct 2014 00:45:49 -0700, wxjmfauth wrote: > > > > > Ditto for .write(). Why should it return "something" ? > > > > >

Re: while loop - multiple condition

2014-10-12 Thread Roy Smith
In article , Shiva wrote: > Why is the second part of while condition not being checked? > > while ans.lower() != 'yes' or ans.lower()[0] != 'y': > ans = input('Do you like python?') > > > My intention is if either of the conditions are true the loop should break. > But the condition aft

Re: Practice question

2014-10-05 Thread Roy Smith
In article , Seymore4Head wrote: > For the record, I don't want a hint. I want the answer. 42. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python code in presentations

2014-09-30 Thread Roy Smith
On Tue, Sep 30, 2014 1:50 PM CEST Jean-Michel Pichavant wrote: > >I'm currently writing a presentation to help my co-workers ramp up on new > >features of our tool (written in python (2.7)). > > > >I have some difficulties presenting code in an efficient way (with some > >basic syntax highlights

Re: Is there a canonical way to check whether an iterable is ordered?

2014-09-18 Thread Roy Smith
In article , Chris Angelico wrote: > The one thing you can rely on (and therefore must comply with, when > you design an iterable) is that iteration will hit every element > exactly once. Does it actually say that somewhere? For example: for i in bag.pick_randomly_with_replacement(n=5): p

Re: Is there a canonical way to check whether an iterable is ordered?

2014-09-18 Thread Roy Smith
In article , Chris Angelico wrote: > On Thu, Sep 18, 2014 at 9:55 PM, cool-RR wrote: > > My function gets an iterable of an unknown type. I want to check whether > > it's ordered. I could check whether it's a `set` or `frozenset`, which > > would cover many cases, but I wonder if I can do bet

Re: How to turn a string into a list of integers?

2014-09-07 Thread Roy Smith
In article , Chris Angelico wrote: > You can't store a list in memory; what you store is a set of bits > which represent some metadata and a bunch of pointers. Well, technically, what you store is something which has the right behavior. If I wrote: my_huffman_coded_list = [0] * 100 I

Re: Python is going to be hard

2014-09-04 Thread Roy Smith
In article , Chris Angelico wrote: > On Fri, Sep 5, 2014 at 12:24 PM, Rustom Mody wrote: > > On Thursday, September 4, 2014 7:38:40 PM UTC+5:30, Chris Angelico wrote: > > > >> So a fairer comparison is: How many applications produce non-debug > >> output on stderr or stdout? And that would be a

Re: Editing text with an external editor in Python

2014-09-01 Thread Roy Smith
In article <54049ab7$0$29972$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > import tempfile > > def edit(editor, content=''): > f = tempfile.NamedTemporaryFile(mode='w+') > [...] > command = editor + " " + f.name > status = os.system(command) Hmmm. Didn't we jus

Re: suckitude classifications [was Re: Keeping python code and database in sync]

2014-08-29 Thread Roy Smith
In article , Chris Angelico wrote: > On Sat, Aug 30, 2014 at 5:02 AM, Ethan Furman wrote: > > Speaking of suckitude, we could classify technologies that way: > > > > xml: major suckitude > > > > rpc: no suckitude > > > > python: negative suckitude > > I disagree with your last two qualificatio

Re: Keeping python code and database in sync

2014-08-29 Thread Roy Smith
In article , "Frank Millman" wrote: > The project is inherently database-driven. The python code expects to find > certain tables and columns in the database. As I develop new features, I > sometimes need to modify the database structure. In the bad old days (like > yesterday) I would just ma

Re: python string, best way to concat

2014-08-28 Thread Roy Smith
In article <63bdccb4-9e34-4e40-b07d-14342e218...@googlegroups.com>, peter wrote: > I used to struggle with the concept of ''.join(('hello ','world')) - it > seemed so convoluted compared with the intuitive 'hello '+'world', and I > could never remember the syntax. Also, for the strings I was

Re: GO vs Python

2014-08-25 Thread Roy Smith
In article , Rustom Mody wrote: > On Monday, August 25, 2014 5:36:25 PM UTC+5:30, Roy Smith wrote: > > Rustom Mody wrote: > > > > Heh! You make it sound that the character model is the most important > > > thing > > > in choosing a language! > >

Re: GO vs Python

2014-08-25 Thread Roy Smith
In article , Rustom Mody wrote: > Heh! You make it sound that the character model is the most important thing > in choosing a language! > There are people using Fortran -- with not intention of finding > an alternative. Different people have different needs. If I was writing code to do number

Re: redirect stderr to syslog?

2014-08-16 Thread Roy Smith
In article <53eee06a$0$29984$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Russell E. Owen wrote: > > > I realize the logging module supports this and has a syslog writer, so > > that's a fallback. But we were hoping to use the syslog module for > > performance. > > Have you be

Re: string encoding regex problem

2014-08-15 Thread Roy Smith
In article , Philipp Kraus wrote: > The code works till last week correctly, I don't change the pattern. OK, so what did you change? Can you go back to last week's code and compare it to what you have now to see what changed? > My question is, can it be a problem with string encoding? Did I

Re: string encoding regex problem

2014-08-15 Thread Roy Smith
In article , Philipp Kraus wrote: > found = re.search( " href=\"/projects/boost/files/latest/download\?source=files\" > title=\"/boost/(.*)", > Utilities.URLReader("http://sourceforge.net/projects/boost/files/boost/";) > ) > if found == None : > raise MyError.StopError("Boost Download U

Re: how to change the time string into number?

2014-08-14 Thread Roy Smith
In article , Dennis Lee Bieber wrote: > On Thu, 14 Aug 2014 17:47:00 +1000, Cameron Simpson > declaimed the following: > > > > >Your Android phone will be running some flavour of Linux I believe. Someone > >who > >has used one may correct me here. > > > "Android" /is/ the flavor > >

Re: how to change the time string into number?

2014-08-13 Thread Roy Smith
In article <53ec2453$0$2299$426a7...@news.free.fr>, YBM wrote: > Le 14/08/2014 04:16, Tim Chase a écrit : > > On 2014-08-13 21:01, Tim Chase wrote: > >> On 2014-08-14 09:46, luofeiyu wrote: > >>> s="Aug" > >>> > >>> how can i change it into 8 with some python time module? > >> > >> >>> import

Re: how to get the ordinal number in list

2014-08-12 Thread Roy Smith
In article , Chris Angelico wrote: > I like to look at SQL as a language that specifies an end result > without specifying how to get there Well, sure, but sometimes the how to get there is a matter of 10x, or 100x, or 1000x in performance. I'm currently migrating a 3 TB database to a new 5

Re: Suitable Python code to scrape specific details from web pages.

2014-08-12 Thread Roy Smith
In article <53eaab7d$0$29979$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > By studying how other scraping programs work, and studying how your racing > pages store data, you should be able to put the two together and see how to > get the data you want. It's also worth mentioning

Re: Suitable Python code to scrape specific details from web pages.

2014-08-12 Thread Roy Smith
In article , Simon Evans wrote: > Dear Programmers, > I have been looking at the You tube 'Web Scraping Tutorials' of Chris Reeves. > I have tried a few of his python programs in the Python27 command prompt, but > altered them from accessing data using links say from the Dow Jones index, to >

Re: how to get the ordinal number in list

2014-08-11 Thread Roy Smith
In article , Rustom Mody wrote: > A C programmer asked to swap variables x and y, typically writes something > like > > t = x; x = y; y = t; > > Fine, since C cant do better. Sure C can do better. x = x ^ y y = y ^ x x = x ^ y Any self-respecting C hacker would write it this way :-) -- ht

Re: how to get the ordinal number in list

2014-08-10 Thread Roy Smith
In article , Mark Lawrence wrote: > On 10/08/2014 19:26, Rustom Mody wrote: > > > > Its when we have variables that are assigned in multiple places that > > we start seeing mathematical abominations like > > x = x+1 > > > > I'm not bothered about it being a mathematical or any other type of >

Re: how to get the ordinal number in list

2014-08-10 Thread Roy Smith
In article <154cc342-7f85-4d16-b636-a1a953913...@googlegroups.com>, Rustom Mody wrote: > >>> l= [6,2,9,12,1,4] > >>> sorted(l,reverse=True)[:5] > [12, 9, 6, 4, 2] > > No need to know how sorted works nor [:5] > > Now you (or Steven) can call it abstract. > > And yet its > 1. Actual running c

Re: how to get the ordinal number in list

2014-08-10 Thread Roy Smith
In article , Rustom Mody wrote: > > They haven't figured out yet that the > > first step to solving a problem is to decide what algorithms you're > > going to use, and only then can you start translating that into code. > > They need to be led in small steps towards basic knowledge. > [...]

Re: get the min date from a list

2014-08-10 Thread Roy Smith
In article , Dave Angel wrote: > Your simplest answer is probably to write a function that converts > a string like you have into a datetime object, say call it > converter (). Then after testing it, you call > > min (dates, key = converter) Wow, after all these years, I didn't know min() to

Re: how to get the ordinal number in list

2014-08-09 Thread Roy Smith
In article <338e8fb0-c9ec-462a-b560-1c1ff77de...@googlegroups.com>, Rustom Mody wrote: > [To the OP] > Yeah I am in the minority at least out here in considering > comprehensions simpler than loops. Take your pick When comprehensions first came out, I stubbornly refused to get my head around t

Re: Test for an empty directory that could be very large if it is not empty?

2014-08-07 Thread Roy Smith
In article , Tim Chase wrote: > On 2014-08-07 08:19, Roy Smith wrote: > > > My glob.iglob() uses os.listdir() behind the scenes (see glob1() > > > in glob.py) > > > > > > -tkc > > > > In which case, the documentation for iglob() is broken.

Re: Test for an empty directory that could be very large if it is not empty?

2014-08-07 Thread Roy Smith
In article , Tim Chase wrote: > On 2014-08-07 07:54, Roy Smith wrote: > > I wonder if glob.iglob('*') might help here? > > My glob.iglob() uses os.listdir() behind the scenes (see glob1() in > glob.py) > > -tkc In which case, the documentation for iglob(

Re: Test for an empty directory that could be very large if it is not empty?

2014-08-07 Thread Roy Smith
In article , Gregory Ewing wrote: > Virgil Stokes wrote: > > How can I > > determine if the directory is empty WITHOUT the generation of a list of > > the file names > > Which platform? > > On Windows, I have no idea. > > On Unix you can't really do this properly without access > to opendir

Re: AttributeError: 'module' object has no attribute 'fork'

2014-08-07 Thread Roy Smith
In article , Peter Otten <__pete...@web.de> wrote: > os.fork() > Fork a child process. > ... > Availability: Unix. > """ > > You are using the wrong operating system ;) To be honest, this could be considered a buglet in the os module. It really should raise: NotImplementedError("fork() is on

Re: Correct type for a simple "bag of attributes" namespace object

2014-08-03 Thread Roy Smith
In article <53ded02e$0$29980$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Marko Rauhamaa wrote: > > > I've reached a point where I think classes are a superfluous OO concept. > > You only need objects. > > I don't know whether "superfluous" is correct, but they certainly are >

Re: Correct type for a simple “bag of attributes” namespace object

2014-08-03 Thread Roy Smith
In article , Mark Lawrence wrote: > On 02/08/2014 20:58, Ben Finney wrote: > > Steven D'Aprano writes: > > > >> If you need instances which carry state, then object is the wrong > >> class. > > > > Right. The ‘types’ module provides a SimpleNamespace class for the > > common “bag of attri

Re: try/exception - error block

2014-08-03 Thread Roy Smith
In article , Mark Lawrence wrote: > How to go about this is at "Short, Self Contained, Correct (Compilable), > Example" at http://sscce.org/ It says there, "most readers will stop reading by 100 lines of code". I guess I have a short attention span relative to "most readers", because my tl;

Re: Correct type for a simple "bag of attributes" namespace object

2014-08-03 Thread Roy Smith
In article <87wqaplj8h@elektro.pacujo.net>, Marko Rauhamaa wrote: > I've reached a point where I think classes are a superfluous OO concept. > You only need objects. comp.lang.javascript is over that way --> -- https://mail.python.org/mailman/listinfo/python-list

Re: try/exception - error block

2014-08-03 Thread Roy Smith
In article , bruce wrote: > I'm posting the test code I'm using. Pointers/comments would be > helpful/useful. It would be really helpful if you could post a minimal code example which demonstrates the problem you're having. Leave out everything (including the commented-out code) which isn't

Re: Correct type for a simple “bag of attributes” namespace object

2014-08-03 Thread Roy Smith
In article , Chris Angelico wrote: > On Sun, Aug 3, 2014 at 11:25 PM, Roy Smith wrote: > > in which case, I've said, "make Foos just like objects, except for, oh, > > never mind, there aren't any differences". But, in reality, the system > > b

Re: Correct type for a simple “bag of attributes” namespace object

2014-08-03 Thread Roy Smith
In article , Chris Angelico wrote: > On Sun, Aug 3, 2014 at 10:40 PM, Roy Smith wrote: > > I usually just do: > > > > class Data: > >pass > > my_obj = Data() > > > > That's all you really need. It's annoying that you can't ju

Re: Correct type for a simple “bag of attributes” namespace object

2014-08-03 Thread Roy Smith
In article , Mark Lawrence wrote: > On 02/08/2014 20:58, Ben Finney wrote: > > Steven D'Aprano writes: > > > >> If you need instances which carry state, then object is the wrong > >> class. > > > > Right. The ‘types’ module provides a SimpleNamespace class for the > > common “bag of attri

Re: Python and IDEs [was Re: Python 3 is killing Python]

2014-08-02 Thread Roy Smith
In article , Gregory Ewing wrote: > > And don't mention the menu bar across the top, separated from the > > window to which it belonged. > > That seems to be a matter of taste. There are some > advantages to the menu-bar-at-top model. It's an easier > target to hit, because you can just flick t

  1   2   3   4   5   6   7   8   9   10   >