Re: sequence multiplied by -1

2010-09-25 Thread Thomas Jollans
On Saturday 25 September 2010, it occurred to Yingjie Lan to exclaim: > Hi, > > I noticed that in python3k, multiplying a sequence by a negative integer is > the same as multiplying it by 0, and the result is an empty sequence. It > seems to me that there is a more meaningful symantics. Um... fo

Re: SocketServer: replace network by hard drive

2010-09-25 Thread Thomas Jollans
On Saturday 25 September 2010, it occurred to Nobody to exclaim: > On Fri, 24 Sep 2010 19:28:45 +0200, Thomas Jollans wrote: > > If you're using UNIX, and you don't actually need the stream to be > > passed via the hard drive (why would you?), but for some reason want t

Re: Qt not working o Wing ide 3.2

2010-09-26 Thread Thomas Jollans
On Sunday 26 September 2010, it occurred to tayfuryılmaz to exclaim: > hi everyone ı develop a program with pythoon and qt on wing ide > ı use pyqt module in my program bu when ı debug a program,python is > not debugging and o.s show a screen for solution.. and solution says > python is not debuggi

Re: How to match where the search started?

2010-09-28 Thread Thomas Jollans
On Tuesday 28 September 2010, it occurred to Florian Kaufmann to exclaim: > >From the documentation: > 7.2.4. Regular Expression Objects, search(string[, pos[, endpos]]) > ... the '^' pattern character matches at the real beginning of the > string and at positions just after a newline, but not nece

Re: Upload files with wsgi

2010-09-29 Thread Richard Thomas
On Sep 28, 11:31 pm, Hidura wrote: > Hello, i have a project on Python3k, and i have a very big problem i > don' t find how take an upload file i am using the wsgiref lib, and or > theres any way to connect to the client in order to get the file by > myself? > > Thank you > Diego Hidalgo. > > -- >

Re: System idle time under Linux

2010-09-29 Thread Thomas Jollans
On Wednesday 29 September 2010, it occurred to Hugo Léveillé to exclaim: > Thanks, will take a closer look on that > > But to get me started, how would you get, via python, the info from that > ? Parse the files. They may be very special files, but they are just files. > > Thanks alot > > > O

Re: eval string

