Re: File names with slashes [was Re: error in os.chdir]

2018-07-02 Thread Karsten Hilbert
Eryk, thanks for your to-the-point in-depth posts. Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mail.python.org/mailman/listinfo/python-list

Re: name 'aLOCK' is not defined When I add aLOCK = threading.RLock() behind if __name__ == "__main__"

2018-08-09 Thread Karsten Hilbert
On Thu, Aug 09, 2018 at 11:16:37PM +0800, xuanwu348 wrote: > The problem I meet when I add "aLOCK = threading.RLock()" to PositionB, the > program will report error "name 'aLOCK' is not defined ", You mean to say: *move*, not *add*. That is why aLock is out of scope. /python3-doc/h

Re: Re: name 'aLOCK' is not defined When I add aLOCK = threading.RLock() behind if __name__ == "__main__"

2018-08-09 Thread Karsten Hilbert
;; > But I still don't undewrstand the differenct of scopes-and-namespaces > between positionA and positionB, > > I think the variable "aLock" at these positionA or positionB are all global. When something goes wrong in an unexpected way: test your assumptions ;-) Best, Karsten

Re: Python indentation (3 spaces)

2018-10-05 Thread Karsten Hilbert
-->c() That is only incidental because the "width" of a tab stop is what you define it to be. On my system it might just be 3 spaces which would turn your argument on its head. Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mail.python.org/mailman/listinfo/python-list

regular expression problem

2018-10-28 Thread Karsten Hilbert
('') placeholders_in_line = regex.findall(rx_works, line, regex.IGNORECASE) print('found (works):') for ph in placeholders_in_line: print (ph) print ('') placeholders_in_line = regex.findall(rx_fails, line, regex.IGNORECASE) print('found (fails):') for

Re: regular expression problem

2018-10-28 Thread Karsten Hilbert
(this is the *range* from with placeholder output) >\$'# followed by '>$' I want this to work for any number of matches in any order of max-lenght or output-range inside one string. Now, why the [^<:]+? dance ? Because three levels of placeholders $<...::...::>$ $<<...::...::>>$ $<<<...::...::>>>$ need to be nestable inside each other ;-) Anyone able to help ? This seems beyond my current grasp of regular expressions. Thanks, Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mail.python.org/mailman/listinfo/python-list

Re: regular expression problem

2018-10-28 Thread Karsten Hilbert
On Sun, Oct 28, 2018 at 09:43:27PM +0100, Karsten Hilbert wrote: > Let my try to explain the expression I am actually after > (assuming .compile with re.VERBOSE): > > rx_works = ' > \$< # start of match is literal '$

Re: regular expression problem

2018-10-28 Thread Karsten Hilbert
On Sun, Oct 28, 2018 at 10:04:39PM +0100, Karsten Hilbert wrote: > - options needs to be able to contain nearly anything, except '::' This seems to contradict the "nesting" requirement, but the nesting restriction "earlier parsing passes go inside" makes it poss

Re: regular expression problem

2018-10-29 Thread Karsten Hilbert
> You could try matching the top level, for each match then match the next > level, and for each of those matches then match for the final level. So I do. > Trying to do it all in one regex is usually a bad idea. Right, I am not trying to do that. I was, however, worried that I ne

Re: regular expression problem

2018-10-29 Thread Karsten Hilbert
On Mon, Oct 29, 2018 at 12:10:04AM +0100, Thomas Jollans wrote: > On 28/10/2018 22:04, Karsten Hilbert wrote: > > - options needs to be able to contain nearly anything, except '::' > > Including > and $ ? Unfortunately, it might. Even if I assume that earlier pas

Re: regular expression problem

2018-10-29 Thread Karsten Hilbert
<s'::15>>$ > > and I was worried to make sure the second pass does not stop here: > > $<s'::15>>$ ^ Here, of course. Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mail.python.org/mailman/listinfo/python-list

Re: regular expression problem

