Re: GNU gettext: Print string translated and untranslated at the same time

2023-08-18 Thread Barry via Python-list
e a big deal if it is only one word. The key to solving this to separate the parsing of the string into the .po file and its translation. def i18n(s): return s msg = i18n(‘my message’) print(_(msg)) print(msg) Now you tell the xgettex, pygettext etc, to parse to use “i18n” to find strin

Re: GNU gettext: Print string translated and untranslated at the same time

2023-08-17 Thread Greg Ewing via Python-list
On 17/08/23 7:10 pm, c.bu...@posteo.jp wrote: def foobar(translate):     if not translate:     # I try to mask the global _() builtins-function     def _(txt):     return txt     return _('Hello') This causes _ to become a local that is left undefined on one branch of the

Re: GNU gettext: Print string translated and untranslated at the same time

2023-08-17 Thread Mirko via Python-list
Am 17.08.23 um 21:17 schrieb c.buhtz--- via Python-list: Hello Mirko, thanks for reply. Am 17.08.2023 18:19 schrieb Mirko via Python-list: You could solve it by defining _() locally like so: def foobar(translate):     _ = gettext.gettext I see no way to do that. It is not the "class based A

Re: GNU gettext: Print string translated and untranslated at the same time

2023-08-17 Thread c.buhtz--- via Python-list
Hello Mirko, thanks for reply. Am 17.08.2023 18:19 schrieb Mirko via Python-list: You could solve it by defining _() locally like so: def foobar(translate): _ = gettext.gettext I see no way to do that. It is not the "class based API" of gettext installing _() into the builtins namespace

Re: GNU gettext: Print string translated and untranslated at the same time

2023-08-17 Thread Dieter Maurer via Python-list
c.bu...@posteo.jp wrote at 2023-8-17 07:10 +: >I want to display one string in its original source (untranslated) >version and in its translated version site by site without duplicating >the string in the python source code? You could try to translate into an unknown language: this should give

Re: GNU gettext: Print string translated and untranslated at the same time

2023-08-17 Thread Richard Damon via Python-list
the string in > the python source code? > It wouldn't be a big deal if it is only one word. > >print('The translated string "{}" is originally "{}".'.format(_('Hello'), > 'Hello')) > > But in my situation it is a multi

Re: GNU gettext: Print string translated and untranslated at the same time