2010-09-30 Thread Thomas Jollans
On Thursday 30 September 2010, it occurred to Brandon Harris to exclaim: > Needing to pass a string command into a third party program and having > issues creating a string to do what I need. > > here's what I have so far. > > eval('import sys; > sys.stderr.write(\'\n\n\nCompleted!!!\nCompleted

Re: C API: Getting PyObject by name

2010-09-30 Thread Thomas Jollans
On Thursday 30 September 2010, it occurred to pbienst to exclaim: > Hi, > > I'm embedding Python in a C app. > > Say I do the following: > > PyRun_SimpleString("a = 1") > > Is there then a way to get access to the PyObject corresponding to a, > only making use in C of the fact that it's calle

Re: Problems with wsgi Python3

2010-09-30 Thread Thomas Jollans
On Thursday 30 September 2010, it occurred to [email protected] to exclaim: > What mean this > -743346150198628700241600224--\r? it looks like a MIME boundary. In this context most likely from a multipart/form-data transmission. > > On Sep 30, 2010 2:38pm, hid...@gmai

Re: Regular Expression Skipping Match

2010-10-02 Thread Thomas Jollans
On Saturday 02 October 2010, it occurred to AON LAZIO to exclaim: > Hi python pals, >I need this help, say I have >h = "Hello \n World" >How would I create a regular expression that match only "Hello World"? > (ignore \n in the middle) What exactly are you looking for? One way to solve

Re: why L[3:1]=['?'] become L.insert(3,'?')

2010-10-04 Thread Richard Thomas
On Oct 4, 3:26 pm, sd44 wrote: > In > part III > how does Python handle it if you try to extract a sequence in reverse, > with the lower bound greater than the higher bound (e.g., L[3:1])? Hint: > try > assigning to this slice (L[3:1]=['?']), and see where the value is put. > > >>> L=[1,2,3,4] >

Re: Module loading trickery

2010-10-05 Thread Thomas Jollans
Maybe. % cat a.py foo = 'Meh.' import b % cat b.py from a import foo print(foo) % python a.py Meh. % - Thomas [*] Actually, it is possible with runpy. But don't. Really, don't, unless you have a very good reason to do so, and judging by the way the question was asked, I don't think you do. -- http://mail.python.org/mailman/listinfo/python-list

Re: Module loading trickery

2010-10-06 Thread Thomas Jollans
On Wednesday 06 October 2010, it occurred to Dave Angel to exclaim: > On 2:59 PM, Thomas Jollans wrote: > > > > % cat a.py > > foo = 'Meh.' > > import b > > > > % cat b.py > > from a import foo > > > > print(foo) >

python-2.6.6 coredump running newspipe

2010-10-06 Thread Thomas Klausner
int rc; 45 va_list va; 46 47 va_start(va, format); (gdb) It seems that the format argument is corrupted while calling PyOS_snprintf. Any ideas what could cause this or how to fix this? Thanks, Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: question about a program

2010-10-08 Thread Richard Thomas
On Oct 8, 1:39 am, Logan Butler wrote: > question about an assignment: > > >>> places("home sweet home is here",' ') > > [4, 10, 15, 18] > > this is my code: > > def places(x, y): >     return [x.index(y) for v in x if (v == y)] > > so far I'm only getting > [4, 4, 4, 4] > > so the first value is

Re: Is there a way to pring a list object in Python?

2010-10-31 Thread Richard Thomas
On Oct 31, 5:42 am, Zeynel wrote: > class Rep(db.Model): >     author = db.UserProperty() >     replist = db.ListProperty(str) >     unique = db.ListProperty(str) >     date = db.DateTimeProperty(auto_now_add=True) > > > > Rep().replist = L > Rep().put() > mylist = Rep().all().fetch(10) > > I

Re: Is there a way to pring a list object in Python?

2010-10-31 Thread Richard Thomas
On Oct 31, 7:04 pm, Zeynel wrote: > On Oct 31, 5:52 am, Dave Angel wrote: > > > > > > > > > > > On 2:59 PM, Zeynel wrote:> class Rep(db.Model): > > >      author = db.UserProperty() > > >      replist = db.ListProperty(str) > > >      unique = db.ListProperty(str) > > >      date = db.DateTimePro

Re: Recompilation of Python3.6.x

2017-03-22 Thread Thomas Nyberg
a list is super reasonable considering that there are many different OSs which have sometimes have slightly different library package names (though of course one could argue that Ubuntu/debian helps a lot of people). Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: Recompilation of Python3.6.x

2017-03-22 Thread Thomas Nyberg
somewhere on the main python website. Having this would definitely be great, but I know I personally don't feel like doing the legwork... Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: python source code

2017-03-22 Thread Thomas Nyberg
source of a specific python program...then it depends on the program and we'll need a bit more detail... Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: Recompilation of Python3.6.x

2017-03-23 Thread Thomas Nyberg
h _is_ your situation and hence you have already solved your problem). For others...well if you choose to use such a system it's your responsibility. As much as it was irritating not learning these tricks earlier, you do now know them and should be fine going forward... Cheers, Thomas -- ht

Re: Python and the need for speed

2017-04-08 Thread Thomas Nyberg
On 04/08/2017 05:20 PM, [email protected] wrote: > I've an idea that http://www.mos6581.org/python_need_for_speed is a week late > for April Fool's but just in case I'm sure that some of you may wish to > comment. > > Kindest regards. > > Mark Lawrence. > Regarding your restricted subset o

Re: "Goto" statement in Python

2017-04-13 Thread Thomas Nyberg
erent ways you can get around using them, but there are certainly cases where that's exactly what you want and a substitute will always be a substitute and it may feel lacking. It's just a matter of taste really. Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: Basics of pythons 🐍

2017-04-21 Thread Thomas Nyberg
On 04/21/2017 08:06 AM, [email protected] wrote: > Hey everyone, I'm willing to learn python , ant advices ? > Thanks in advance > Here is a tutorial: https://docs.python.org/3/tutorial/ -- https://mail.python.org/mailman/listinfo/python-list

Re: How to update python from 3.5.2 to 3.5.3 on Linux