2018-10-29 Thread Karsten Hilbert
On Sun, Oct 28, 2018 at 11:57:48PM +0100, Brian Oney wrote: > On Sun, 2018-10-28 at 22:04 +0100, Karsten Hilbert wrote: > > [^<:] > > Would a simple regex work? This brought about the solution. However, not this way: > >>> import re > >>> t = &#x

Re: regular expression problem

2018-10-29 Thread Karsten Hilbert
gt; For something like that, I'd use parsing by recursive descent. > > It might be worth looking at pyparsing. I feared as much. However, by slightly changing the boundary conditions I was able to solve the problem :-) Now I am only left with the task to search-replace a bunch of L

Re: how can I solve this problem simply and clearly

2018-11-09 Thread Karsten Hilbert
On Fri, Nov 09, 2018 at 09:45:50AM +0800, lampahome wrote: > def __Init__(): There's a typo right there. Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mail.python.org/mailman/listinfo/python-list

Aw: Issue in using "subprocess.Popen" for parsing the command output

2018-11-25 Thread Karsten Hilbert
> Kindly do the needful as am stuck with this issue from 2 days How about YOU do the needful and post code that can actually be tested. Karsten -- https://mail.python.org/mailman/listinfo/python-list

Aw: Re: Issue in using "subprocess.Popen" for parsing the command output

2018-11-25 Thread Karsten Hilbert
> Even only with "*proc.decode("utf-8")"* in the above code still it seems to > throw the error No it does not. It throws the same TYPE of error due to the same SORT of mistake you made. You need to read carefully and try to think about what you read. Karsten -- https

Re: preferences file

2019-01-25 Thread Karsten Hilbert
Convenient access to XDG Base Directory Specification variables pyxdg-open (0.2.1) - Opens URL or file in user preferred application (xdg-open replacement). Depending on UI toolkit: https://wxpython.org/Phoenix/docs/html/wx.StandardPaths.html Karsten -- GPG 40BE 5B0E C98E 1713 AFA6

Re: preferences file

2019-01-25 Thread Karsten Hilbert
don't that that's typically writable to for any odd user. Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mail.python.org/mailman/listinfo/python-list

Re: preferences file

2019-01-26 Thread Karsten Hilbert
x27;s should > be posix and have a $HOME and allow for $HOME/.local/share > and $HOME/.config Surely they should. Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mail.python.org/mailman/listinfo/python-list

Re: preferences file

2019-01-28 Thread Karsten Hilbert
do it for posix on Windows > there is the per user app stuff which i haven't sorted out > yet. > > $HOME changes per user login name change. $HOME/.config/// $HOME/.cache/// Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mail.python.org/mailman/listinfo/python-list

Re: preferences file