2023-08-17 Thread Dieter Maurer via Python-list
c.bu...@posteo.jp wrote at 2023-8-17 07:10 +: >I want to display one string in its original source (untranslated) >version and in its translated version site by site without duplicating >the string in the python source code? Is it an option for you to replace the `gettext` binding by `zope.i18

Re: GNU gettext: Print string translated and untranslated at the same time

2023-08-17 Thread Mirko via Python-list
ow or if there is an alternative approach. However, you might not need this, because the following seems to work for me: def orig_and_trans(msg): return (_(msg), msg) print('The translated string "{}" is originally "{}".'.format(*orig_and_trans("hello"))) -- https://mail.python.org/mailman/listinfo/python-list

GNU gettext: Print string translated and untranslated at the same time

2023-08-17 Thread c.buhtz--- via Python-list
X-Post: https://stackoverflow.com/q/76913082/4865723 I want to display one string in its original source (untranslated) version and in its translated version site by site without duplicating the string in the python source code? It wouldn't be a big deal if it is only one word.

Re: Python 3.7+ cannot print unicode characters when output is redirected to file - is this a bug?

2022-11-13 Thread Eryk Sun
On 11/13/22, Jessica Smith <12jessicasmit...@gmail.com> wrote: > Consider the following code ran in Powershell or cmd.exe: > > $ python -c "print('└')" > └ > > $ python -c "print('└')" > test_file.txt > Traceback (most recent ca

Re: Python 3.7+ cannot print unicode characters when output is redirected to file - is this a bug?

2022-11-13 Thread Thomas Passin
On 11/13/2022 9:49 AM, Jessica Smith wrote: Consider the following code ran in Powershell or cmd.exe: $ python -c "print('└')" └ $ python -c "print('└')" > test_file.txt Traceback (most recent call last): File "", line 1, in File &quo

Re: Python 3.7+ cannot print unicode characters when output is redirected to file - is this a bug?

2022-11-13 Thread Barry
> On 13 Nov 2022, at 14:52, Jessica Smith <12jessicasmit...@gmail.com> wrote: > > Consider the following code ran in Powershell or cmd.exe: > > $ python -c "print('└')" > └ > > $ python -c "print('└')" > test_file.tx

Python 3.7+ cannot print unicode characters when output is redirected to file - is this a bug?

2022-11-13 Thread Jessica Smith
Consider the following code ran in Powershell or cmd.exe: $ python -c "print('└')" └ $ python -c "print('└')" > test_file.txt Traceback (most recent call last): File "", line 1, in File "C:\Program Files\Python38\lib\encodings\cp125

Re: ANN: pdfposter 0.8.1 - scale and tile PDF pages to print on multiple sheets

2022-11-04 Thread jkn
On Friday, November 4, 2022 at 6:21:55 PM UTC, Hartmut Goebel wrote: > I'm pleased to announce pdftools.pdfposter 0.8.1, a tool to scale and > tile PDF images/pages to print on multiple pages. > > :Homepage: https://pdfposter.readthedocs.io/ > :Author:Hartmut Goebel

ANN: pdfposter 0.8.1 - scale and tile PDF pages to print on multiple sheets

2022-11-04 Thread Hartmut Goebel
I'm pleased to announce pdftools.pdfposter 0.8.1, a tool to scale and tile PDF images/pages to print on multiple pages. :Homepage:  https://pdfposter.readthedocs.io/ :Author:    Hartmut Goebel :License:   GNU Public License v3 or later (GPL-3.0-or-later) :Quick Installation:     pip insta

Re: Function to Print a nicely formatted Dictionary or List?

2022-06-09 Thread Dan Stromberg
On Thu, Jun 9, 2022 at 1:52 PM Michael F. Stemper wrote: > On 09/06/2022 12.52, Chris Angelico wrote: > > On Fri, 10 Jun 2022 at 03:44, Dave wrote: > > >> Before I write my own I wondering if anyone knows of a function that > will print a nicely formatted diction

Re: Function to Print a nicely formatted Dictionary or List?

2022-06-09 Thread Grant Edwards
On 2022-06-09, Dennis Lee Bieber wrote: > However, the Gmane list<>NNTP gateway server DOES make the tutor > list available to news readers (unfortunately, the comp.lang.python > <> list <> Gmane has been read-only since last fall (unless things > have changed recently) so I'm stuck with the spam

Re: Function to Print a nicely formatted Dictionary or List?

2022-06-09 Thread Cameron Simpson
On 09Jun2022 21:35, Dave wrote: >I quite like the format that JSON gives - thanks a lot! Note that JSON output is JavaScript notation, not Python. The `pprint` module (which has `pprint` and `pformat` functions) outputs Python notation. If you're just writing for human eyes, JSON is fine, thou

Re: Function to Print a nicely formatted Dictionary or List?

2022-06-09 Thread Michael F. Stemper
On 09/06/2022 12.52, Chris Angelico wrote: On Fri, 10 Jun 2022 at 03:44, Dave wrote: Before I write my own I wondering if anyone knows of a function that will print a nicely formatted dictionary? By nicely formatted I mean not all on one line! https://docs.python.org/3/library

Re: Function to Print a nicely formatted Dictionary or List?

2022-06-09 Thread Friedrich Rentsch
of a function that will print a nicely formatted dictionary? By nicely formatted I mean not all on one line! Cheers Dave -- https://mail.python.org/mailman/listinfo/python-list

Re: Function to Print a nicely formatted Dictionary or List?

2022-06-09 Thread Dave
ot;pprint" and "json". > > main.py > > import json > d ={ 1:2, 'alpha': 'beta' } > print( json.dumps( d, indent=4 )) > > output > > { >"1": 2, >"alpha": "beta" > } > -- https://mail.python.org/mailman/listinfo/python-list

Re: Function to Print a nicely formatted Dictionary or List?

2022-06-09 Thread Mats Wichmann
On 6/9/22 11:52, Chris Angelico wrote: > On Fri, 10 Jun 2022 at 03:44, Dave wrote: >> >> Hi, >> >> Before I write my own I wondering if anyone knows of a function that will >> print a nicely formatted dictionary? >> >> By nicely format

Re: Function to Print a nicely formatted Dictionary or List?

2022-06-09 Thread Avi Gross via Python-list
. Consider using a search engine before posting. Throw in a few words like  "python pretty print dictionary function" and refine that if it does not get you immediate results. It is free and easy and does not waste time for so many others who already know or don't care. And conside

Re: Function to Print a nicely formatted Dictionary or List?

2022-06-09 Thread Chris Angelico
On Fri, 10 Jun 2022 at 03:44, Dave wrote: > > Hi, > > Before I write my own I wondering if anyone knows of a function that will > print a nicely formatted dictionary? > > By nicely formatted I mean not all on one line! > https://docs.python.org/3/library/pprint.html f

Re: Function to Print a nicely formatted Dictionary or List?

2022-06-09 Thread MRAB
On 2022-06-09 11:43, Dave wrote: Hi, Before I write my own I wondering if anyone knows of a function that will print a nicely formatted dictionary? By nicely formatted I mean not all on one line! It's called "pretty-printing". Have a look at the 'pprint' module. -

Re: Function to Print a nicely formatted Dictionary or List?

2022-06-09 Thread Larry Martell
On Thu, Jun 9, 2022 at 11:44 AM Dave wrote: > > Hi, > > Before I write my own I wondering if anyone knows of a function that will > print a nicely formatted dictionary? > > By nicely formatted I mean not all on one line! >>> import json >>> d = {&#x

Function to Print a nicely formatted Dictionary or List?

2022-06-09 Thread Dave
Hi, Before I write my own I wondering if anyone knows of a function that will print a nicely formatted dictionary? By nicely formatted I mean not all on one line! Cheers Dave -- https://mail.python.org/mailman/listinfo/python-list

Re: how to distinguish return from print()

2022-05-25 Thread Meredith Montgomery
r...@zedat.fu-berlin.de (Stefan Ram) writes: > Meredith Montgomery writes: > ... >>def f(x): >>return x + 1 > ... >>>>> print("hello") > > To me, what would make more sense would be: > > Teacher: > > |>>>

Re: F-string usage in a print()

2022-05-24 Thread Cameron Simpson
the common formatting method was the % operator like C's printf() format. You could do stuff like this: print("%s: length is %d items" % (thing, len(thing))) which would print something like: Thing5: length is 12 items Ignore the print() itself, that's just how yo

Re: F-string usage in a print()

2022-05-24 Thread Cameron Simpson
> # future_value += monthly_interest_amount > # display the result > print(f"Year = ", years + f"Future value = \n", future_value) > >When joining a string with a number, use an f-string otherwise, code a >str() because a implicit convert of an int to str causes a >

Re: F-string usage in a print()

2022-05-24 Thread Mats Wichmann
thly_interest_rate ># future_value += monthly_interest_amount ># display the result >print(f"Year = ", years + f"Future value = \n", future_value)When joining > a string with a number, use an f-string otherwise, code a str() because a > implicit convert of an int to

Re: F-string usage in a print()

2022-05-24 Thread Paul Bryan
Try something like: print(f"Year = {years}, Future value = {future_value}") On Tue, 2022-05-24 at 21:14 +, Kevin M. Wilson via Python-list wrote: > future_value = 0 > for i in range(years): > # for i in range(months): >    future_value += monthly_investment >

Re: F-string usage in a print()

2022-05-24 Thread MRAB
+= monthly_interest_amount # display the result print(f"Year = ", years + f"Future value = \n", future_value)When joining a string with a number, use an f-string otherwise, code a str() because a implicit convert of an int to str causes a TypeError!Well...WTF! Am I no

F-string usage in a print()

2022-05-24 Thread Kevin M. Wilson via Python-list
future_value = 0 for i in range(years): # for i in range(months): future_value += monthly_investment future_value = round(future_value, 2) # monthly_interest_amount = future_value * monthly_interest_rate # future_value += monthly_interest_amount # display the result print(f"

Re: how to distinguish return from print()

2022-05-22 Thread Chris Angelico
On Mon, 23 May 2022 at 09:23, Stefan Ram wrote: > You are making it extra hard by wording the question in this > way. "What's the difference between the moon and liberty?". Uh ... > > It's much easier to explain the moon and liberty separately. "You can't tell the difference between a lump

how to distinguish return from print()

2022-05-22 Thread Meredith Montgomery
Students seeing a programming language for the first time and using Python's REPL for the first time have asked me what is the difference between a return statement and a print() call. They got a point. --8<---cut here---start->8--- def f(x): r

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-12-21 Thread boB Stepp
On 21/12/22 12:14PM, Python wrote: On 30/11/2021 12.31, Cameron Simpson wrote: On 30Nov2021 10:59, DL Neil wrote: ... I've nominated Kitty as Fedora's default terminal. We'll see how it goes with work-loads beyond raising the flag... I'd like to hear how that goes down the track. If I find

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-12-21 Thread dn via Python-list
On 30/11/2021 12.31, Cameron Simpson wrote: > On 30Nov2021 10:59, DL Neil wrote: ... >> I've nominated Kitty as >> Fedora's default terminal. We'll see how it goes with work-loads beyond >> raising the flag... > > I'd like to hear how that goes down the track. If I find myself on a > Linux desk

Re: PyCharm settings - per: print('\N{flag: Mauritius}') not supported in py3.9

2021-12-21 Thread Abdur-Rahmaan Janhangeer
Yet another unicode issue XD Kind Regards, Abdur-Rahmaan Janhangeer about | blog github Mauritius -- https://mail.python.org/mailman/listinfo/python-list

PyCharm settings - per: print('\N{flag: Mauritius}') not supported in py3.9

2021-12-01 Thread dn via Python-list
On 29/11/2021 10.08, dn via Python-list wrote: > On 29/11/2021 02.18, Chris Angelico wrote: >> On Mon, Nov 29, 2021 at 12:10 AM Abdur-Rahmaan Janhangeer >> wrote: >> >> Flags are actually constructed from multiple codepoints. What you want >> is to insert each codepoint separately. You can see the

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-29 Thread Cameron Simpson
On 30Nov2021 10:59, DL Neil wrote: >Fedora names it as rxvt-unicode. >Installed v9.26 >Text is too small for these old eyes. Fair enough. There are resources, but not worth it unless you really want the app. >No menu bar and no context menus. Um, yes. The (hardware, serial) terminals we had a

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-29 Thread dn via Python-list
On 30/11/2021 10.19, Cameron Simpson wrote: > On 29Nov2021 22:25, DL Neil wrote: Probably a font issue. Not many fonts support the flags. >>> >>> Agree about the font support. Some terminal emulators make an effort to >>> have fallback fonts for when your preferred font lacks a glyph. IIRC >>

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-29 Thread Cameron Simpson
On 29Nov2021 22:25, DL Neil wrote: >>> Probably a font issue. Not many fonts support the flags. >> >> Agree about the font support. Some terminal emulators make an effort to >> have fallback fonts for when your preferred font lacks a glyph. IIRC >> urxvt is such a terminal on Linux. > >Not sure ab

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-29 Thread dn via Python-list
On 29/11/2021 12.06, Cameron Simpson wrote: > On 29Nov2021 09:19, Chris Angelico wrote: >> On Mon, Nov 29, 2021 at 8:10 AM dn via Python-list >> wrote: >>> However, when trying the above, with our local flag in (Fedora Linux, >>> Gnome) Terminal or PyCharm's Run terminal; the two letters "N" and

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-28 Thread Cameron Simpson
On 29Nov2021 09:19, Chris Angelico wrote: >On Mon, Nov 29, 2021 at 8:10 AM dn via Python-list > wrote: >> However, when trying the above, with our local flag in (Fedora Linux, >> Gnome) Terminal or PyCharm's Run terminal; the two letters "N" and "Z" >> are shown with dotted-outlines. Similarly, th

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-28 Thread Chris Angelico
On Mon, Nov 29, 2021 at 8:10 AM dn via Python-list wrote: > However, when trying the above, with our local flag in (Fedora Linux, > Gnome) Terminal or PyCharm's Run terminal; the two letters "N" and "Z" > are shown with dotted-outlines. Similarly, the Mauritius' flag is shown > as "M" and "U". > >

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-28 Thread dn via Python-list
On 29/11/2021 02.18, Chris Angelico wrote: > On Mon, Nov 29, 2021 at 12:10 AM Abdur-Rahmaan Janhangeer > wrote: > > Flags are actually constructed from multiple codepoints. What you want > is to insert each codepoint separately. You can see them listed in the > second column of the table you link

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-28 Thread Abdur-Rahmaan Janhangeer
Greetings, But why is it so? -- https://mail.python.org/mailman/listinfo/python-list

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-28 Thread Chris Angelico
On Mon, Nov 29, 2021 at 12:29 AM Abdur-Rahmaan Janhangeer wrote: > > Greetings, > > I get you but why do the short names work for some and not for > others? > Which ones work? The ones that can be identified by a single codepoint? Look at the specification for Python's \N escapes. ChrisA -- htt

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-28 Thread Abdur-Rahmaan Janhangeer
Greetings, I get you but why do the short names work for some and not for others? Kind Regards, Abdur-Rahmaan Janhangeer about | blog github Mauritius -- https://mail.python.org/mailman/list

Re: print('\N{flag: Mauritius}') not supported in py3.9

2021-11-28 Thread Chris Angelico
On Mon, Nov 29, 2021 at 12:10 AM Abdur-Rahmaan Janhangeer wrote: > I found the whole CLDR short name here: > https://unicode.org/emoji/charts/full-emoji-list.html > > However when i do > > >>> print('\N{flag: Mauritius}') > File &q

print('\N{flag: Mauritius}') not supported in py3.9

2021-11-28 Thread Abdur-Rahmaan Janhangeer
Mike Driscoll printed this on Twitter >>> print('\N{Sauropod}') 🦕 Using py3.9 i got the above. I found the whole CLDR short name here: https://unicode.org/emoji/charts/full-emoji-list.html However when i do >>> print('\N{flag: Mauritius}') File &q

Re: Beginner problem, please help. Building a simple menu + lists , cannot print list

2021-10-11 Thread Chris Angelico
On Tue, Oct 12, 2021 at 9:13 AM Felix Kjellström wrote: > > Hello! Please see the link to the code I have uploaded to my account at > replit.com > > https://replit.com/join/lftxpszwrv-felixkjellstrom Unfortunately, it's not public. Are you able to put the code on GitHub as a repository or gist,

Beginner problem, please help. Building a simple menu + lists , cannot print list

2021-10-11 Thread Felix Kjellström
Hello! Please see the link to the code I have uploaded to my account at replit.com https://replit.com/join/lftxpszwrv-felixkjellstrom Problem: When you select the menu option "Add buyer", you can enter three values. See code line 5, "def Add_buyer ():" Then, you use the arrow keys to select t

Re: Neither pdb or print() displays the bug [FIXED]

2021-06-08 Thread Rich Shepard
On Tue, 1 Jun 2021, Rich Shepard wrote: I'm stuck with neither approach (pdb, print()) working. I moved the database code to a separate module, datasource.py, and when I run the activitytypes.py module (using pdb and having entered print() statements at various places in both the datasourc

Re: Neither pdb or print() displays the bug

2021-06-06 Thread Rich Shepard
On Sun, 6 Jun 2021, Fabio Zadrozny wrote: Hint: you should be able to use https://pypi.org/project/pytest-qt/ to unit-test a PyQt application... Fabio, Thank you for confirming this. I hadn't remembered the name so your URL is really helpful. Regards, Rich -- https://mail.python.org/mailman

Re: Neither pdb or print() displays the bug

2021-06-06 Thread Fabio Zadrozny
Em qua., 2 de jun. de 2021 às 09:34, Rich Shepard escreveu: > On Wed, 2 Jun 2021, Peter Otten wrote: > > > Do you have unit tests? Those are an excellent tool to ensure that the > > components of an application work as expected and that those components > > have well-defined interfaces. Debugging

Re: Neither pdb or print() displays the bug

2021-06-02 Thread Rich Shepard
On Wed, 2 Jun 2021, Peter Otten wrote: Do you have unit tests? Those are an excellent tool to ensure that the components of an application work as expected and that those components have well-defined interfaces. Debugging a failing unittest is usually easier than to debug a complex application.

Re: Neither pdb or print() displays the bug

2021-06-02 Thread Peter Otten
On 01/06/2021 23:32, Rich Shepard wrote: On Tue, 1 Jun 2021, Ethan Furman wrote: Well, you only had two logging statements in that code -- logging is like print: if you want to see it, you have to call it: Ethan, Got it, thanks. I believe Do you have unit tests? Those are an excellent

Re: Neither pdb or print() displays the bug

2021-06-01 Thread Alan Gauld via Python-list
On 01/06/2021 21:18, Rich Shepard wrote: > On Sun, 30 May 2021, Cameron Simpson wrote: > >> I've only just started with pdb. As of Python 3.7 there's a builtin >> function named breakpoint() which drops you into the debugger. > I'm stuck with neither appro

Re: Neither pdb or print() displays the bug

2021-06-01 Thread Rich Shepard
On Tue, 1 Jun 2021, Dennis Lee Bieber wrote: I suspect you really should be stepping INTO the calls, not just invoking the functions completely and going to the next LOCAL statement. $ /development/business_tracker/activitytypes.py(1)() -> import sys (Pdb) s $ /development/business_

Re: Neither pdb or print() displays the bug

2021-06-01 Thread Rich Shepard
On Tue, 1 Jun 2021, Ethan Furman wrote: Well, you only had two logging statements in that code -- logging is like print: if you want to see it, you have to call it: Ethan, Got it, thanks. I believe my problem is with the datasource module. I'm focused on making it work (using loggi

Re: Neither pdb or print() displays the bug

2021-06-01 Thread Ethan Furman
On 6/1/21 1:42 PM, Rich Shepard wrote: > When I run it this is the output: > $ python activitytypes.py 2021-06-01 13:39:10,219 -DEBUG - Start of Program > 2021-06-01 13:39:15,229 -DEBUG - End of Program Well, you only had two logging statements in that code -- logging is like prin

Re: Neither pdb or print() displays the bug

2021-06-01 Thread Rich Shepard
On Tue, 1 Jun 2021, Ethan Furman wrote: Sounds like a console issue. Try using `logging` with a file... you could even use `print` with a file if you wanted to. Ethan, Not before using logging I found a reference/example page <https://devopslearning.medium.com/debugging-python-code-logg

Re: Neither pdb or print() displays the bug

2021-06-01 Thread Rich Shepard
On Tue, 1 Jun 2021, Rich Shepard wrote: The QSize() statement is never reached. Correction: the window is 800 x 600, but it's still empty. Rich -- https://mail.python.org/mailman/listinfo/python-list

Re: Neither pdb or print() displays the bug

2021-06-01 Thread Ethan Furman
On 6/1/21 1:18 PM, Rich Shepard wrote: > I'd appreciate recommendations on the process to find where the bug lives > since I can't seem to find it with print() or line-by-line in pdb. Sounds like a console issue. Try using `logging` with a file... you could even use `print` wi

Neither pdb or print() displays the bug

2021-06-01 Thread Rich Shepard
On Sun, 30 May 2021, Cameron Simpson wrote: I've only just started with pdb. As of Python 3.7 there's a builtin function named breakpoint() which drops you into the debugger. I've never been a big debugger person, historicly using print() and equivalent. However, this makes

Re: @unittest.skip doesn't print anything in Python <= 3.7

2021-02-15 Thread אורי
Hi Terry, Shai Berger found the bug and replied in Stack Overflow. Thanks, Uri. אורי u...@speedy.net On Fri, Feb 12, 2021 at 11:36 PM Terry Reedy wrote: > On 2/11/2021 3:25 PM, אורי wrote: > > Hi, > > > > > https://stackoverflow.com/questions/66161394/unittest-skip-

Re: @unittest.skip doesn't print anything in Python <= 3.7

2021-02-12 Thread Terry Reedy
On 2/11/2021 3:25 PM, אורי wrote: Hi, https://stackoverflow.com/questions/66161394/unittest-skip-doesnt-print-anything-in-python-3-7 We are using Django with unittest. Some tests are skipped with the @unittest.skip decorator. But if I run the tests with Python 3.6 or 3.7, I get a number of

@unittest.skip doesn't print anything in Python <= 3.7

2021-02-11 Thread אורי
Hi, https://stackoverflow.com/questions/66161394/unittest-skip-doesnt-print-anything-in-python-3-7 We are using Django with unittest. Some tests are skipped with the @unittest.skip decorator. But if I run the tests with Python 3.6 or 3.7, I get a number of tests passed (Ran 993 tests / OK), and

Re: print the output of my code in Markdown using variable (not the value)

2020-08-15 Thread Mats Wichmann
On 8/15/20 11:00 AM, Michio Suginoo wrote: > Hi, > > I am still at an early stage of my personal Python evolution. > > I am coding Python3 in Jupyter Notebook (Anaconda environment). > > I want to print the output of my code in a 'markdown'. > I want to use the

print the output of my code in Markdown using variable (not the value)

2020-08-15 Thread Michio Suginoo
Hi, I am still at an early stage of my personal Python evolution. I am coding Python3 in Jupyter Notebook (Anaconda environment). I want to print the output of my code in a 'markdown'. I want to use the variable in the 'markdown' rather than typing the output. This would sav

Re: Can a print overwrite a previous print ?

2020-05-08 Thread Cameron Simpson
On 08May2020 09:36, Sir Real wrote: On Fri, 8 May 2020 16:25:52 +0200, ast wrote: Suppose we want that: print("abcdef"); print("ghi") produces: ghidef The 2nd print overwrites the first one. Is it feasible ? On a terminal, yes. This is a display issue. It should si

Can a print overwrite a previous print ?

2020-05-08 Thread ast
Hello Suppose we want that: print("abcdef"); print("ghi") produces: ghidef The 2nd print overwrites the first one. Is it feasible ? It should since the progress bar tdqh seems to do that try: from tkdm import tkdm for i in tqdm(range(100_000_000)): pass It pro

Re: Can a print overwrite a previous print ?

2020-05-08 Thread Sir Real via Python-list
On Fri, 8 May 2020 16:25:52 +0200, ast wrote: >Hello > > >Suppose we want that: > >print("abcdef"); print("ghi") > >produces: > >ghidef > >The 2nd print overwrites the first one. >Is it feasible ? > >It should since the progress ba

Re: print() ignores context ?

2020-05-05 Thread Greg Ewing
On 1/05/20 8:33 pm, R.Wieser wrote: getcontext().rounding=ROUND_HALF_UP print(round(1.5)) print(round(2.5)) If you're talking about getcontext() from the decimal module, that only affects operations with Decimals, not regular floats. Python doesn't provide a way to change the rou

Re: "min( arg1, arg2, *args )" vs. "print( value, ... )"?

2020-04-09 Thread Peter J. Holzer
On 2020-04-08 08:50:07 +0200, Luuk wrote: > On 6-4-2020 22:57, Stefan Ram wrote: > >The documentation ("help" under CPython 3.9) for "min" reads > >(simplified): > > > > min( arg1, arg2, *args ) > > > >, for "print"

Re: "min( arg1, arg2, *args )" vs. "print( value, ... )"?

2020-04-07 Thread Luuk
On 6-4-2020 22:57, Stefan Ram wrote: The documentation ("help" under CPython 3.9) for "min" reads (simplified): min( arg1, arg2, *args ) , for "print" it reads (simplified): print( value, ... ). The caller can place an arbitrary number of argum

Re: print small DataFrame to STDOUT and read it back into dataframe

2020-04-07 Thread Luca
On 4/6/2020 11:05 PM, Luca wrote: On 4/6/2020 8:51 PM, Reto wrote: out = df.to_csv(None) new = pd.read_csv(io.StringIO(out), index_col=0) Thank you, brother. It works BTW, a little gotcha (I write this in case someone gets here in the future through Google or something) """ import pandas

Re: print small DataFrame to STDOUT and read it back into dataframe

2020-04-06 Thread Luca
On 4/6/2020 8:51 PM, Reto wrote: out = df.to_csv(None) new = pd.read_csv(io.StringIO(out), index_col=0) Thank you, brother. It works -- https://mail.python.org/mailman/listinfo/python-list

Re: print small DataFrame to STDOUT and read it back into dataframe

2020-04-06 Thread Reto
On Mon, Apr 06, 2020 at 06:29:01PM -0400, Luca wrote: > so, given a dataframe, how do I make it print itself out as CSV? read the docs of to_csv... > And given CSV data in my clipboard, how do I paste it into a Jupiter cell > (possibly along with a line or two of code) that will

Re: print small DataFrame to STDOUT and read it back into dataframe

2020-04-06 Thread Luca
On 4/6/2020 3:03 PM, Christian Gollwitzer wrote: CSV is the most sensible option here. It is widely supported by spreadsheets etc. and easily copy/pasteable. Thank you Christian. so, given a dataframe, how do I make it print itself out as CSV? And given CSV data in my clipboard, how do

Re: print small DataFrame to STDOUT and read it back into dataframe

2020-04-06 Thread Christian Gollwitzer
Am 06.04.20 um 17:17 schrieb Luca: On 4/6/2020 4:08 AM, Reto wrote: Does this help? Thank you, but not really. What I am trying to achieve is to have a way to copy and paste small yet complete dataframes (which may be the result of previous calculations) between a document (TXT, Word, Google

Re: print small DataFrame to STDOUT and read it back into dataframe

2020-04-06 Thread Luca
On 4/6/2020 4:08 AM, Reto wrote: Does this help? Thank you, but not really. What I am trying to achieve is to have a way to copy and paste small yet complete dataframes (which may be the result of previous calculations) between a document (TXT, Word, GoogleDoc) and Jupiter/IPython. Did I m

Re: print small DataFrame to STDOUT and read it back into dataframe

2020-04-06 Thread Reto
On Sat, Apr 04, 2020 at 07:00:23PM -0400, Luca wrote: > dframe.to_string > > gives: > > 0 a0 b0 c0 d0 > 1 a1 b1 c1 d1 > 2 a2 b2 c2 d2 > 3 a3 b3 c3 d3> That's not the output of to_string. to_string is a method, not an attribute which is apparent by the > comment in your output

print small DataFrame to STDOUT and read it back into dataframe

2020-04-04 Thread Luca
7;], 'C': ['c0','c1','c2','c3'], 'D': ['d0','d1','d2','d3']}, index=[0,1,2,3]) Is there a way that I can ask this dataframe to "print itself&q

Re: Paper Print Help

2020-02-20 Thread Rhodri James
the module that make to print to the paper Please don't reply to me directly; if it's a question worth asking in public then it's worth answering in public too! OK, let's backtrack a bit. First off, what operating system are you using? Second, do you have this GIF file in

Re: Paper Print Help

2020-02-19 Thread Rhodri James
On 19/02/2020 14:22, Duram via Python-list wrote: I have a drawing in a .gif file with (a,b) pixels and want to paperprint it in a position (x,y), what would be the code? What have you tried? -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list

Paper Print Help

2020-02-19 Thread Duram via Python-list
I have a drawing in a .gif file with (a,b) pixels and want to paperprint it in a position (x,y), what would be the code? -- https://mail.python.org/mailman/listinfo/python-list

Re: Print statement

2020-01-28 Thread Frank Millman
On 2020-01-28 12:14 PM, L A Smit wrote: Please help me with this. squares =input("\nSquares: ") print(float((squares) *float(.15)) *(1.3)) Cant print answer.   print(float((squares) * float(.15)) *(1.3)) TypeError: can't multiply sequence by non-int of type 'flo

Print statement

2020-01-28 Thread L A Smit
Please help me with this. squares =input("\nSquares: ") print(float((squares) *float(.15)) *(1.3)) Cant print answer. print(float((squares) * float(.15)) *(1.3)) TypeError: can't multiply sequence by non-int of type 'float' Thx L Smit -- https://mail.python.or

Re: __instancecheck__ metaclasses, how do they work: why do I get True when I tuple, why doesn't print run?

2019-11-05 Thread Pieter van Oostrum
on, and isinstance(inst, cls) first checks if the class of ins is cls, then the result is True. There are a few other shortcut cases, and only at the end the __instancecheck__ method is called. You can check this with the original example: In [88]: class MA(type): ...: def __instancecheck_

Re: __instancecheck__ metaclasses, how do they work: why do I get True when I tuple, why doesn't print run?

2019-11-05 Thread Rhodri James
On 04/11/2019 22:23, Peter J. Holzer wrote: On 2019-11-04 14:54:23 +, Rhodri James wrote: On 04/11/2019 14:33, Veek M wrote: __metaclass__ = whatever; # is python2.x syntax But not Python3: see PEP 3115 Doesn't "X is python2.x syntax" imply "X is not python3 syntax"? Not necessarily,

Re: __instancecheck__ metaclasses, how do they work: why do I get True when I tuple, why doesn't print run?

2019-11-04 Thread Chris Angelico
On Tue, Nov 5, 2019 at 5:43 PM dieter wrote: > I suppose that "isinstance" (at least under Python 2) does not > behave exactly as stated in PEP 3119. Instead, "isinstance" > first directly checks for the instance to be an instance of the > class *AND ONLY IF THIS FAILS* calls the class' "__instanc

Re: __instancecheck__ metaclasses, how do they work: why do I get True when I tuple, why doesn't print run?

2019-11-04 Thread dieter
Veek M writes: I simplify your code to demonstrate what goes on: >>> class MA(type): ... def __instancecheck__(cls, inst): ... print "MA", cls, inst ... >>> class AM(list): __metaclass__ = MA ... >>> am = AM() >>> isinstance(am, AM) True As

Re: __instancecheck__ metaclasses, how do they work: why do I get True when I tuple, why doesn't print run?

2019-11-04 Thread Peter J. Holzer
On 2019-11-04 14:54:23 +, Rhodri James wrote: > On 04/11/2019 14:33, Veek M wrote: > > __metaclass__ = whatever; # is python2.x syntax > > But not Python3: see PEP 3115 Doesn't "X is python2.x syntax" imply "X is not python3 syntax"? hp -- _ | Peter J. Holzer| Story must ma

Re: __instancecheck__ metaclasses, how do they work: why do I get True when I tuple, why doesn't print run?

2019-11-04 Thread Rhodri James
On 04/11/2019 14:33, Veek M wrote: Aha. You're trying to fix up the metaclass after the fact, which is not the right way to do it. If you change the class definitions to: __metaclass__ = whatever; # is python2.x syntax But not Python3: see PEP 3115 then you get the prints from MyMeta.__i

Re: __instancecheck__ metaclasses, how do they work: why do I get True when I tuple, why doesn't print run?

2019-11-04 Thread Veek M
> > Aha. You're trying to fix up the metaclass after the fact, which is not > the right way to do it. If you change the class definitions to: > __metaclass__ = whatever; # is python2.x syntax > then you get the prints from MyMeta.__instancecheck__(). The > isinstance() still returns True, tho

Re: __instancecheck__ metaclasses, how do they work: why do I get True when I tuple, why doesn't print run?

2019-11-04 Thread Rhodri James
hat the results are OR'd The form using a tuple, isinstance(x, (A, B, ...)), is a shortcut for isinstance(x, A) or isinstance(x, B) or ... (etc.). - which implies that the metaclasses are called for each class? class MyzMeta(type): def __instancecheck__(cls, other):

__instancecheck__ metaclasses, how do they work: why do I get True when I tuple, why doesn't print run?

2019-11-04 Thread Veek M
B) or ... (etc.). - which implies that the metaclasses are called for each class? class MyzMeta(type): def __instancecheck__(cls, other): print('MyzzMeta', other) return 0 class MyMeta(MyzMeta, object): def __instancecheck__(cls, other): prin

  1   2   3   4   5   6   7   8   9   10   >