2017-05-03 Thread Thomas Nyberg
t you should run $ sudo apt-get update CAUTION: If you haven't done this before, save yourself potential problems by making a backup of the `/etc/apt/sources.list` file before editing it... Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: How to update python from 3.5.2 to 3.5.3 on Linux

2017-05-03 Thread Thomas Nyberg
On 05/03/2017 11:04 AM, Daiyue Weng wrote: > nope, I was thinking it might be good to update to 3.5.3 for security > reasons? > (CCing back in python-list since I accidentally dropped it.) I wouldn't worry about it. Package managers tend to usually take care of security updates. (Of course there

Re: How to update python from 3.5.2 to 3.5.3 on Linux

2017-05-03 Thread Thomas Nyberg
On 05/03/2017 11:47 AM, Wolfgang Maier wrote: > On 03.05.2017 17:11, Thomas Nyberg wrote: >> On 05/03/2017 11:04 AM, Daiyue Weng wrote: >>> nope, I was thinking it might be good to update to 3.5.3 for security >>> reasons? >>> >> >> (CCing bac

Re: How to update python from 3.5.2 to 3.5.3 on Linux

2017-05-03 Thread Thomas Nyberg
about whether it is _always_ true and rather that it is possibly _ever_ true (which apparently it is for 16.04). :) But thanks for pointing this out as well! Really I just need to file this in my brain under "assumptions I should not make"... Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: Is An Element of a Sequence an Object?

2017-06-03 Thread Thomas Jollans
ython 2, range does store all of its elements as objects. Running this code in Python 2 will consume many gigabytes of memory. If you have to use Python 2, use xrange instead. Hope this helps. Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: Is An Element of a Sequence an Object?

2017-06-04 Thread Thomas Jollans
On 04/06/17 09:52, Rustom Mody wrote: > On Sunday, June 4, 2017 at 12:45:23 AM UTC+5:30, Jon Forrest wrote: >> I'm learning about Python. A book I'm reading about it >> says "... a string in Python is a sequence. A sequence is an ordered >> collection of objects". This implies that each character i

Re: error when import private key in python

2017-06-04 Thread Thomas Jollans
This is just a wild guess, but it looks like the package expects there to be multiple lines in the key. -- Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: Transitioning from Linux to Windows

2017-06-04 Thread Thomas Jollans
On 04/06/17 22:56, [email protected] wrote: > I was looking for the "simplest" possible solution to take a script that runs > on a Linux box and figure out a way to have it run from a windows client Care to comment on why getting the script to run on Windows directly is so difficult? I'm sure you

Re: Transitioning from Linux to Windows

2017-06-04 Thread Thomas Jollans
(if you're still toying with the idea of hacking together something with PuTTy and the users SSHing in from Windows, then a command line script on the user's PC might actually be more user-friendly...) > > On Sunday, June 4, 2017 at 5:05:49 PM UTC-5, Thomas Jollans wrote: &g

Re: Is An Element of a Sequence an Object?

2017-06-05 Thread Thomas Jollans
On 05/06/17 09:38, Jussi Piitulainen wrote: > Peter Otten writes: > >> Thomas Jollans wrote: >>> Also: >>> >>>>>> s[0] is s[0][0][0][0][0][0][0] >>> True >>>>>> >> >> However, this is an implementation detail

Re: openpyxl reads cell with format

2017-06-05 Thread Thomas Jollans
t you want to do if you need the string "4-Feb" - unless you can show us that that string is stored in the XML file) -- Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: Unhelpful error message

2017-06-06 Thread Thomas Nyberg
rst glance: >>> float('') Traceback (most recent call last): File "", line 1, in ValueError: could not convert string to float: '' >>> float('a') Traceback (most recent call last): File "", line 1, in ValueError: could not convert string to float: 'a' >>> float('1') 1.0 Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: Unhelpful error message

2017-06-06 Thread Thomas Nyberg
On 06/06/2017 11:46 AM, Jon Ribbens wrote: > On 2017-06-06, Thomas Nyberg wrote: >> My changes feel a bit hacky. I wanted to just drop a straight repr() in, >> but I didn't want to change the code too much since I assume the string >> formatting is already there

Re: Unhelpful error message