2019-01-28 Thread Karsten Hilbert
On Mon, Jan 28, 2019 at 10:23:31AM -0500, songbird wrote: > Karsten Hilbert wrote: > > On Mon, Jan 28, 2019 at 07:02:47AM -0500, songbird wrote: > > > >> > What about running a multi-tenant application (for multiple users who > >> > are not also system-u

Aw: Re: How to detect if a file is executable on Windows?

2019-02-19 Thread Karsten Hilbert
", I think there are tools that > allow you to do the registry lookup conveniently to see if something's > associated. As far as that goes, pretty much the same is true for UNIX (sans the registry thingy, unless you count in binfmt for that). The executable flag doesn't mean it is actua

confusion with os.chmod() and follow_symlinks

2019-02-22 Thread Karsten Hilbert
ver, works: os.chmod('/tmp/test', 0o0700) DESPITE the documentation saying os.chmod(path, mode, *, dir_fd=None, follow_symlinks=True) IOW, the default for being "True", which is certainly illogical to succeed when it is not even supported on this

Re: confusion with os.chmod() and follow_symlinks

2019-02-22 Thread Karsten Hilbert
On Fri, Feb 22, 2019 at 09:21:07PM +0100, Karsten Hilbert wrote: > Am I confused ? > > ncq@hermes:~$ python3 > Python 3.7.2+ (default, Feb 2 2019, 14:31:48) > [GCC 8.2.0] on linux > Type "help", "copyright", "credits" or &q

Re: ANN: Creating GUI Applications with wxPython

2019-02-27 Thread Karsten Hilbert
e good. Usable built-in printer support (and "network widget would be good") takes wxPython out of the equation. Karsten PS: Myself using wxPython, so no bashing there. -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mail.python.org/mailman/listinfo/python-list

Re: System Beep?

2019-03-08 Thread Karsten Hilbert
.Beep #(frequency, duration) > NameError: name 'windsound' is not defined > > Something missing in my code? No. There's too much. A 'd'. Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mail.python.org/mailman/listinfo/python-list

Re: System Beep?

2019-03-09 Thread Karsten Hilbert
ant to grab user attention - for which there is additional ways in today's toolkits, say https://wxpython.org/Phoenix/docs/html/wx.TopLevelWindow.html#wx.TopLevelWindow.RequestUserAttention Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mail.python.org/mailman/listinfo/python-list

Re: DeprecationWarning in Python 3.6 and 3.7

2019-04-02 Thread Karsten Hilbert
.6 and 3.7 with > the DeprecationWarning: > > (with Pillow==5.4.1): > https://travis-ci.org/speedy-net/speedy-net/builds/514284524 > > (with Pillow==6.0.0): > https://travis-ci.org/speedy-net/speedy-net/builds/514595887 > > What is the problem? Missing information. Karsten

Re: Fwd: PEP: add a `no` keyword as an alias for `not`

2019-08-01 Thread Karsten Hilbert
val == None` > > (so in effect it's kind of like they're checking if "something isn't there") No. Something being None does not mean something isn't there. Something isn't there if something isn't there: hasattr(object_or_scope_to_check, 

Re: Python/SQLite best practices

2019-08-05 Thread Karsten Hilbert
ll close self. > | with sqlite3.connect(path) as conn: > | cur = conn.cursor() > | cur.execute(sql_ProjectsTable) > | cur.close() > | except Error as e: > | print(e) Use of try: except: fina

Re: Python/SQLite best practices

2019-08-05 Thread Karsten Hilbert
On Mon, Aug 05, 2019 at 08:12:27PM +0200, Karsten Hilbert wrote: > Transactions involving several commands may require passing > around of connections and/or cursors, however. Among chains of python code, that is. Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B --

Aw: How execute at least two python files at once when imported?

2019-11-05 Thread Karsten Hilbert
> I want to execute at least two python files at once when imported but I dont > know how to do this. > Currently I can only import each file one after another but what i want is > each file to be imported > at the same time. Can you explain why that seems necessary ? Ka

Re: How execute at least two python files at once when imported?

2019-11-06 Thread Karsten Hilbert
er post. You stated your *desire* but not which (external) *requirement* this desire comes from. Long answer short: if you want exactly what you say then you'll have to run two separate machines and overcome the Heisenberg Principle with regards to syncronizing their runtime behaviour. Karst

py2 vs py3: zlib.adler32/crc32

2019-11-14 Thread Karsten Hilbert
Hi all, I am unsure how to solve: I use adler32/crc32 to generate integer values from data for setting up an advisory lock in PostgreSQL. The PG function pg_try_advisory_lock() https://www.postgresql.org/docs/12/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS takes two PG ints which are defin

Re: py2 vs py3: zlib.adler32/crc32

2019-11-15 Thread Karsten Hilbert
Hello MRAB, yes, like that :-) Thanks, Karsten On Thu, Nov 14, 2019 at 09:11:37PM +, MRAB wrote: > Date: Thu, 14 Nov 2019 21:11:37 + > From: MRAB > To: python-list@python.org > Subject: Re: py2 vs py3: zlib.adler32/crc32 > User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64;

Re: lxml question -- creating an etree.Element attribute with ':' in the name

2019-12-03 Thread Karsten Hilbert
On Mon, Dec 02, 2019 at 08:58:11PM -0800, gerem...@gmail.com wrote: > Date: Mon, 2 Dec 2019 20:58:11 -0800 (PST) > From: gerem...@gmail.com > To: python-list@python.org > Subject: Re: lxml question -- creating an etree.Element attribute with ':' > in the name > User-Agent: G2/1.0 > > Theanks a lot

Re: stuck on time

2019-12-07 Thread Karsten Hilbert
On Sat, Dec 07, 2019 at 05:48:00PM +, RobH wrote: What happens if your run this line: > current_time = time.strftime("%I:%M")<<< stays at this line in an interactive Python interpreter ? (after you define "time" appropriately) Karsten -- GPG

Re: stuck on time

2019-12-07 Thread Karsten Hilbert
tho the code has stalled. > > Could it be the actual font I am using which is causing the stalling. That does not sound likely because the line you are asserting it is stuck on does not output anything so where should whatever font get involved ? So, what happens if *you* run the line in an

Re: stuck on time

2019-12-07 Thread Karsten Hilbert
On Sat, Dec 07, 2019 at 08:38:20PM +, RobH wrote: > I have tried the code in Thonny and ran it Notice how I said "line", not "code". If you hope to debug anything you need to be precise. Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://

Aw: Re: stuck on time

2019-12-08 Thread Karsten Hilbert
erpreter, namely, the interactive shell built into Python itself. IOW, run just "python" (or python3) on a command line and a shell should open in which you can run the line in question. (remember to define "time" appropriately) Karsten -- https://mail.python.org/mailman/listinfo/python-list

Aw: Re: Re: stuck on time

2019-12-08 Thread Karsten Hilbert
> In an interactive interpreter: > > def print_time(): > current_time = time.strftime("%I:%M") > > returns nothing. That should be correct. What happens if you then do print_time() inside the interpreter ? Karsten -- https://mail.python.org/mailman/listinfo/python-list

Aw: Re: Re: Re: stuck on time

2019-12-08 Thread Karsten Hilbert
rns NameError: name 'print_time' is not defined Notice the "then" above ? More precisely: directly one after the other without leaving the interpreter ... Karsten -- https://mail.python.org/mailman/listinfo/python-list

Aw: Re: Re: Re: Re: stuck on time

2019-12-08 Thread Karsten Hilbert
s. However, > Running the code in a shell , it is displaying the time and now also the > date . That would prove that the code itself is not the reason why it hangs where you think it hangs. I suggest sprinkling print statements about the initial code and see what it prints to the console t

Re: Troubleshooting

2019-12-12 Thread Karsten Hilbert
On Thu, Dec 12, 2019 at 06:40:32PM -0600, catherine morris wrote: > Good evening, > > My son is trying to download python 3.8.0 on my PC, which has Windows 10, > and it won't install properly. I'm not tech savvy and have no idea where to > start. No offense, but, how o

Re: to continue python

2020-01-10 Thread Karsten Hilbert
Sure, by all means ! -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mail.python.org/mailman/listinfo/python-list

Re: Confusing textwrap parameters, and request for RE help

2020-03-24 Thread Karsten Hilbert
On Tue, Mar 24, 2020 at 08:08:31PM +1100, Chris Angelico wrote: > Well um... yes. I think we know that hyphens do indicate word-split > points. That's not really in question. I know you don't mean it like that, but it sounds equally future-proof like "all text is ASCII&qu

Re: Confusing textwrap parameters, and request for RE help

2020-03-24 Thread Karsten Hilbert
t. Ellipsised URLs plus footnote would work but don't lend themselves to textwrap() very well (but perhaps to each individual application of textwrap()). Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mail.python.org/mailman/listinfo/python-list

Re: SPECIALS CHARACTERS

2020-04-15 Thread Karsten Hilbert
hon3-fontparts - API for interacting with the parts of fonts python3-freetype - Freetype Python bindings for Python 3 python3-nototools - font support tools from the Noto Fonts project python3-ufoprocessor - Process and generate Unified Font Object (UFO) files Karsten -- GPG 40BE 5B0E C98E 1713 A

Aw: Python Curses Programming HowTo -reviewers?

2020-06-16 Thread Karsten Hilbert
ly. Will this be available somewhere ? Thanks, Karsten -- https://mail.python.org/mailman/listinfo/python-list

Aw: Re: Another 2 to 3 mail encoding problem

2020-08-27 Thread Karsten Hilbert
ndling libraries need to be able to > pass extended characters through without errors. Well, '\ufeff' is not a *character* at all in much of any sense of that word in unicode. It's a marker. Whatever puts it into the stream is wrong. I guess the best one can (and should) do is

Aw: Re: Another 2 to 3 mail encoding problem

2020-08-27 Thread Karsten Hilbert
> Because of this, the Python 3 str type is not suitable to store an email > message, since it insists on the string being Unicode encoded, I should greatly appreciate to be enlightened as to what a "string being Unicode encoded" is intended to say ? Thanks, Karsten -- https:/

Aw: Re: Re: Another 2 to 3 mail encoding problem

2020-08-27 Thread Karsten Hilbert
at a technically abstract level while I assumed the "encoded" is meant to somehow reference ''.encode() and friends. Karsten -- https://mail.python.org/mailman/listinfo/python-list

Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Karsten Hilbert
above > _assumes_ UTF-8 because that is the default for bytes.decode, and if > that is _not_ what is in the bytes objects you will get mojibake. > > Because a lot of stuff is "mostly ASCII", this is the kind of bug which > can lurk until much later when you have less usual

Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Karsten Hilbert
27;tolerantly' like Python 2 used to? It sure should be possible but it will require *explicit* en/decode()s in more places than before because AFAICT there's less impliciteness as to which encoding to apply (regardless of whether it applies). Karsten -- https://mail.python.org/mailman/listinfo/python-list

Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Karsten Hilbert
ear. If we simply want to stuff a file with bytes and call that mbox we should do so: drop the bytes into a file and call it an mbox file. Karsten -- https://mail.python.org/mailman/listinfo/python-list

Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-29 Thread Karsten Hilbert
t to append that to a file (which happens to be an mbox). Can't you "just do that" ? IOW, read the bytes, open the file, dump the bytes, close the file ? Karsten -- https://mail.python.org/mailman/listinfo/python-list

Aw: Re: Video file to subtitles file

2020-08-29 Thread Karsten Hilbert
e your objective to get better help. Karsten -- https://mail.python.org/mailman/listinfo/python-list

Aw: Re: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-29 Thread Karsten Hilbert
like ">From:" or > ">>From:" depending on which mailbox format is being used. There may be > a few other small details that needs to happen to. I see, thanks. Karsten -- https://mail.python.org/mailman/listinfo/python-list

Re: Post request and encoding

2020-11-02 Thread Karsten Hilbert
ng > > > > request.encode('utf-8') > > > > before sending the request but it has not lead to a different result. You would have needed to do: request = request.encode('utf-8') because .encode() does not operate in-place. Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mail.python.org/mailman/listinfo/python-list

Re: Post request and encoding

2020-11-02 Thread Karsten Hilbert
at earlier mail ... Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mail.python.org/mailman/listinfo/python-list

Aw: Re: How do you find what exceptions a class can throw?

2020-12-20 Thread Karsten Hilbert
because the server is busy. So what you are looking for is the form of a potential "timeout exception" (say, exception name) ? Provoke one and have a look. Then catch what you saw. Karsten -- https://mail.python.org/mailman/listinfo/python-list

Aw: Re: Re: How do you find what exceptions a class can throw?

2020-12-20 Thread Karsten Hilbert
eout> > > Programmers don't guess... I did not suggest guessing. I suggested gathering scientific evidence by running a controlled experiment. Or should I say "Programmers don't trust..." ? Karsten -- https://mail.python.org/mailman/listinfo/python-list

Aw: Re: Re: Re: How do you find what exceptions a class can throw?

2020-12-20 Thread Karsten Hilbert
rly wish you that your hope becomes reality within your lifetime. Karsten -- https://mail.python.org/mailman/listinfo/python-list

check if class really implements api?

2006-01-03 Thread Karsten W.
least all function names of the API are defined by the class and if their parameter lists fit the API? A way to test this would save me a lot of time.. Kind regards, Karsten. -- http://mail.python.org/mailman/listinfo/python-list

Re: check if class really implements api?

2006-01-04 Thread Karsten W.
Terry Hancock schrieb: > You want: > [...] > Zope 3.x: > zope.interface.verify > This is exactly what I was looking for! There is a function verifyClass and there is a TestCase for verify.py which teaches how to use it. Thanks a lot! Karsten. -- http://mail.python.org/mailman/

Re: recommendations for personal journaling application

2006-10-08 Thread Karsten W.
But maybe you want let your script create some SQL statements and use the pysqlite module to store and search the data. Kind regards, Karsten. -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading a Microsoft access file.

2006-10-18 Thread Karsten W.
You could access the file via the odbc interface. There is a module odbc which comes with the windows package, iirc. Regards, Karsten. [EMAIL PROTECTED] wrote: > I googled for the answer but all the answer seem to imply that you > have to have Access installed on your system. I have a fil

Re: wxGlade, wxPython.... pyOpenGL wxWidget?

2006-02-26 Thread Karsten W.
PyOpenGL comes with a Tkinter widget for OpenGL, and searching google "wxwidgets opengl" yields http://www.wxwidgets.org/opengl.htm Kind regards, Karsten. -- http://mail.python.org/mailman/listinfo/python-list

Re: The Modernization of Emacs

2007-06-21 Thread Karsten Wutzke
MXing: "Geek of the week!" Karsten -- http://mail.python.org/mailman/listinfo/python-list

py2exe, command line parameter problem

2007-08-09 Thread Karsten W.
x27;s python 2.3 on WinXp with py2exe 0.6.6. How can I debug this behaviour? Any hint appreciated, Karsten. -- http://mail.python.org/mailman/listinfo/python-list

Several images onto one 2D-plot in matplotlib?

2007-04-12 Thread karsten . borgwardt
Hi! I have got the following problem: I want to plot a 2D-function in matplotlib, and then I want to insert (small) png-Images at certain locations within the plot. Any suggestions how to do that? Thanks a lot! yggobk -- http://mail.python.org/mailman/listinfo/python-list

problem with logging exceptions with non-ASCII __str__ result

2008-01-14 Thread Karsten Hilbert
lt encoding isn't really an option as it is advocated against and would have to be made to work reliably on other users machines. One could, of course, write code to specifically check for this condition and manually pre-convert the message string to unicode but that seems not as things should be. How can I cleanly handle this situation ? Should the logging module internally use an encoding gotten from the locale module rather than the default string encoding ? Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346 -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating A Tuple From A List, Adding To Tuple As You Do

2008-06-05 Thread Karsten Heymann
I need to pass this list to a list control in a > wxWidgets application. In order to do that, I need to pass in a list > like this: > > [ ('Baltimore', ''), ('Birmingham', ''), ('Cincinnati', ''), > ('Cleveland', ''), ('LosAngeles', '') ] That's not hard: [ (x,'') for x in DC_List ] Yours Karsten -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating A Tuple From A List, Adding To Tuple As You Do

2008-06-05 Thread Karsten Heymann
Just iterate over the list itself: for DC in DC_List: # do something with DC. Yours Karsten -- http://mail.python.org/mailman/listinfo/python-list

Re: Summing a 2D list

2008-06-13 Thread Karsten Heymann
.. except KeyError:" instead of the "if") * list approach: 0.9s BTW this was inspired by the book "Programming Pearls" I read some years ago where a similar approach saved some magnitudes of time (using a bit field instead of a list to store reserved/free phone numbers IIRC). Yours, Karsten -- http://mail.python.org/mailman/listinfo/python-list

Re: Summing a 2D list

2008-06-13 Thread Karsten Heymann
Hi Björn, "BJörn Lindqvist" <[EMAIL PROTECTED]> writes: > On Fri, Jun 13, 2008 at 2:12 PM, Karsten Heymann > <[EMAIL PROTECTED]> wrote: >> summed_up={} >> for user,vote in pairs: >> if summed_up.has_key(user): >>summed_up[user]+=vote >&

Re: Summing a 2D list

2008-06-13 Thread Karsten Heymann
~2s dict + "try": ~4s I've posted the (very rough) code to dpaste: http://dpaste.com/hold/56468/ Yours Karsten -- http://mail.python.org/mailman/listinfo/python-list

Re: Summing a 2D list

2008-06-13 Thread Karsten Heymann
like dictionaries, what's the gain you get from using it in this corner case? Yours, Karsten -- http://mail.python.org/mailman/listinfo/python-list

Re: Summing a 2D list

2008-06-14 Thread Karsten Heymann
Maric Michaud <[EMAIL PROTECTED]> writes: > Le Friday 13 June 2008 17:55:44 Karsten Heymann, vous avez écrit : >> Maric Michaud <[EMAIL PROTECTED]> writes: >> > So, writing C in python, which has dictionnary as builtin type, >> > should be considered "

problem with floats and calculations

2010-02-14 Thread Karsten Goen
home does the same and is much smaller and slower. thx in advance Karsten -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with floats and calculations

2010-02-14 Thread Karsten Goen
also this doesn't help, there are still errors in the accuracy. Isn't there a perfect way to do such calculations? Karsten Goen wrote: > > hey all, > > I got a problem with floats and calculations. I made an mini-application > where > > you get random questions wi

Extending objects by a method?

2010-07-15 Thread Karsten Wutzke
ch I'd like to avoid. Karsten -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending objects by a method?

2010-07-15 Thread Karsten Wutzke
Small correction: I probably have to add a method to a class, so that every object instantiated not by me has the desired functionality. Karsten -- http://mail.python.org/mailman/listinfo/python-list

Code generator and visitor pattern

2010-07-15 Thread Karsten Wutzke
o handle source code generation? Karsten -- http://mail.python.org/mailman/listinfo/python-list

Re: Code generator and visitor pattern

2010-07-15 Thread Karsten Wutzke
On 15 Jul., 20:28, Thomas Jollans wrote: > On 07/15/2010 07:58 PM, Karsten Wutzke wrote: > > > Hello, > > > this is obviously a Python OO question: > > > Since Python isn't stringly typed, > > I expect this is an innocent typo, and you mean strictly. >

Re: Code generator and visitor pattern

2010-07-15 Thread Karsten Wutzke
> > Yes, typo, I meant strictly. > Damn, I mean strongly. At least not for identifying which methods to call depending on the type/s. Karsten -- http://mail.python.org/mailman/listinfo/python-list

Visitor pattern and separating iteration

2010-07-22 Thread Karsten Wutzke
se add a parameter to handleMethod which would be the generated code for the statements, but is that design of any good use then? I'm rather tempted to ditch the idea of separating iteration and code generation, but then the use of the visitor pattern becomes more and more questionable. What is it I'm missing? Karsten -- http://mail.python.org/mailman/listinfo/python-list

Re: Visitor pattern and separating iteration

2010-07-22 Thread Karsten Wutzke
t; >             i += 1 > And please don't comment on the code itself, as I'm just starting to learn the Python API. The above should be modifierString = " ".join(method.getModifiers()) Thanks Karsten -- http://mail.python.org/mailman/listinfo/python-list

Re: Visitor pattern and separating iteration

2010-07-23 Thread Karsten Wutzke
On 22 Jul., 22:25, Ian wrote: > Hi Karsten, > > On 22/07/2010 12:03, Karsten Wutzke wrote:> What is it I'm missing? > > I think you are making it more complicated than it really is. > > The visitor pattern is about bringing all the little bits that would > otherw

Constructor call in the same class?

2010-07-25 Thread Karsten Wutzke
rs, "enum", name, superInterfaces, annotations, innerClasses, properties, methods) ? I get 'CascadeType': Enum("javax.persistence.CascadeType"), NameError: name 'Enum' is not defined What's wrong with calling a constructor in a dict initializer? How do I solve this? Karsten -- http://mail.python.org/mailman/listinfo/python-list

Re: Constructor call in the same class?

2010-07-25 Thread Karsten Wutzke
> > You have to create your dict somewhere else. You can either set it from > outside: > > class Enum(RootFragment): >     ... > > Enum._jpaTypes = { ... } > THANKS for the quick help. Karsten -- http://mail.python.org/mailman/listinfo/python-list

Contains/equals

2010-08-19 Thread Karsten Wutzke
Hello, I have an object which has a list of other complex objects. How do I best achieve a complex "contains" comparison based on the object's class? In Java terms, I'm looking for an equivalent to equals(Object) in Python. Does a similar thing exist? Directions appreciate

Re: Contains/equals

2010-08-19 Thread Karsten Wutzke
On Aug 19, 4:47 pm, Peter Otten <__pete...@web.de> wrote: > Karsten Wutzke wrote: > > I have an object which has a list of other complex objects. How do I > > best achieve a complex "contains" comparison based on the object's > > class? In Java terms, I&#x

Re: [DB-SIG] dbf files and compact indices

2010-09-18 Thread Carl Karsten
On Sat, Sep 18, 2010 at 11:16 AM, Ethan Furman wrote: > Carl Karsten wrote: >> >> On Sat, Sep 18, 2010 at 1:11 AM, Ethan Furman wrote: >> >>> Does anybody have any pointers, tips, web-pages, already written >>> routines, >>> etc, on parsing *.cdx

Re: [DB-SIG] dbf files and compact indices

2010-09-18 Thread Carl Karsten
On Sat, Sep 18, 2010 at 11:23 PM, Ethan Furman wrote: > Vernon Cole wrote: >> >> Ethan: >> I cannot see where you mentioned your operating system, I am assuming >> Windows. >> >> Perhaps you have already investigated this ... I have no way to test it >> ... but you might try: >> ADO can access alm

Cgi File Upload without Form

2007-04-27 Thread Karsten . G . Weinert
I have to use does not support FTP. Any hint appreciated, kind regards, Karsten. -- http://mail.python.org/mailman/listinfo/python-list

Re: Cgi File Upload without Form

2007-04-30 Thread Karsten . G . Weinert
Thanks for your replies, however I think urlllib can not help me here. I have control over the server side (I can write a cgi-script in python), but I have very little control on the client side (I have to use VBA). Kind regards, Karsten. -- http://mail.python.org/mailman/listinfo/python-list

Re: Cgi File Upload without Form

2007-04-30 Thread Karsten . G . Weinert
On 30 Apr., 15:51, "Dave Borne" <[EMAIL PROTECTED]> wrote: > > Since I want to upload the data programmatically, a form based > > solution is not good. > > Karsten, > Could you explain this statement? When I want to move data to a > server in a CGI envir

Re: Cgi File Upload without Form

2007-04-30 Thread Karsten . G . Weinert
OK, I think I have a simple solution now. I am going to use FTP in my VBA-Client (it's possible) and don't need to do any server-side programming. Kind regards, Karsten. -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP668 / pipx and "--editable" installs

2023-09-16 Thread Karsten Hilbert via Python-list
Am Sat, Sep 16, 2023 at 02:17:19PM +1200 schrieb Rimu Atkinson via Python-list: > Everyone uses virtual environments. Umm, like, no. Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mail.python.org/mailman/listinfo/python-list

<    1   2   3   >