2017-06-06 Thread Thomas Nyberg
ring is empty, then the line: if (end != last) { does not evaluate to true, so you end up skipping the error you're referring to and instead executing these lines: else if (x == -1.0 && PyErr_Occurred()) { return NULL; } So maybe the logic should be fixed here since the empty string is basically taking a separate logical path than it philosophically should (imo). Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: Unhelpful error message

2017-06-06 Thread Thomas Nyberg
o float: 3.6: >>> float("") Traceback (most recent call last): File "", line 1, in ValueError: could not convert string to float: 3.7.0a0: >>> float("") Traceback (most recent call last): File "", line 1, in ValueError: could not convert string to float: Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: In which order many functions are executed in a python code

2017-06-09 Thread Thomas Nyberg
; are called in the first one even thou they are not global, any hints ? > Maybe if you post some specific code it will be easier to see what you're confused about? Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: httplib HTTP class for python3?

2017-06-10 Thread Thomas Jollans
actually do much of anything if the relevant modules *were* imported. -- Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: How to store some elements from a list into another

2017-06-12 Thread Thomas Jollans
70, 268, 272, 269, 273, 270, 274, 272, 275, 273] py> I hope these hints were of some help. I'll leave the next steps as an exercise for you (learning to debug is important, and hard!). If you come back when you've made some more progress, (or got it working) I'll show you some more elegant solutions (unless someone else beats me to it, of course). Good luck Thomas > > I appreciate your help > Thank you > -- https://mail.python.org/mailman/listinfo/python-list

Re: Test String Contents

2017-06-13 Thread Thomas Nyberg
ollowing seems okay: >>> s = 'hello_world' >>> s.replace('-','').replace('_','').isalpha() True >>> s = 'hello world' >>> s.replace('-','').replace('_','').isalpha() False >>> Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: sqlite in 2.7 on redhat 6

2017-06-16 Thread Thomas Jollans
On 15/06/17 14:45, Larry Martell wrote: > I am trying to use sqlite > > $ python2.7 > Python 2.7.10 (default, Feb 22 2016, 12:13:36) > [GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. import _sqlite3 > Traceback (most r

Best way to ensure user calls methods in correct order?

2017-06-22 Thread Thomas Nyberg
sume a decorator could be used to do some sort of "order registration", but I figure I might as well ask before I re-invent a hexagonal wheel. Thanks a lot for any help! Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: Best way to ensure user calls methods in correct order?

2017-06-22 Thread Thomas Nyberg
ing silly. On 06/22/2017 04:40 PM, Steve D'Aprano wrote: > On Thu, 22 Jun 2017 11:53 pm, Thomas Nyberg wrote: > > Don't do that. It's fragile and an anti-pattern. Your methods have too much > coupling. If c() relies on b() being called first, then either b() or

Re: Best way to ensure user calls methods in correct order?

2017-06-22 Thread Thomas Nyberg
rint("Calling c()...") @inorder def d(self): print("Calling d()...") -- Now of course I'll have to consider Steve's response and wonder _why_ exactly I'm doing this... Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: Best way to ensure user calls methods in correct order?

2017-06-24 Thread Thomas Jollans
On 22/06/17 17:31, Thomas Nyberg wrote: > Thanks for the response! I see the reasoning, but I can't entirely > square it with what I'm thinking. Probably it's either because I was > hiding some of my intention (sorry if I wasted your time due to lack of > details) or th

Re: Best way to ensure user calls methods in correct order?

2017-06-24 Thread Thomas Nyberg
On 06/24/2017 11:53 AM, Thomas Jollans wrote: > If the data is modified in-place, maybe it makes sense to to use a class > like the one you have, but then it's a bit bizarre to make your methods > create an artificial side effect (self._a_dirty) - why don't you simply > check

Re: DJANGO cannot import name _compare_digest

2017-06-28 Thread Thomas Jollans
On 28/06/17 21:52, Xristos Xristoou wrote: > > > hello i have python 7.13 > > DJANGO 1.11.2 version > > django-crypto 0.20 version on windows 10. > > i want to create a DJANGO app but anytime to try to migrate i take > > that error : > > from django.utils.crypto import get_random_string

Re: sys.exc_info

2017-06-29 Thread Thomas Jollans
(I think?) removed in 2.7. >From looking at the old documentation, I have a suspicion that until Python 1.4 (or even earlier than that) the exception "value" was actually never an exception instance. (I'm afraid I can't find a way to install 1.4 and test it on my computer. At least not a reasonable one.) Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: sys.exc_info

2017-06-29 Thread Thomas Jollans
On 29/06/17 19:00, eryk sun wrote: > On Thu, Jun 29, 2017 at 6:50 AM, Steven D'Aprano wrote: >> try: >> something >> except: >> exc_type, exc, tb = sys.exc_info() >> print(traceback.extract_tb(tb)) >> raise >> >> Why does it return the exception type separately from the exception,

Re: import queue in Python 2 and Python 3

2017-06-30 Thread Thomas Jollans
On 30/06/17 06:06, Benjamin Chaney wrote: > What is the best way to import the synchronized queue class that is > compatible with both Python2 and Python3. Right now I am using the > following: > >> if sys.version_info < (3, 0): >>import Queue as queue >> else: >>import queue > > This see

Re: DJANGO cannot import name _compare_digest

2017-07-01 Thread Thomas Jollans
;help", "copyright", "credits" or "license" for more information. >>> from operator import _compare_digest Traceback (most recent call last): File "", line 1, in ImportError: cannot import name '_compare_digest' >>> import logging as os >>> from os import walk >>> walk.__module__ 'os' -- Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: how to make this situation return this result?

2017-07-02 Thread Thomas Jollans
xing the dictionary itself: dictionary[key] -- Thomas > > > On Sun, 2 Jul 2017 at 12:48 AM, Pavol Lisy wrote: > >> On 7/1/17, Ho Yeung Lee wrote: >>> just want to compare tuples like index (0,1), (0,2), (1,2) without >>> duplicate >>> such as (2,0), (1,

Re: Python threading and sharing variables

2017-07-05 Thread Thomas Nyberg
me sort of value to indicate being finished main() $ python3 test.py 0 1 2 3 4 Not sure if this helps, but I personally find it clearer than the shared class variable method you're using. Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: Python threading and sharing variables

2017-07-05 Thread Thomas Nyberg
to see it. This only really requires a single "channel" (e.g. a queue) and not for the variable to further exposed. Also personally I just find it much clearer. I was very confused what your code was doing and basically need to step through it to understand. Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: Python threading and sharing variables

2017-07-05 Thread Thomas Nyberg
On 07/05/2017 10:20 AM, Thomas Nyberg wrote: > [...snip...] Btw I forgot to mention that you'd probably want to use q.get_nowait() instead of q.get() in my code example if you don't want the main thread to block (which what I think you want to avoid from your code example).

Re: Python threading and sharing variables

2017-07-05 Thread Thomas Nyberg
riable if the operation on the variable is performed in a single Python instruction? Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: School Management System in Python

2017-07-05 Thread Thomas Nyberg
adable format and then load the data (say names) in line by line. You might want to look into the csv module. 4. You probably want some documentation walking through what this should be doing. Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: School Management System in Python

2017-07-05 Thread Thomas Nyberg
upon how you are updating data, using sqlite or some database might make sense, but if you're just reading in or writing out entire text files, then I'd just recommend skipping sqlite and instead just writing to the files directly. Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: School Management System in Python

2017-07-05 Thread Thomas Nyberg
x27;, 'w') as outfile: writer = csv.writer(outfile) writer.writerow(range(5)) # Using tabs with open('outfile.tsv', 'w') as outfile: writer = csv.writer(outfile, delimiter='\t') writer.writerow(range(5)) Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: School Management System in Python

2017-07-05 Thread Thomas Nyberg
mes I've taught people this sort of thing... Thanks for the perspective! Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: School Management System in Python

2017-07-05 Thread Thomas Nyberg
hink it's worth thinking about that at this stage. It's always best to optimize for cognitive overhead (i.e. to make code simpler and easier to understand) before making the code more complicated through optimizations. Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: School Management System in Python

2017-07-05 Thread Thomas Nyberg
ch. But if you just have flat data (like name, job, address, etc.) where you just have one row per person, then something like a csv is probably easier. The best choice depends on your specific use case. Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: How to write raw strings to Python

2017-07-05 Thread Thomas Jollans
may me looking for repr() <https://docs.python.org/3/library/functions.html#repr> -- Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: Users of namedtuple: do you use the _source attribute?

2017-07-18 Thread Thomas Nyberg
On 07/19/2017 05:12 AM, Steve D'Aprano wrote: > On Wed, 19 Jul 2017 08:39 am, Gregory Ewing wrote: > Um... well, people want to do all sorts of wild and wacky things... but why > would you define a named tuple with *private* fields? Especially since that > privateness isn't enforced when you access

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Thomas Jollans
mlaut (in German loanwords like ‘überhaupt’) and the tréma (in words like vacuüm). Other languages, like Turkish, use the umlaut symbol for separate vowels that are not umlauts (i.e. shifted vowels, like mouse - mice / Maus - Mäuse) So let's just pretend that characters in general have no mea

Re: Python 3 removes name binding from outer scope

2017-07-25 Thread Thomas Jollans
e) > 42 END_FINALLY > 44 JUMP_FORWARD 2 (to 48) > >> 46 END_FINALLY > >> 48 LOAD_CONST 0 (None) > 50 RETURN_VALUE >>>> > > It actually does the equivalent of: >

Re: @lru_cache on functions with no arguments

2017-08-01 Thread Thomas Nyberg
https://pypi.python.org/pypi/lazy-property Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: @lru_cache on functions with no arguments

2017-08-01 Thread Thomas Nyberg
he package I linked though). For example, I know at some point I used some variation of this (~11 lines): https://github.com/columbia-applied-data-science/rosetta/blob/master/rosetta/common.py#L24-L35 But I do respect the distaste for adding a dependency on something so small. :) Cheer

Re: how to fast processing one million strings to remove quotes

2017-08-03 Thread Thomas Jollans
e, where you don't really want to double the memory use: for idx, line in enumerate(str_lines): str_lines[idx] = fixed(line) The most Pythonic way to process a large "list" of data is often to not use a list at all, but to use iterators. Whether it's feasible to access the strings one-by-one will depend on where they come from and where they're going. Something like this may or may not be useful: def remove_quotes_from_all(lines): for line in lines: yield line[1:-1].replace('""', '"') with open('weird_file.txt', 'r') as input: with open('not_so_weird_file.txt', 'w') as output: for fixed_line in remove_quotes_from_all(input): output.write(f'{fixed_line}\n') -- Thomas -- https://mail.python.org/mailman/listinfo/python-list

Re: Assignment of global variables in a script.

2025-06-30 Thread Thomas Passin
On 6/30/2025 11:53 PM, Popov, Dmitry Yu via Python-list wrote: Dear Sirs. I found the following sentence in the Python documentation: "The statements executed by the top-level invocation of the interpreter, either read from a script file or interactively, are considered part of a module called

Re: Best practice for config files?

2025-05-22 Thread Thomas Passin
On 5/22/2025 7:09 PM, Rob Cliffe via Python-list wrote: On 22/05/2025 23:45, Mats Wichmann wrote: On 5/22/25 13:59, Michael F. Stemper via Python-list wrote: I recently wrote a program to do some record-keeping for me. I found myself hard-coding a bunch of different values into it. This didn'

Re: Searching for a file

2025-05-27 Thread Thomas Passin
On 5/27/2025 10:41 AM, Roland Mueller via Python-list wrote: To get a list of files in a given directory one can use glob.glob and The OP had a different problem. He wanted to find a config file of known name that could be in one of several locations. os.path.isfile from os.path import i

Python 3.13.4, 3.12.11, 3.11.13, 3.10.18 and 3.9.23 are now available

2025-06-03 Thread Thomas Wouters
available/94367#p-252840-enjoy-the-new-releases-9>Enjoy the new releases Thanks to all of the many volunteers who help make Python Development and these releases possible! Please consider supporting our efforts by volunteering yourself or through organization contributions to the Python Softw

[RELEASE] Python 3.13.5 is now available (yes, really...)

2025-06-11 Thread Thomas Wouters
releases Thanks to all of the many volunteers who help make Python Development and these releases possible! Please consider supporting our efforts by volunteering yourself or through organization contributions to the Python Software Foundation. Regards from hey, it’s us again, your release team, Tho

[RELEASE] Python 3.13.9 is now available

2025-10-18 Thread Thomas Wouters
Python 3.13.9 is now available. https://www.python.org/downloads/release/python-3139/ 3.13.9 is an expedited release containing a fix for one specific regression in Python 3.13.8: • gh-139783 : Fix `inspect.getsourcelines` for the case when a d

Re: Image enhance

2025-09-02 Thread Thomas Passin
On 9/2/2025 11:29 AM, amrodi--- via Python-list wrote: I'm new to Python. Operating System - Windows XP SP3 Python 2.7 installed. I got a script that tries to improve the image? I created a bat file using the command line. C:\python27\python.exe d:\temp\teste.py But even though it runs, it

[RELEASE] Python 3.12.12, 3.11.14, 3.10.19 and 3.9.24 are now available!

2025-10-17 Thread Thomas Wouters
Old-timer Release Party We couldn’t just let Hugo have fun with 3.14.0, so here are new security releases of the venerated Python versions, 3.12 through 3.9! Security content in these releases XML-related • gh-139312 : Upgraded bundled libexpat

[RELEASE] Python 3.13.8 is now available.

2025-10-17 Thread Thomas Wouters
Python 3.13.8 is now available (but 3.14.0 probably deserves more attention ;p) https://www.python.org/downloads/release/python-3138/ This is the eighth maintenance release of Python 3.13 Python 3.13 is the newest previous major release of the Python programming language, and it contains many

Re: Slices by length

2025-10-18 Thread Thomas Passin
On 10/7/2025 2:49 PM, Rob Cliffe via Python-list wrote: On 06/09/2025 17:21, MRAB wrote: On 2025-09-06 13:47, Rob Cliffe via Python-list wrote: I quite often find myself writing expressions of the form       someString[x : x+n] where n is often an int and x may be an int, a variable, or a (po

Re: can you improve this text-only beginner copy program?

2025-08-27 Thread Thomas Passin
On 8/27/2025 1:45 PM, Stefan Ram wrote: Ethan Carter wrote or quoted: You're right. There's no written statement. The exercise was suggested by the teacher while in class. It was something like ``write a program that copies text files by getting source and destination via the command-line.''

Re: Proposal: private keyword for import statements to hide module dependencies

2025-11-22 Thread Thomas Passin
On 11/21/2025 8:03 PM, Richard Damon wrote: One thought that came to mind as perhaps a way more in line with how other parts of python work, is to extend the “name mangling” aspect of __ to this sort of context. (Just __ at the beginning, not both before and after). In class members these beco

Re: code review

2012-06-30 Thread Thomas 'PointedEars' Lahn
Peter Otten wrote: > If you spell it > > def is_valid_password(password): > return mud.minpass <= len(password) <= mud.maxpass > > it is even easier to see that you are performing an interval check. This is probably a tautology around here, but *what* *a* *great* *programming* *language*.

Re: Re: code review

2012-07-01 Thread Thomas 'PointedEars' Lahn
Evan Driscoll wrote: > On 6/30/2012 19:37, Chris Angelico wrote: >> On Sun, Jul 1, 2012 at 10:08 AM, Ben Finney >> wrote: >>> I know of no programming language that >>> would give a newcomer to Python that expectation. So where is the norm >>> you're referring to? >> >> C, SQL, REXX, and many ot

Re: code review

2012-07-01 Thread Thomas 'PointedEars' Lahn
Evan Driscoll wrote: > On 6/30/2012 23:45, Evan Driscoll wrote: >> You may also >> want to put Java in there as well, as < is effectively not commutative >> in that language. (I didn't try C#.) > > I guess you could actually put Lua and Ruby into the roughly same > category as Java too. > > But

Re: Basic question about speed/coding style/memory

2012-07-21 Thread Thomas 'PointedEars' Lahn
Jan Riechers wrote: > I have one very basic question about speed,memory friendly coding, and > coding style of the following easy "if"-statement in Python 2.7, but Im > sure its also the same in Python 3.x > > Block > #-- > if statemente_true: > doSomething() > els

Re: Is Python a commercial proposition ?

2012-07-29 Thread Thomas 'PointedEars' Lahn
Michael Hrivnak wrote: > Python is used frequently on the server side of web applications for > sites of all sizes, with the UI generally being done in javascript. There is no javascript. -- PointedEars Please do not Cc: me. / Bitte keine Kopien per E-Mail. -- http://mail.python.org/mailman/l

Demise of Mr. Kenneth Gonsalves

2012-08-03 Thread Anoop Thomas Mathew
d the PyCon India, done a lot of workshops on Python and was an active member in the Django user group. Anoop Thomas Mathew -- http://mail.python.org/mailman/listinfo/python-list

Re: Demise of Mr. Kenneth Gonsalves

2012-08-03 Thread Anoop Thomas Mathew
Chronic Asthma. He was hospitalized yesterday, and passed away today. On 3 August 2012 20:45, Marcin Tustin wrote: > What happened to him? He was posting on this list in the last week? > > On Fri, Aug 3, 2012 at 11:12 AM, Anoop Thomas Mathew wrote: > >> With my heartfelt co

Re: pylagiarism -- Need help now! Please provide code...

2012-08-14 Thread Anoop Thomas Mathew
On 14 August 2012 12:04, Simon Cropper wrote: > Hi Everyone, > > I just had a great idea for a new python module. I haven't bothered > googling it or doing any research. > > I need help putting together some code; today preferably, my boss is on my > back. Can someone please contribute a functioni

[OT] A short Usenet primer (was: How to uncompress a VOB file? (Win XP))

2012-08-14 Thread Thomas 'PointedEars' Lahn
Mark Lawrence wrote: > On 14/08/2012 00:00, Xantipius wrote: >> On Aug 13, 3:40 pm, Mark Lawrence wrote: >>> On 13/08/2012 11:18, Xantipius wrote: subj >>> >>> Either >>> >>> a) write some code and when and if it fails give us a small code snippet >>> that demonstates the problem with the co

[OT] Posting under ones full name (was: How to uncompress a VOB file? (Win XP))

2012-08-14 Thread Thomas 'PointedEars' Lahn
Mark Lawrence wrote: > On 14/08/2012 04:00, Steven D'Aprano wrote: >> On Tue, 14 Aug 2012 01:34:46 +0100, Mark Lawrence wrote: >>> When did you seek my permission to call me by my forename? >> Sheesh. It's 2012, not 1812. If you sign your posts with your full name, >> you have to expect that peopl

Re: [OT] Posting under ones full name

2012-08-14 Thread Thomas 'PointedEars' Lahn
Chris Angelico wrote: > Thomas 'PointedEars' Lahn wrote: >> Probably you were asked that so that your postings could be distinguished >> from that of the other potential Marks around here. > > I have my surname in my From address, but I tend to sign my posts &

Re: [OT] Posting under ones full name

2012-08-15 Thread Thomas 'PointedEars' Lahn
Chris Angelico wrote: > Thomas 'PointedEars' Lahn wrote: >> Chris Angelico wrote: >>> I have my surname in my From address, but I tend to sign my posts >>> "ChrisA" (no relation, btw, to DaveA, though our surnames are >>> similar). That

Re: simple client data base

2012-09-03 Thread Anoop Thomas Mathew
Hi, You can make use of sqlite database also. And for the structure, you can create a single table and different columns for the fields like name, number etc. You can get more details over here. http://docs.python.org/library/sqlite3.html Thanks, Anoop Thomas Mathew atm ___ Life is short, Live

Re: simple client data base

2012-09-03 Thread Thomas 'PointedEars' Lahn
Mark R Rivet wrote: > Hello all, I am learning to program in python. I have a need to make a > program that can store, retrieve, add, and delete client data such as > name, address, social, telephone number and similar information. This > would be a small client database for my wife who has a home

Re: python docs search for 'print'

2012-09-04 Thread Thomas 'PointedEars' Lahn
David Hoese wrote: > A friend made me aware of this: > When a python beginner (2.x) quick searches for "print" on > docs.python.org, the print function doesn't even come up in the top 20 > results. The print statement isn't even listed as far as I can tell. > Is there something that can be done a

Mailergate (was: python docs search for 'print')

2012-09-05 Thread Thomas 'PointedEars' Lahn
Stephen D'Aprano wrote: > On Tue, 04 Sep 2012 20:27:38 +0200, Thomas 'PointedEars' Lahn wrote: >> ¹ The other mess they created (or allowed to be created) is this mashup >>of newsgroup and mailing list, neither of which works properly, > > In what

<    27   28   29   30   31   32   33   34   35   36   >